guac icon indicating copy to clipboard operation
guac copied to clipboard

[bug] Places where race conditions in testing fails

Open neilnaveen opened this issue 2 years ago • 3 comments

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

neilnaveen avatar Oct 01 '23 21:10 neilnaveen

good find @neilnaveen. Are you working to fix these?

pxp928 avatar Oct 02 '23 18:10 pxp928

good find @neilnaveen. Are you working to fix these?

Yes I am working to fix these.

neilnaveen avatar Oct 02 '23 21:10 neilnaveen

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.

lumjjb avatar Oct 04 '23 15:10 lumjjb