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

Failing tests of handlerfuncs_test.go when randomizing execution order of tests #555

Closed
orpheuslummis opened this issue Jun 22, 2022 · 0 comments · Fixed by #557
Closed
Assignees
Labels
area/api Related to the external API component area/testing Related to any test or testing suite bug Something isn't working
Milestone

Comments

@orpheuslummis
Copy link
Contributor

Depending on the root cause(s), this might be a single issue or multiple.
When randomizing the execution order of tests, the following tests of handlerfuncs_test.go fail:

--- FAIL: TestLoadSchemaHandlerWithReadBodyError (0.00s)
    handlerfuncs_test.go:406: 
                Error Trace:    handlerfuncs_test.go:406
                Error:          "" does not contain "error reading"
                Test:           TestLoadSchemaHandlerWithReadBodyError
2022-06-22T15:34:51.064Z, INFO, defra.http, Request, {"Method": "POST", "Path": "/api/v0/graphql", "Status": 400, "Length": 1387, "Elapsed": 0.000039524}
2022-06-22T15:34:51.064Z, ERROR, defra.http, Error while encoding JSON: json: unsupported value: +Inf
2022-06-22T15:34:51.064Z, ERROR, defra.http, Internal Server Error, {"Error": "no database available", "ErrorVerbose": "no database available\ngithub.com/sourcenetwork/defradb/api/http.dbFromContext\n\t/home/o/dev/defradb/api/http/handler.go:109\ngithub.com/sourcenetwork/defradb/api/http.dumpHandler\n\t/home/o/dev/defradb/api/http/handlerfuncs.go:54\ngithub.com/sourcenetwork/defradb/api/http.(*handler).handle.func1\n\t/home/o/dev/defradb/api/http/handler.go:74\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2047\ngithub.com/go-chi/chi/v5.(*Mux).routeHTTP\n\t/home/o/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.7/mux.go:442\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2047\ngithub.com/sourcenetwork/defradb/api/http.loggerMiddleware.func1\n\t/home/o/dev/defradb/api/http/logger.go:57\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2047\ngithub.com/go-chi/chi/v5.(*Mux).ServeHTTP\n\t/home/o/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.7/mux.go:88\ngithub.com/sourcenetwork/defradb/api/http.testRequest\n\t/home/o/dev/defradb/api/http/handlerfuncs_test.go:690\ngithub.com/sourcenetwork/defradb/api/http.TestDumpHandlerWithDBError\n\t/home/o/dev/defradb/api/http/handlerfuncs_test.go:119\ntesting.tRunner\n\t/usr/local/go/src/testing/testing.go:1259\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1581"}
2022-06-22T15:34:51.064Z, INFO, defra.http, Request, {"Method": "GET", "Path": "/api/v0/debug/dump", "Status": 500, "Length": 1395, "Elapsed": 0.000107693}
2022-06-22T15:34:51.064Z, ERROR, defra.http, Internal Server Error, {"Error": "no database available", "ErrorVerbose": "no database available\ngithub.com/sourcenetwork/defradb/api/http.dbFromContext\n\t/home/o/dev/defradb/api/http/handler.go:109\ngithub.com/sourcenetwork/defradb/api/http.loadSchemaHandler\n\t/home/o/dev/defradb/api/http/handlerfuncs.go:137\ngithub.com/sourcenetwork/defradb/api/http.(*handler).handle.func1\n\t/home/o/dev/defradb/api/http/handler.go:74\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2047\ngithub.com/go-chi/chi/v5.(*Mux).routeHTTP\n\t/home/o/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.7/mux.go:442\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2047\ngithub.com/sourcenetwork/defradb/api/http.loggerMiddleware.func1\n\t/home/o/dev/defradb/api/http/logger.go:57\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2047\ngithub.com/go-chi/chi/v5.(*Mux).ServeHTTP\n\t/home/o/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.7/mux.go:88\ngithub.com/sourcenetwork/defradb/api/http.testRequest\n\t/home/o/dev/defradb/api/http/handlerfuncs_test.go:690\ngithub.com/sourcenetwork/defradb/api/http.TestLoadSchemaHandlerWithoutDB\n\t/home/o/dev/defradb/api/http/handlerfuncs_test.go:424\ntesting.tRunner\n\t/usr/local/go/src/testing/testing.go:1259\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1581"}
2022-06-22T10:43:22.567-0500, �[34mINFO�[0m, defra.http, Request, {"Method": "POST", "Path": "/api/v0/graphql", "Status": 400, "Length": 101, "Elapsed": 0.000250666}
--- FAIL: TestExecGQLWithNilBody (0.00s)
    handlerfuncs_test.go:146: 
        	Error Trace:	handlerfuncs_test.go:146
        	Error:      	"" does not contain "body cannot be empty"
        	Test:       	TestExecGQLWithNilBody
2022-06-22T10:43:22.567-0500, �[34mINFO�[0m, defra.http, Request, {"Method": "POST", "Path": "/api/v0/schema/load", "Status": 400, "Length": 94, "Elapsed": 0.000154625}
--- FAIL: TestLoadSchemaHandlerWithReadBodyError (0.00s)
    handlerfuncs_test.go:406: 
        	Error Trace:	handlerfuncs_test.go:406
        	Error:      	"" does not contain "error reading"
        	Test:       	TestLoadSchemaHandlerWithReadBodyError
2022-06-22T10:43:22.567-0500, �[34mINFO�[0m, defra.http, Request, {"Method": "POST", "Path": "/api/v0/graphql", "Status": 400, "Length": 94, "Elapsed": 0.000054209}
--- FAIL: TestExecGQLWithMockBody (0.00s)
    handlerfuncs_test.go:195: 
        	Error Trace:	handlerfuncs_test.go:195
        	Error:      	"" does not contain "error reading"
        	Test:       	TestExecGQLWithMockBody
2022-06-22T10:43:22.567-0500, �[31mERROR�[0m, defra.http, Internal Server Error, {"Error": "no database available", "ErrorVerbose": "no database available\ngithub.com/sourcenetwork/defradb/api/http.dbFromContext\n\t/Users/o/dev/defradb/api/http/handler.go:109\ngithub.com/sourcenetwork/defradb/api/http.getBlockHandler\n\t/Users/o/dev/defradb/api/http/handlerfuncs.go:175\ngithub.com/sourcenetwork/defradb/api/http.(*handler).handle.func1\n\t/Users/o/dev/defradb/api/http/handler.go:74\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2084\ngithub.com/go-chi/chi/v5.(*Mux).routeHTTP\n\t/Users/o/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.7/mux.go:442\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2084\ngithub.com/sourcenetwork/defradb/api/http.loggerMiddleware.func1\n\t/Users/o/dev/defradb/api/http/logger.go:57\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2084\ngithub.com/go-chi/chi/v5.(*Mux).ServeHTTP\n\t/Users/o/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.7/mux.go:88\ngithub.com/sourcenetwork/defradb/api/http.testRequest\n\t/Users/o/dev/defradb/api/http/handlerfuncs_test.go:690\ngithub.com/sourcenetwork/defradb/api/http.TestGetBlockHandlerWithNoDB\n\t/Users/o/dev/defradb/api/http/handlerfuncs_test.go:553\ntesting.tRunner\n\t/usr/local/go/src/testing/testing.go:1439\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_arm64.s:1263"}
2022-06-22T10:43:22.567-0500, �[34mINFO�[0m, defra.http, Request, {"Method": "GET", "Path": "/api/v0/blocks/bafybeidembipteezluioakc2zyke4h5fnj4rr3uaougfyxd35u3qzefzhm", "Status": 500, "Length": 112, "Elapsed": 0.00005525}
--- FAIL: TestGetBlockHandlerWithNoDB (0.00s)
    handlerfuncs_test.go:563: 
        	Error Trace:	handlerfuncs_test.go:563
        	Error:      	"" does not contain "no database available"
        	Test:       	TestGetBlockHandlerWithNoDB
2022-06-22T15:46:51.698Z, ESC[31mERRORESC[0m, defra.http, Internal Server Error, {"Error": "no database available", "ErrorVerbose": "no database available\ngithub.com/sourcenetwork/defradb/api/http.dbFromContext\n\t/home/o/dev/defradb/api/http/handler.go:109\ngithub.com/sourcenetwork/defradb/api/http.getBlockHandler\n\t/home/o/dev/defradb/api/http/handlerfuncs.go:175\ngithub.com/sourcenetwork/defradb/api/http.(*handler).handle.func1\n\t/home/o/dev/defradb/api/http/handler.go:74\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2047\ngithub.com/go-chi/chi/v5.(*Mux).routeHTTP\n\t/home/o/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.7/mux.go:442\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2047\ngithub.com/sourcenetwork/defradb/api/http.loggerMiddleware.func1\n\t/home/o/dev/defradb/api/http/logger.go:57\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2047\ngithub.com/go-chi/chi/v5.(*Mux).ServeHTTP\n\t/home/o/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.7/mux.go:88\ngithub.com/sourcenetwork/defradb/api/http.testRequest\n\t/home/o/dev/defradb/api/http/handlerfuncs_test.go:690\ngithub.com/sourcenetwork/defradb/api/http.TestGetBlockHandlerWithDSKeyWithNoDB\n\t/home/o/dev/defradb/api/http/handlerfuncs_test.go:535\ntesting.tRunner\n\t/usr/local/go/src/testing/testing.go:1259\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1581"}
2022-06-22T15:46:51.698Z, ESC[34mINFOESC[0m, defra.http, Request, {"Method": "GET", "Path": "/api/v0/blocks/CIQGIYCQ7GIJSXIQ4AUFVTQUJYP2K2TZDDXIA5IMLROHX3JXBSILSOY", "Status": 500, "Length": 112, "Elapsed": 0.000165912}
--- FAIL: TestGetBlockHandlerWithDSKeyWithNoDB (0.00s)
    handlerfuncs_test.go:545: 
                Error Trace:    handlerfuncs_test.go:545
                Error:          "" does not contain "no database available"
                Test:           TestGetBlockHandlerWithDSKeyWithNoDB
--- FAIL: TestGetBlockHandlerWithGetBlockstoreError (0.00s)
    handlerfuncs_test.go:584: 
                Error Trace:    handlerfuncs_test.go:584
                Error:          "" does not contain "ipld: could not find bafybeidembipteezluioakc2zyke4h5fnj4rr3uaougfyxd35u3qzefzhm"
                Test:           TestGetBlockHandlerWithGetBlockstoreError
--- FAIL: TestLoadSchemaHandlerWithAddSchemaError (0.00s)
    handlerfuncs_test.go:466: 
                Error Trace:    handlerfuncs_test.go:466
                Error:          "" does not contain "Syntax Error GraphQL (2:1) Unexpected Name"
                Test:           TestLoadSchemaHandlerWithAddSchemaError
--- FAIL: TestExecGQLHandlerContentTypeJSONWithJSONError (0.00s)
    handlerfuncs_test.go:255: 
                Error Trace:    handlerfuncs_test.go:255
                Error:          "" does not contain "invalid character"
                Test:           TestExecGQLHandlerContentTypeJSONWithJSONError
--- FAIL: TestExecGQLHandlerContentTypeJSONWithJSONError (0.00s)
    handlerfuncs_test.go:255: 
                Error Trace:    handlerfuncs_test.go:255
                Error:          "" does not contain "invalid character"
                Test:           TestExecGQLHandlerContentTypeJSONWithJSONError
@orpheuslummis orpheuslummis added area/api Related to the external API component area/testing Related to any test or testing suite labels Jun 22, 2022
@orpheuslummis orpheuslummis added this to the DefraDB v0.3 milestone Jun 22, 2022
@orpheuslummis orpheuslummis self-assigned this Jun 22, 2022
@orpheuslummis orpheuslummis added the bug Something isn't working label Jun 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/api Related to the external API component area/testing Related to any test or testing suite bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant