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

Function TestPingPong

internal/xds/test/e2e/e2e_test.go:92–117  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

90}
91
92func TestPingPong(t *testing.T) {
93 const testName = "pingpong"
94 cp, c, _ := setup(t, testOpts{testName: testName})
95
96 resources := e2e.DefaultClientResources(e2e.ResourceParams{
97 DialTarget: testName,
98 NodeID: cp.nodeID,
99 Host: "localhost",
100 Port: serverPort,
101 SecLevel: e2e.SecurityLevelNone,
102 })
103
104 ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
105 defer cancel()
106 if err := cp.server.Update(ctx, resources); err != nil {
107 t.Fatalf("failed to update control plane resources: %v", err)
108 }
109
110 st, err := c.clientStats(ctx)
111 if err != nil {
112 t.Fatalf("failed to get client stats: %v", err)
113 }
114 if st.NumFailures != 0 {
115 t.Fatalf("Got %v failures: %+v", st.NumFailures, st)
116 }
117}
118
119// TestAffinity covers the affinity tests with ringhash policy.
120// - client is configured to use ringhash, with 3 backends

Callers

nothing calls this directly

Calls 5

DefaultClientResourcesFunction · 0.92
clientStatsMethod · 0.80
setupFunction · 0.70
UpdateMethod · 0.65
FatalfMethod · 0.65

Tested by

no test coverage detected