Skip to content

Commit

Permalink
testutil: change panic to log
Browse files Browse the repository at this point in the history
The Server.Start method would panic if gRPC's Serve method returned an
error. This can happen if resources are so constrained that the server
is stopped before Serve is called. (We have seen TestNewServer trigger
this on Travis.) We shouldn't make this a fatal error.

Change-Id: Iaac4e0a11cc7491b16112f91797cebc854ecbcec
Reviewed-on: https://code-review.googlesource.com/33871
Reviewed-by: Jean de Klerk <[email protected]>
  • Loading branch information
jba committed Oct 2, 2018
1 parent 65e3a6b commit f441a24
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/testutil/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package testutil

import (
"fmt"
"log"
"net"
"regexp"
"strconv"
Expand Down Expand Up @@ -78,7 +79,7 @@ func NewServerWithPort(port int, opts ...grpc.ServerOption) (*Server, error) {
func (s *Server) Start() {
go func() {
if err := s.Gsrv.Serve(s.l); err != nil {
panic(err)
log.Printf("testutil.Server.Start: %v", err)
}
}()
}
Expand Down

0 comments on commit f441a24

Please sign in to comment.