mirror of https://github.com/grpc/grpc-java.git
grpclb: add description to lb sends no backends status (#6751)
This commit is contained in:
parent
47c0b0b792
commit
4b201267c6
|
|
@ -91,6 +91,9 @@ final class GrpclbState {
|
|||
@VisibleForTesting
|
||||
static final PickResult DROP_PICK_RESULT =
|
||||
PickResult.withDrop(Status.UNAVAILABLE.withDescription("Dropped as requested by balancer"));
|
||||
@VisibleForTesting
|
||||
static final Status NO_AVAILABLE_BACKENDS_STATUS =
|
||||
Status.UNAVAILABLE.withDescription("LoadBalancer responded without any backends");
|
||||
|
||||
@VisibleForTesting
|
||||
static final RoundRobinEntry BUFFER_ENTRY = new RoundRobinEntry() {
|
||||
|
|
@ -742,7 +745,8 @@ final class GrpclbState {
|
|||
if (backendList.isEmpty()) {
|
||||
if (lbSentEmptyBackends) {
|
||||
pickList =
|
||||
Collections.<RoundRobinEntry>singletonList(new ErrorEntry(Status.UNAVAILABLE));
|
||||
Collections.<RoundRobinEntry>singletonList(
|
||||
new ErrorEntry(NO_AVAILABLE_BACKENDS_STATUS));
|
||||
state = TRANSIENT_FAILURE;
|
||||
} else {
|
||||
pickList = Collections.singletonList(BUFFER_ENTRY);
|
||||
|
|
|
|||
|
|
@ -1939,7 +1939,8 @@ public class GrpclbLoadBalancerTest {
|
|||
|
||||
inOrder.verify(helper).updateBalancingState(eq(TRANSIENT_FAILURE), pickerCaptor.capture());
|
||||
RoundRobinPicker errorPicker = (RoundRobinPicker) pickerCaptor.getValue();
|
||||
assertThat(errorPicker.pickList).containsExactly(new ErrorEntry(Status.UNAVAILABLE));
|
||||
assertThat(errorPicker.pickList)
|
||||
.containsExactly(new ErrorEntry(GrpclbState.NO_AVAILABLE_BACKENDS_STATUS));
|
||||
|
||||
lbResponseObserver.onNext(buildLbResponse(Collections.<ServerEntry>emptyList()));
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue