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 4bc5557
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/network/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,10 @@ func (s *Server) Shutdown() {
}
close(s.quit)
<-s.relayFin

if err := s.log.Sync(); err != nil {
fmt.Printf("Error flushing server logs: %v\n", err)
}
}

// AddService allows to add a service to be started/stopped by Server.
Expand Down

0 comments on commit 4bc5557

Please sign in to comment.