mirror of https://github.com/grpc/grpc-java.git
xds: Fix a bug locality reset not fully clean up
There is a bug in LocalityStore.reset() found during import.
This commit is contained in:
parent
e99672e03d
commit
842dfa49b1
|
|
@ -192,6 +192,7 @@ interface LocalityStore {
|
|||
for (XdsLocality locality : edsResponsLocalityInfo.keySet()) {
|
||||
loadStatsStore.removeLocality(locality);
|
||||
}
|
||||
edsResponsLocalityInfo = ImmutableMap.of();
|
||||
}
|
||||
|
||||
// This is triggered by EDS response.
|
||||
|
|
|
|||
|
|
@ -831,6 +831,15 @@ public class LocalityStoreTest {
|
|||
verify(loadBalancers.get("sz2")).shutdown();
|
||||
verify(loadStatsStore).removeLocality(locality1);
|
||||
verify(loadStatsStore).removeLocality(locality2);
|
||||
|
||||
// Regression test for same locality added back.
|
||||
localityStore.updateLocalityStore(localityInfoMap);
|
||||
assertThat(loadBalancers).hasSize(2);
|
||||
localityStore.reset();
|
||||
verify(loadBalancers.get("sz1")).shutdown();
|
||||
verify(loadBalancers.get("sz2")).shutdown();
|
||||
verify(loadStatsStore, times(2)).removeLocality(locality1);
|
||||
verify(loadStatsStore, times(2)).removeLocality(locality2);
|
||||
}
|
||||
|
||||
private static final class FakeLoadStatsStore implements LoadStatsStore {
|
||||
|
|
|
|||
Loading…
Reference in New Issue