MCPcopy
hub / github.com/grpc/grpc-go / TestGracefulStop

Method TestGracefulStop

server_test.go:67–85  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

65}
66
67func (s) TestGracefulStop(t *testing.T) {
68
69 lis, err := net.Listen("tcp", "localhost:0")
70 if err != nil {
71 t.Fatalf("failed to create listener: %v", err)
72 }
73
74 server := NewServer()
75 go func() {
76 // make sure Serve() is called
77 time.Sleep(time.Millisecond * 500)
78 server.GracefulStop()
79 }()
80
81 err = server.Serve(lis)
82 if err != nil {
83 t.Fatalf("Serve() returned non-nil error on GracefulStop: %v", err)
84 }
85}
86
87func (s) TestGetServiceInfo(t *testing.T) {
88 testSd := ServiceDesc{

Callers

nothing calls this directly

Calls 4

GracefulStopMethod · 0.95
ServeMethod · 0.95
NewServerFunction · 0.70
FatalfMethod · 0.65

Tested by

no test coverage detected