This commit is contained in:
erabii
2023-03-14 01:32:23 +02:00
committed by GitHub
parent bbc6a2b811
commit f320f56b1f
2 changed files with 3 additions and 5 deletions

View File

@@ -162,13 +162,13 @@ public class KubernetesDiscoveryClient implements DiscoveryClient, EnvironmentAw
@Override
public List<String> getServices() {
return adapter.apply(client).stream().map(s -> s.getMetadata().getName()).toList();
return adapter.apply(client).stream().map(s -> s.getMetadata().getName()).distinct().toList();
}
@Deprecated(forRemoval = true)
public List<String> getServices(Predicate<Service> filter) {
return new Fabric8DiscoveryServicesAdapter(kubernetesClientServicesFunction, properties, filter).apply(client)
.stream().map(s -> s.getMetadata().getName()).toList();
.stream().map(s -> s.getMetadata().getName()).distinct().toList();
}
@Override

View File

@@ -497,10 +497,8 @@ class KubernetesDiscoveryClientTests {
KubernetesDiscoveryClient discoveryClient = new KubernetesDiscoveryClient(client, properties, null, null, null);
List<String> result = discoveryClient.getServices();
Assertions.assertEquals(result.size(), 2);
// this looks weird at the moment, but there is an issue that will fix this
Assertions.assertEquals(result.size(), 1);
Assertions.assertEquals(result.get(0), "blue-service");
Assertions.assertEquals(result.get(1), "blue-service");
}
@Test