cs3org / reva

WebDAV/gRPC/HTTP high performance server to link high level clients to storage backends

Home Page:https://reva.link

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Running unit tests

michielbdejong opened this issue · comments

Looking at https://drone.cernbox.cern.ch/cs3org/reva/1586/1/4 line 230 it seems the test for github.com/cs3org/reva/pkg/auth/manager/json is green, but when trying to run make test on my laptop, I'm seeing it fail:

--- FAIL: TestGetManagerWithInvalidUser (0.00s)
    --- FAIL: TestGetManagerWithInvalidUser/Nil_in_user (0.00s)
        json_test.go:67: 
            	Error Trace:	json_test.go:67
            	Error:      	Should be empty, but was &{map[einstein:0xc00047db20 marie:0xc00047db90 richard:0xc00047dc00]}
            	Test:       	TestGetManagerWithInvalidUser/Nil_in_user
        json_test.go:68: 
            	Error Trace:	json_test.go:68
            	Error:      	An error is expected but got nil.
            	Test:       	TestGetManagerWithInvalidUser/Nil_in_user
FAIL
FAIL	github.com/cs3org/reva/pkg/auth/manager/json	0.621s

Any idea why?

@michielbdejong, this is caused by the nil_in_user test case in TestGetManagerWithInvalidUser. The default behavior of the auth json driver is to fetch the json file from /etc/revad/users.json (i.e when no config is provided), which is what the test case is doing (passing nil in the users field.) But there might be a case wherein one already has a json file at /etc/revad/users.json (locally), due to which reva would not throw error causing the test case to fail.

I think that the CI build is passing because there is no file at /etc/revad/users, causing reva to throw an error, which in turn passes the test. I faced the same issue, after deleting users.json from /etc/revad/users, the test case passed as expected! :)

That was it! Thanks. I'll send a PR to add a note in the docs.