MCPcopy
hub / github.com/grpc-ecosystem/grpc-gateway / waitForGateway

Function waitForGateway

examples/internal/integration/main_test.go:36–54  ·  view source on GitHub ↗
(ctx context.Context, port uint16)

Source from the content-addressed store, hash-verified

34}
35
36func waitForGateway(ctx context.Context, port uint16) error {
37 ch := time.After(10 * time.Second)
38
39 for {
40 r, err := http.Get(fmt.Sprintf("http://localhost:%d/healthz", port))
41 if err == nil && r.StatusCode == http.StatusOK {
42 return nil
43 }
44
45 grpclog.Infof("Waiting for localhost:%d to get ready", port)
46 select {
47 case <-ctx.Done():
48 return err
49 case <-ch:
50 return err
51 case <-time.After(10 * time.Millisecond):
52 }
53 }
54}
55
56func runServers(ctx context.Context) <-chan error {
57 ch := make(chan error, 3)

Callers 5

testResponseStringsFunction · 0.85
TestNonStandardNamesFunction · 0.85
TestMainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected