TestConfigUpdate_BadChildPolicyConfigs tests the scenario where a config update is rejected by the child policy. Verifies that the child policy wrapper goes "lame" and the error from the child policy is reported back to the caller of the RPC.
(t *testing.T)
| 519 | // wrapper goes "lame" and the error from the child policy is reported back to |
| 520 | // the caller of the RPC. |
| 521 | func (s) TestConfigUpdate_BadChildPolicyConfigs(t *testing.T) { |
| 522 | // Start an RLS server and set the throttler to never throttle requests. |
| 523 | rlsServer, rlsReqCh := rlstest.SetupFakeRLSServer(t, nil) |
| 524 | overrideAdaptiveThrottler(t, neverThrottlingThrottler()) |
| 525 | |
| 526 | // Set up the RLS server to respond with a bad target field which is expected |
| 527 | // to cause the child policy's ParseTarget to fail and should result in the LB |
| 528 | // policy creating a lame child policy wrapper. |
| 529 | rlsServer.SetResponseCallback(func(_ context.Context, _ *rlspb.RouteLookupRequest) *rlstest.RouteLookupResponse { |
| 530 | return &rlstest.RouteLookupResponse{Resp: &rlspb.RouteLookupResponse{Targets: []string{e2e.RLSChildPolicyBadTarget}}} |
| 531 | }) |
| 532 | |
| 533 | // Build RLS service config with a default target. This default backend is |
| 534 | // expected to be healthy (even though we don't attempt to route RPCs to it) |
| 535 | // and ensures that the overall connectivity state of the RLS LB policy is not |
| 536 | // TRANSIENT_FAILURE. This is required to make sure that the pick for the bad |
| 537 | // child policy actually gets delegated to the child policy picker. |
| 538 | rlsConfig := buildBasicRLSConfigWithChildPolicy(t, t.Name(), rlsServer.Address) |
| 539 | _, addr := startBackend(t) |
| 540 | rlsConfig.RouteLookupConfig.DefaultTarget = addr |
| 541 | |
| 542 | // Register a manual resolver and push the RLS service config through it. |
| 543 | r := startManualResolverWithConfig(t, rlsConfig) |
| 544 | |
| 545 | cc, err := grpc.NewClient(r.Scheme()+":///", grpc.WithResolvers(r), grpc.WithTransportCredentials(insecure.NewCredentials())) |
| 546 | if err != nil { |
| 547 | t.Fatalf("Failed to create gRPC client: %v", err) |
| 548 | } |
| 549 | defer cc.Close() |
| 550 | |
| 551 | // Make an RPC and ensure that if fails with the expected error. |
| 552 | ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout) |
| 553 | defer cancel() |
| 554 | makeTestRPCAndVerifyError(ctx, t, cc, codes.Unavailable, e2e.ErrParseConfigBadTarget) |
| 555 | |
| 556 | // Make sure an RLS request is sent out. |
| 557 | verifyRLSRequest(t, rlsReqCh, true) |
| 558 | } |
| 559 | |
| 560 | // TestConfigUpdate_DataCacheSizeDecrease tests the scenario where a config |
| 561 | // update decreases the data cache size. Verifies that entries are evicted from |
nothing calls this directly
no test coverage detected