Skip to content

Commit

Permalink
network: fix TestServerRegisterPeer data race
Browse files Browse the repository at this point in the history
To prevent logs after the test ends we need to properly shutdown the
server. The problem is likely related to the fact that zap logger writes
 logs after the test ends.

Signed-off-by: Ekaterina Pavlova <[email protected]>
  • Loading branch information
AliceInHunterland committed Feb 13, 2024
1 parent dbe6622 commit b45b9cc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-20.04, windows-2022, macos-12]
go_versions: [ '1.19', '1.20', '1.21' ]
go_versions: [ '1.18','1.19', '1.20', '1.21' ]
exclude:
# Only latest Go version for Windows and MacOS.
- os: windows-2022
Expand Down
2 changes: 1 addition & 1 deletion pkg/network/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ func startTestServer(t *testing.T, protocolCfg ...func(*config.Blockchain)) *Ser
func startWithCleanup(t *testing.T, s *Server) {
go s.Start()
t.Cleanup(func() {
s.Shutdown()
defer s.Shutdown()
})
}

Expand Down

0 comments on commit b45b9cc

Please sign in to comment.