TestClientCredsInvalidHandshakeInfo verifies scenarios where the passed in HandshakeInfo is invalid because it does not contain the expected certificate providers.
(t *testing.T)
| 295 | // HandshakeInfo is invalid because it does not contain the expected certificate |
| 296 | // providers. |
| 297 | func (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. |
nothing calls this directly
no test coverage detected