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

Method TestExitIdle

internal/balancer/gracefulswitch/gracefulswitch_test.go:799–812  ·  view source on GitHub ↗

TestExitIdle tests the ExitIdle operation on the Graceful Switch Balancer.

(t *testing.T)

Source from the content-addressed store, hash-verified

797
798// TestExitIdle tests the ExitIdle operation on the Graceful Switch Balancer.
799func (s) TestExitIdle(t *testing.T) {
800 _, gsb := setup(t)
801 // switch to a balancer that implements ExitIdle{} (will populate current).
802 gsb.SwitchTo(mockBalancerBuilder1{})
803 currBal := gsb.balancerCurrent.Balancer.(*mockBalancer)
804 ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
805 defer cancel()
806 // exitIdle on the Graceful Switch Balancer should get forwarded to the
807 // current child as it implements exitIdle.
808 gsb.ExitIdle()
809 if err := currBal.waitForExitIdle(ctx); err != nil {
810 t.Fatal(err)
811 }
812}
813
814const balancerName1 = "mock_balancer_1"
815const balancerName2 = "mock_balancer_2"

Callers

nothing calls this directly

Calls 5

SwitchToMethod · 0.80
waitForExitIdleMethod · 0.80
setupFunction · 0.70
ExitIdleMethod · 0.65
FatalMethod · 0.65

Tested by

no test coverage detected