Skip to content
Prev Previous commit
Next Next commit
Improve test to reflect each subchannel operates individually.
  • Loading branch information
voidzcy committed Apr 3, 2020
commit 72e60ab32ee5d6b9509e36fc6917f09c33593fc2
10 changes: 2 additions & 8 deletions core/src/test/java/io/grpc/util/RoundRobinLoadBalancerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -303,26 +303,20 @@ public void stayTransientFailureUntilReady() {

inOrder.verify(mockHelper).updateBalancingState(eq(CONNECTING), isA(EmptyPicker.class));

// Simulate state transitions for each subchannel individually.
for (Subchannel sc : loadBalancer.getSubchannels()) {
deliverSubchannelState(
sc,
ConnectivityStateInfo
.forTransientFailure(Status.UNKNOWN.withDescription("connection broken")));
}
inOrder.verify(mockHelper).updateBalancingState(eq(TRANSIENT_FAILURE), isA(EmptyPicker.class));

for (Subchannel sc : loadBalancer.getSubchannels()) {
deliverSubchannelState(
sc,
ConnectivityStateInfo.forNonError(IDLE));
}
inOrder.verifyNoMoreInteractions();

for (Subchannel sc : loadBalancer.getSubchannels()) {
deliverSubchannelState(
sc,
ConnectivityStateInfo.forNonError(CONNECTING));
}
inOrder.verify(mockHelper).updateBalancingState(eq(TRANSIENT_FAILURE), isA(EmptyPicker.class));
inOrder.verifyNoMoreInteractions();

Subchannel subchannel = loadBalancer.getSubchannels().iterator().next();
Expand Down