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

Method TestClientCredsInvalidHandshakeInfo

credentials/xds/xds_client_test.go:297–310  ·  view source on GitHub ↗

TestClientCredsInvalidHandshakeInfo verifies scenarios where the passed in HandshakeInfo is invalid because it does not contain the expected certificate providers.

(t *testing.T)

Source from the content-addressed store, hash-verified

295// HandshakeInfo is invalid because it does not contain the expected certificate
296// providers.
297func (s) TestClientCredsInvalidHandshakeInfo(t *testing.T) {
298 opts := ClientOptions{FallbackCreds: makeFallbackClientCreds(t)}
299 creds, err := NewClientCredentials(opts)
300 if err != nil {
301 t.Fatalf("NewClientCredentials(%v) failed: %v", opts, err)
302 }
303
304 pCtx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
305 defer cancel()
306 ctx := newTestContextWithHandshakeInfo(pCtx, nil, &fakeProvider{}, "", "", false)
307 if _, _, err := creds.ClientHandshake(ctx, authority, nil); err == nil {
308 t.Fatal("ClientHandshake succeeded without root certificate provider in HandshakeInfo")
309 }
310}
311
312// TestClientCredsProviderFailure verifies the cases where an expected
313// certificate provider is missing in the HandshakeInfo value in the context.

Callers

nothing calls this directly

Calls 6

makeFallbackClientCredsFunction · 0.85
NewClientCredentialsFunction · 0.85
FatalfMethod · 0.65
ClientHandshakeMethod · 0.65
FatalMethod · 0.65

Tested by

no test coverage detected