Skip to content

Commit 28a1f51

Browse files
committed
Fix test.
1 parent 233b415 commit 28a1f51

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ public void uncaughtException(Thread t, Throwable e) {
169169
private CachingRlsLbClient rlsLbClient;
170170
private Map<String, ?> rlsChannelServiceConfig;
171171
private String rlsChannelOverriddenAuthority;
172+
private boolean isAlreadyClosed = false;
172173

173174
private void setUpRlsLbClient() {
174175
fakeThrottler.resetCounts();
@@ -191,7 +192,9 @@ public void setUpMockMetricRecorder() {
191192

192193
@After
193194
public void tearDown() throws Exception {
194-
rlsLbClient.close();
195+
if (!isAlreadyClosed) {
196+
rlsLbClient.close();
197+
}
195198
assertWithMessage(
196199
"On client shut down, RlsLoadBalancer must shut down with all its child loadbalancers.")
197200
.that(lbProvider.loadBalancers).isEmpty();
@@ -702,6 +705,7 @@ public void metricGauges() throws ExecutionException, InterruptedException, Time
702705
// Shutdown
703706
rlsLbClient.close();
704707
verify(mockGaugeRegistration).close();
708+
isAlreadyClosed = true;
705709
}
706710

707711
private static RouteLookupConfig getRouteLookupConfig() {

0 commit comments

Comments
 (0)