guac
guac copied to clipboard
[bug] Places where race conditions in testing fails
Describe the bug Based on https://github.com/guacsec/guac/issues/1335, I enabled race conditions on the test and ran into these issues
Test_SearchSubgraphFromVuln (0.00s)
panic: http: multiple registrations for /query [recovered]
panic: http: multiple registrations for /query
Test_gitCol_RetrieveArtifacts/get_repo
git_test.go:124: number of files collected does not match test = 10, want 9
FAIL: Test_gitCol_RetrieveArtifacts (1.89s)
--- FAIL: Test_gitCol_RetrieveArtifacts/get_repo (0.35s)
Test_DsseParser/testing
{"level":"warn","ts":1696190765.0445309,"caller":"dsse/parser_dsse.go:74","msg":"DSSE verification currently not implemented in this release. Continuing without DSSE verification"}
--- FAIL: Test_DsseParser (0.00s)
TestVerifyIdentity
verifier_test.go:132: RegisterVerifier() failed with error: the verification provider is being overwritten: sigstore
=== RUN TestVerifyIdentity/verify
=== RUN TestVerifyIdentity/not_found
--- FAIL: TestVerifyIdentity (0.00s)
Test_prom_NewCounter/default
--- FAIL: Test_prom_NewCounter (0.00s)
--- FAIL: Test_prom_NewCounter/default (0.00s)
panic: duplicate metrics collector registration attempted [recovered]
panic: duplicate metrics collector registration attempted
To Reproduce
Add -count=2 to the make test target in the Makefile.
Expected behavior No errors should pop up
GUAC version latest commit
Race Condition Failures
- [ ] Test_SearchSubgraphFromVuln
- [ ] Test_gitCol_RetrieveArtifacts
- [ ] Test_DsseParser
- [x] TestVerifyIdentity
- [ ] Test_prom_NewCounter
good find @neilnaveen. Are you working to fix these?
good find @neilnaveen. Are you working to fix these?
Yes I am working to fix these.
Quick note - many of these are not race conditions but that the tests are not idempotent. I.e. running them twice will not yield the same result. The fix would be to do ignore errors that are not a big deal or do proper setup and tear down of tests.