Hi everyone, Our team has been working on modifyin...
# contributors
d
Hi everyone, Our team has been working on modifying Kratos to handle the verification of ID tokens with a generic provider. The upstream code only supports this for Google and Apple providers. However, we implemented the changes in a copy/paste manner. Now, the Google and Apple providers should re-use the newly generic code. We’re currently facing an issue with running the unit tests. There are no unit tests for this part yet, and whenever we try to run the tests, they fail with a 400 error code like this:
API error (400): invalid tag format
. This error doesn’t provide much information beyond indicating that something is not being received as expected. Has anyone encountered this issue before or does anyone have any insights on what might be causing these test failures? Any guidance on documentation or steps to troubleshoot and resolve this problem would be greatly appreciated. Thank you for your help!
b
How are you running the tests?
d
Copy code
make test-resetdb
export TEST_DATABASE_MYSQL='<mysql://root>:secret@(127.0.0.1:3444)/mysql?parseTime=true'
export TEST_DATABASE_POSTGRESQL='<postgres://postgres:secret@127.0.0.1:3445/kratos?sslmode=disable>'
export TEST_DATABASE_COCKROACHDB='<cockroach://root@127.0.0.1:3446/defaultdb?sslmode=disable>'

cd selfservice/strategy/oidc
go test  -tags sqlite  .
here is the full error:
Copy code
--- FAIL: TestPostEndpointRedirect (1.73s)
    strategy_helper_test.go:246: Environment did not provide Ory Hydra, starting fresh.
    strategy_helper_test.go:270:
        	Error Trace:	/Users/kosborn/git/fulcrumapp/kratos/selfservice/strategy/oidc/strategy_helper_test.go:270
        	            				/Users/kosborn/git/fulcrumapp/kratos/selfservice/strategy/oidc/strategy_test.go:1430
        	Error:      	Received unexpected error:
        	            	API error (400): invalid tag format

        	            	<http://github.com/ory/dockertest/v3.(*Pool).RunWithOptions|github.com/ory/dockertest/v3.(*Pool).RunWithOptions>
        	            		/Users/kosborn/go/pkg/mod/github.com/ory/dockertest/v3@v3.9.1/dockertest.go:413
        	            	<http://github.com/ory/kratos/selfservice/strategy/oidc_test.newHydra|github.com/ory/kratos/selfservice/strategy/oidc_test.newHydra>
        	            		/Users/kosborn/git/fulcrumapp/kratos/selfservice/strategy/oidc/strategy_helper_test.go:252
        	            	<http://github.com/ory/kratos/selfservice/strategy/oidc_test.TestPostEndpointRedirect|github.com/ory/kratos/selfservice/strategy/oidc_test.TestPostEndpointRedirect>
        	            		/Users/kosborn/git/fulcrumapp/kratos/selfservice/strategy/oidc/strategy_test.go:1430
        	            	testing.tRunner
        	            		/usr/local/opt/go/libexec/src/testing/testing.go:1595
        	            	runtime.goexit
        	            		/usr/local/opt/go/libexec/src/runtime/asm_amd64.s:1650
        	Test:       	TestPostEndpointRedirect
FAIL
FAIL	<http://github.com/ory/kratos/selfservice/strategy/oidc|github.com/ory/kratos/selfservice/strategy/oidc>	46.446s
b
That's interesting and I can reproduce the issue, I'll take a look. Btw. we generally run the tests with the following tags:
-tags sqlite,json1
That's not the issue here, but might solve other problems.
d
ill try it, thanks
btw Im using kratos only (without Hydra)
b
These tests are testing the integration with hydra, so they're important. In CI we start hydra before running the tests.
d
ok ill try it. thanks
I want to run unit test locally before submitting a PR. how we can do that? getting the services up with docker is enough?
b
As I said, this is a bug in the test setup. It’s fine to just ignore the test failure and create a PR, if everything works the CI will pass on that.