TestExitIdle tests the ExitIdle operation on the Graceful Switch Balancer.
(t *testing.T)
| 797 | |
| 798 | // TestExitIdle tests the ExitIdle operation on the Graceful Switch Balancer. |
| 799 | func (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 | |
| 814 | const balancerName1 = "mock_balancer_1" |
| 815 | const balancerName2 = "mock_balancer_2" |
nothing calls this directly
no test coverage detected