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.

 Close #2973

Signed-off-by: Ekaterina Pavlova <[email protected]>
  • Loading branch information
AliceInHunterland committed Feb 13, 2024
1 parent dbe6622 commit ffd1e0b
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)
}

Check warning on line 325 in pkg/network/server.go

View check run for this annotation

Codecov / codecov/patch

pkg/network/server.go#L324-L325

Added lines #L324 - L325 were not covered by tests
}

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

0 comments on commit ffd1e0b

Please sign in to comment.