(t *testing.T)
| 145 | } |
| 146 | |
| 147 | func (s) TestCredsBundleFromBalancer(t *testing.T) { |
| 148 | balancer.Register(&testBalancer{ |
| 149 | newSubConnOptions: balancer.NewSubConnOptions{ |
| 150 | CredsBundle: &testCredsBundle{}, |
| 151 | }, |
| 152 | }) |
| 153 | te := newTest(t, env{name: "creds-bundle", network: "tcp", balancer: ""}) |
| 154 | te.tapHandle = authHandle |
| 155 | te.customDialOptions = []grpc.DialOption{ |
| 156 | grpc.WithDefaultServiceConfig(fmt.Sprintf(`{"loadBalancingConfig": [{"%s":{}}]}`, testBalancerName)), |
| 157 | grpc.WithAuthority("x.test.example.com"), |
| 158 | } |
| 159 | creds, err := credentials.NewServerTLSFromFile(testdata.Path("x509/server1_cert.pem"), testdata.Path("x509/server1_key.pem")) |
| 160 | if err != nil { |
| 161 | t.Fatalf("Failed to generate credentials %v", err) |
| 162 | } |
| 163 | te.customServerOptions = []grpc.ServerOption{ |
| 164 | grpc.Creds(creds), |
| 165 | } |
| 166 | te.startServer(&testServer{}) |
| 167 | defer te.tearDown() |
| 168 | |
| 169 | cc := te.clientConn() |
| 170 | tc := testgrpc.NewTestServiceClient(cc) |
| 171 | ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout) |
| 172 | defer cancel() |
| 173 | if _, err := tc.EmptyCall(ctx, &testpb.Empty{}); err != nil { |
| 174 | t.Fatalf("Test failed. Reason: %v", err) |
| 175 | } |
| 176 | } |
| 177 | |
| 178 | func (s) TestPickExtraMetadata(t *testing.T) { |
| 179 | for _, e := range listTestEnv() { |
nothing calls this directly
no test coverage detected