ipfs / boxo

A set of reference libraries for building IPFS applications and implementations in Go.
https://github.com/ipfs/boxo#readme
Other
181 stars 83 forks source link

fix(routing/mock): wait for goroutine cleanup #619

Closed aschmahmann closed 4 weeks ago

aschmahmann commented 1 month ago

Previously the test was flaky as the goroutine with the log could linger even after the test finished

❯ go test -run TestCanceledContext -count=10000
panic: Log in goroutine after TestCanceledContext has completed: exiting async worker

goroutine 2960 [running]:
testing.(*common).logDepth(0xc00039f040, {0xc000022108, 0x15}, 0x3)
        /go1.22.1/src/testing/testing.go:1028 +0x4c5
testing.(*common).log(...)
        /go1.22.1/src/testing/testing.go:1010
testing.(*common).Log(0xc00039f040, {0xc000637fb8?, 0x1?, 0x1?})
        /go1.22.1/src/testing/testing.go:1051 +0x4a
github.com/ipfs/boxo/routing/mock.TestCanceledContext.func2()
        /boxo/routing/mock/centralized_test.go:98 +0x351
created by github.com/ipfs/boxo/routing/mock.TestCanceledContext in goroutine 2959
        /boxo/routing/mock/centralized_test.go:94 +0x2c5
exit status 2
FAIL    github.com/ipfs/boxo/routing/mock       0.449s
codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 59.76%. Comparing base (435d838) to head (50b68d0). Report is 1 commits behind head on main.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #619      +/-   ##
==========================================
+ Coverage   59.70%   59.76%   +0.06%     
==========================================
  Files         239      239              
  Lines       29961    29961              
==========================================
+ Hits        17889    17907      +18     
+ Misses      10453    10438      -15     
+ Partials     1619     1616       -3     

see 15 files with indirect coverage changes