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

Method TestWithTransportCredentialsTLS

dial_test.go:188–202  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

186}
187
188func (s) TestWithTransportCredentialsTLS(t *testing.T) {
189 ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond)
190 defer cancel()
191 creds, err := credentials.NewClientTLSFromFile(testdata.Path("x509/server_ca_cert.pem"), "x.test.example.com")
192 if err != nil {
193 t.Fatalf("Failed to create credentials %v", err)
194 }
195 conn, err := DialContext(ctx, "passthrough:///Non-Existent.Server:80", WithTransportCredentials(creds), WithBlock())
196 if err == nil {
197 conn.Close()
198 }
199 if err != context.DeadlineExceeded {
200 t.Fatalf("Dial(_, _) = %v, %v, want %v", conn, err, context.DeadlineExceeded)
201 }
202}
203
204func (s) TestDialContextCancel(t *testing.T) {
205 ctx, cancel := context.WithCancel(context.Background())

Callers

nothing calls this directly

Calls 7

NewClientTLSFromFileFunction · 0.92
PathFunction · 0.92
DialContextFunction · 0.85
WithTransportCredentialsFunction · 0.85
WithBlockFunction · 0.85
FatalfMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected