Skip to content

Commit 566dfd6

Browse files
committed
dirty
1 parent b87b82b commit 566dfd6

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-discovery/src/main/java/org/springframework/cloud/kubernetes/fabric8/client/discovery/Fabric8DiscoveryController.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ List<Endpoints> getEndPointsList(@PathVariable("serviceId") String serviceId) {
5353

5454
@GetMapping("/service-instances/{serviceId}")
5555
List<ServiceInstance> serviceInstances(@PathVariable("serviceId") String serviceId) {
56-
discoveryClient.getServices();
5756
return discoveryClient.getInstances(serviceId);
5857
}
5958

spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-discovery/src/test/java/org/springframework/cloud/kubernetes/fabric8/client/discovery/it/Fabric8DiscoveryPodMetadataIT.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,21 +67,20 @@ void afterEach() {
6767
* <pre>
6868
* - there is a 'busybox-service' service deployed with two pods
6969
* - find each of the pod, add annotation to one and labels to another
70-
* - call
70+
* - call DiscoveryClient::getInstances with this serviceId and assert fields returned
7171
* </pre>
7272
*/
7373
@Test
7474
void test() throws Exception {
75-
// find both pods
76-
String[] both = K3S.execInContainer("sh", "-c", "kubectl get pods -l app=busybox -o=name --no-headers")
75+
String[] busyboxPods = K3S.execInContainer("sh", "-c", "kubectl get pods -l app=busybox -o=name --no-headers")
7776
.getStdout()
7877
.split("\n");
79-
// add a label to first pod
80-
K3S.execInContainer("sh", "-c",
81-
"kubectl label pods " + both[0].split("/")[1] + " custom-label=custom-label-value");
82-
// add annotation to the second pod
83-
K3S.execInContainer("sh", "-c",
84-
"kubectl annotate pods " + both[1].split("/")[1] + " custom-annotation=custom-annotation-value");
78+
79+
String podOne = busyboxPods[0].split("/")[1];
80+
String podTwo = busyboxPods[1].split("/")[1];
81+
82+
K3S.execInContainer("sh", "-c", "kubectl label pods " + podOne + " my-label=my-value");
83+
K3S.execInContainer("sh", "-c", "kubectl annotate pods " + podTwo + " my-annotation=my-value");
8584
}
8685

8786
@TestConfiguration

spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-discovery/src/test/java/org/springframework/cloud/kubernetes/fabric8/client/discovery/it/TestAssertions.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import java.time.Duration;
2020
import java.util.Objects;
2121

22+
import org.springframework.cloud.client.discovery.DiscoveryClient;
2223
import reactor.netty.http.client.HttpClient;
2324
import reactor.util.retry.Retry;
2425
import reactor.util.retry.RetryBackoffSpec;
@@ -31,6 +32,10 @@
3132
*/
3233
class TestAssertions {
3334

35+
static void assertPodMetadata(DiscoveryClient discoveryClient) {
36+
37+
}
38+
3439
static WebClient.Builder builder() {
3540
return WebClient.builder().clientConnector(new ReactorClientHttpConnector(HttpClient.create()));
3641
}

0 commit comments

Comments
 (0)