Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running unit tests #1736

Closed
michielbdejong opened this issue May 27, 2021 · 2 comments
Closed

Running unit tests #1736

michielbdejong opened this issue May 27, 2021 · 2 comments

Comments

@michielbdejong
Copy link
Contributor

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?

@jimil749
Copy link
Member

@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! :)

@michielbdejong
Copy link
Contributor Author

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

michielbdejong added a commit to michielbdejong/reva that referenced this issue May 28, 2021
labkode pushed a commit that referenced this issue Jun 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants