Skip to content

Commit 1fdfa0b

Browse files
committed
After doing eager init for the fallback policy child wrapper in CachingRlsLbClient, there is a need to call deliveryResolvedAddress() inside synch context, that eventually calls acceptResolvedAdddresses for the fallback policy wrapper.
1 parent 1a59ce3 commit 1fdfa0b

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

rls/src/test/java/io/grpc/rls/RlsLoadBalancerTest.java

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,13 @@ public void tearDown() {
201201

202202
@Test
203203
public void lb_serverStatusCodeConversion() throws Exception {
204-
deliverResolvedAddresses();
204+
helper.getSynchronizationContext().execute(() -> {
205+
try {
206+
deliverResolvedAddresses();
207+
} catch (Exception e) {
208+
throw new RuntimeException(e);
209+
}
210+
});
205211
InOrder inOrder = inOrder(helper);
206212
inOrder.verify(helper)
207213
.updateBalancingState(eq(ConnectivityState.CONNECTING), pickerCaptor.capture());
@@ -236,7 +242,13 @@ public void lb_serverStatusCodeConversion() throws Exception {
236242

237243
@Test
238244
public void lb_working_withDefaultTarget_rlsResponding() throws Exception {
239-
deliverResolvedAddresses();
245+
helper.getSynchronizationContext().execute(() -> {
246+
try {
247+
deliverResolvedAddresses();
248+
} catch (Exception e) {
249+
throw new RuntimeException(e);
250+
}
251+
});
240252
InOrder inOrder = inOrder(helper);
241253
inOrder.verify(helper)
242254
.updateBalancingState(eq(ConnectivityState.CONNECTING), pickerCaptor.capture());
@@ -393,7 +405,13 @@ public void lb_working_withoutDefaultTarget_noRlsResponse() throws Exception {
393405
public void lb_working_withDefaultTarget_noRlsResponse() throws Exception {
394406
fakeThrottler.nextResult = true;
395407

396-
deliverResolvedAddresses();
408+
helper.getSynchronizationContext().execute(() -> {
409+
try {
410+
deliverResolvedAddresses();
411+
} catch (Exception e) {
412+
throw new RuntimeException(e);
413+
}
414+
});
397415
InOrder inOrder = inOrder(helper);
398416
inOrder.verify(helper)
399417
.updateBalancingState(eq(ConnectivityState.CONNECTING), pickerCaptor.capture());
@@ -535,7 +553,13 @@ public void lb_working_withoutDefaultTarget() throws Exception {
535553

536554
@Test
537555
public void lb_nameResolutionFailed() throws Exception {
538-
deliverResolvedAddresses();
556+
helper.getSynchronizationContext().execute(() -> {
557+
try {
558+
deliverResolvedAddresses();
559+
} catch (Exception e) {
560+
throw new RuntimeException(e);
561+
}
562+
});
539563
InOrder inOrder = inOrder(helper);
540564
inOrder.verify(helper)
541565
.updateBalancingState(eq(ConnectivityState.CONNECTING), pickerCaptor.capture());

0 commit comments

Comments
 (0)