Slide 16
Slide 16 text
Testing without `main`
!16
func TestMain(m *testing.M) {
os.Exit(func() (status int) {
// …
conn, err := grpc.DialContext(
context.Background(),
fmt.Sprintf(":%s", port),
grpc.WithInsecure(),
grpc.WithBlock(),
grpc.WithTimeout(5*time.Second),
)
// …
grpcClient = pb.NewServerClient(conn)
// …
return m.Run()
}())
}
server/server_test.go