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
|
@VisibleForTesting
|
||||||
static final PickResult DROP_PICK_RESULT =
|
static final PickResult DROP_PICK_RESULT =
|
||||||
PickResult.withDrop(Status.UNAVAILABLE.withDescription("Dropped as requested by balancer"));
|
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
|
@VisibleForTesting
|
||||||
static final RoundRobinEntry BUFFER_ENTRY = new RoundRobinEntry() {
|
static final RoundRobinEntry BUFFER_ENTRY = new RoundRobinEntry() {
|
||||||
|
|
@ -742,7 +745,8 @@ final class GrpclbState {
|
||||||
if (backendList.isEmpty()) {
|
if (backendList.isEmpty()) {
|
||||||
if (lbSentEmptyBackends) {
|
if (lbSentEmptyBackends) {
|
||||||
pickList =
|
pickList =
|
||||||
Collections.<RoundRobinEntry>singletonList(new ErrorEntry(Status.UNAVAILABLE));
|
Collections.<RoundRobinEntry>singletonList(
|
||||||
|
new ErrorEntry(NO_AVAILABLE_BACKENDS_STATUS));
|
||||||
state = TRANSIENT_FAILURE;
|
state = TRANSIENT_FAILURE;
|
||||||
} else {
|
} else {
|
||||||
pickList = Collections.singletonList(BUFFER_ENTRY);
|
pickList = Collections.singletonList(BUFFER_ENTRY);
|
||||||
|
|
|
||||||
|
|
@ -1939,7 +1939,8 @@ public class GrpclbLoadBalancerTest {
|
||||||
|
|
||||||
inOrder.verify(helper).updateBalancingState(eq(TRANSIENT_FAILURE), pickerCaptor.capture());
|
inOrder.verify(helper).updateBalancingState(eq(TRANSIENT_FAILURE), pickerCaptor.capture());
|
||||||
RoundRobinPicker errorPicker = (RoundRobinPicker) pickerCaptor.getValue();
|
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()));
|
lbResponseObserver.onNext(buildLbResponse(Collections.<ServerEntry>emptyList()));
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue