Skip to content

Commit

Permalink
[ISSUE #12970] Fix NamingMetadataManager.removeInstanceMetadata() err…
Browse files Browse the repository at this point in the history
…or (#12971)

* [ISSUE #12970] Fix NamingMetadataManager.removeInstanceMetadata() error

fix #12970

* Update NamingMetadataManagerTest.java
  • Loading branch information
MajorHe1 authored Dec 18, 2024
1 parent 0556181 commit 762303b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public void removeInstanceMetadata(Service service, String metadataId) {
if (null != instanceMetadataMapForService) {
instanceMetadataMapForService.remove(metadataId);
if (instanceMetadataMapForService.isEmpty()) {
serviceMetadataMap.remove(service);
instanceMetadataMap.remove(service);
}
}
expiredMetadataInfos.remove(ExpiredMetadataInfo.newExpiredInstanceMetadata(service, metadataId));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@ void testRemoveInstanceMetadata() {
Optional<InstanceMetadata> instanceMetadata = namingMetadataManager.getInstanceMetadata(service, METADATA_ID);

assertFalse(instanceMetadata.isPresent());

Map<Service, ConcurrentMap<String, InstanceMetadata>> instanceMetadataSnapshot = namingMetadataManager.getInstanceMetadataSnapshot();

assertEquals(0, instanceMetadataSnapshot.size());
}

@Test
Expand Down Expand Up @@ -233,4 +237,4 @@ void testOnEvent() {
namingMetadataManager.onEvent(clientDisconnectEvent);
Mockito.verify(clientDisconnectEvent).getClient();
}
}
}

0 comments on commit 762303b

Please sign in to comment.