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

Function verifyAddressInNewSubConn

balancer/weightedtarget/weightedtarget_test.go:1261–1270  ·  view source on GitHub ↗

Verify that a SubConn is created with the expected address.

(t *testing.T, cc *testutils.BalancerClientConn, addr resolver.Address)

Source from the content-addressed store, hash-verified

1259
1260// Verify that a SubConn is created with the expected address.
1261func verifyAddressInNewSubConn(t *testing.T, cc *testutils.BalancerClientConn, addr resolver.Address) {
1262 t.Helper()
1263
1264 gotAddr := <-cc.NewSubConnAddrsCh
1265 wantAddr := []resolver.Address{addr}
1266 gotAddr[0].BalancerAttributes = nil
1267 if diff := cmp.Diff(gotAddr, wantAddr, cmp.AllowUnexported(attributes.Attributes{})); diff != "" {
1268 t.Fatalf("got unexpected new subconn addrs: %v", diff)
1269 }
1270}
1271
1272// subConnWithAddr wraps a subConn and the address for which it was created.
1273type subConnWithAddr struct {

Calls 1

FatalfMethod · 0.65

Tested by

no test coverage detected