Skip to content

Commit 09ccfc0

Browse files
committed
dirty
Signed-off-by: wind57 <[email protected]>
1 parent 1f67050 commit 09ccfc0

File tree

4 files changed

+23
-30
lines changed

4 files changed

+23
-30
lines changed

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,10 @@
3535
/**
3636
* @author wind57
3737
*/
38-
@TestPropertySource(properties = {
39-
"spring.main.cloud-platform=kubernetes",
40-
"spring.cloud.kubernetes.client.namespace=default",
41-
"spring.cloud.kubernetes.discovery.metadata.add-pod-labels=true",
42-
"spring.cloud.kubernetes.discovery.metadata.add-pod-annotations=true" })
38+
@TestPropertySource(
39+
properties = { "spring.main.cloud-platform=kubernetes", "spring.cloud.kubernetes.client.namespace=default",
40+
"spring.cloud.kubernetes.discovery.metadata.add-pod-labels=true",
41+
"spring.cloud.kubernetes.discovery.metadata.add-pod-annotations=true" })
4342
@ExtendWith(OutputCaptureExtension.class)
4443
@SpringBootTest(classes = { Fabric8DiscoveryApp.class, Fabric8DiscoveryBase.TestConfig.class },
4544
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,11 @@
3535
/**
3636
* @author wind57
3737
*/
38-
@TestPropertySource(properties = {
39-
"spring.cloud.discovery.reactive.enabled=false",
40-
"spring.cloud.discovery.blocking.enabled=true",
41-
"logging.level.org.springframework.cloud.kubernetes.fabric8.discovery=debug",
42-
"logging.level.org.springframework.cloud.client.discovery.health=debug",
43-
"logging.level.org.springframework.cloud.kubernetes.commons.discovery=debug" })
38+
@TestPropertySource(
39+
properties = { "spring.cloud.discovery.reactive.enabled=false", "spring.cloud.discovery.blocking.enabled=true",
40+
"logging.level.org.springframework.cloud.kubernetes.fabric8.discovery=debug",
41+
"logging.level.org.springframework.cloud.client.discovery.health=debug",
42+
"logging.level.org.springframework.cloud.kubernetes.commons.discovery=debug" })
4443
class Fabric8DiscoveryBlockingIT extends Fabric8DiscoveryBase {
4544

4645
@LocalManagementPort

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

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,8 @@
2121
import org.junit.jupiter.api.Test;
2222

2323
import org.springframework.beans.factory.annotation.Autowired;
24-
import org.springframework.boot.test.context.SpringBootTest;
2524
import org.springframework.boot.test.system.CapturedOutput;
2625
import org.springframework.boot.test.web.server.LocalManagementPort;
27-
import org.springframework.cloud.client.discovery.DiscoveryClient;
2826
import org.springframework.cloud.client.discovery.ReactiveDiscoveryClient;
2927
import org.springframework.cloud.kubernetes.integration.tests.commons.Images;
3028
import org.springframework.cloud.kubernetes.integration.tests.commons.Phase;
@@ -37,13 +35,12 @@
3735
/**
3836
* @author wind57
3937
*/
40-
@TestPropertySource(properties = {
41-
"spring.cloud.discovery.reactive.enabled=true",
42-
"spring.cloud.discovery.blocking.enabled=false",
43-
"logging.level.org.springframework.cloud.kubernetes.commons.discovery=debug",
44-
"logging.level.org.springframework.cloud.client.discovery.health.reactive=debug",
45-
"logging.level.org.springframework.cloud.kubernetes.fabric8.discovery.reactive=debug",
46-
"logging.level.org.springframework.cloud.kubernetes.fabric8.discovery=debug" })
38+
@TestPropertySource(
39+
properties = { "spring.cloud.discovery.reactive.enabled=true", "spring.cloud.discovery.blocking.enabled=false",
40+
"logging.level.org.springframework.cloud.kubernetes.commons.discovery=debug",
41+
"logging.level.org.springframework.cloud.client.discovery.health.reactive=debug",
42+
"logging.level.org.springframework.cloud.kubernetes.fabric8.discovery.reactive=debug",
43+
"logging.level.org.springframework.cloud.kubernetes.fabric8.discovery=debug" })
4744
class Fabric8DiscoveryReactiveIT extends Fabric8DiscoveryBase {
4845

4946
@LocalManagementPort

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

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
import java.util.Map;
2323
import java.util.Objects;
2424

25+
import org.testcontainers.k3s.K3sContainer;
26+
2527
import org.springframework.boot.test.json.BasicJsonTester;
2628
import org.springframework.boot.test.system.CapturedOutput;
2729
import org.springframework.cloud.client.ServiceInstance;
@@ -30,7 +32,6 @@
3032
import org.springframework.cloud.kubernetes.commons.discovery.DefaultKubernetesServiceInstance;
3133
import org.springframework.http.HttpMethod;
3234
import org.springframework.web.reactive.function.client.WebClient;
33-
import org.testcontainers.k3s.K3sContainer;
3435

3536
import static java.util.AbstractMap.SimpleEntry;
3637
import static java.util.Map.Entry;
@@ -66,7 +67,8 @@ private TestAssertions() {
6667

6768
static void alterPods(K3sContainer container) {
6869
try {
69-
String[] busyboxPods = container.execInContainer("sh", "-c", "kubectl get pods -l app=busybox -o=name --no-headers")
70+
String[] busyboxPods = container
71+
.execInContainer("sh", "-c", "kubectl get pods -l app=busybox -o=name --no-headers")
7072
.getStdout()
7173
.split("\n");
7274

@@ -87,8 +89,7 @@ static void assertPodMetadata(DiscoveryClient discoveryClient) {
8789
}
8890

8991
static void assertPodMetadata(ReactiveDiscoveryClient discoveryClient) {
90-
List<ServiceInstance> serviceInstances = discoveryClient.getInstances("busybox-service")
91-
.collectList().block();
92+
List<ServiceInstance> serviceInstances = discoveryClient.getInstances("busybox-service").collectList().block();
9293
assertPodMetadata(serviceInstances);
9394
}
9495

@@ -132,14 +133,12 @@ static void assertBlockingConfiguration(CapturedOutput output, int port) {
132133
.retryWhen(retrySpec())
133134
.block();
134135

135-
assertThat(BASIC_JSON_TESTER.from(healthResult))
136-
.extractingJsonPathStringValue(DISCOVERY_COMPOSITE_STATUS)
136+
assertThat(BASIC_JSON_TESTER.from(healthResult)).extractingJsonPathStringValue(DISCOVERY_COMPOSITE_STATUS)
137137
.isEqualTo("UP");
138138

139139
assertThat(BASIC_JSON_TESTER.from(healthResult)).extractingJsonPathStringValue(BLOCKING_STATUS).isEqualTo("UP");
140140

141-
assertThat(BASIC_JSON_TESTER.from(healthResult))
142-
.extractingJsonPathArrayValue(BLOCKING_SERVICES)
141+
assertThat(BASIC_JSON_TESTER.from(healthResult)).extractingJsonPathArrayValue(BLOCKING_SERVICES)
143142
.containsExactlyInAnyOrder("kubernetes", "busybox-service");
144143

145144
assertThat(BASIC_JSON_TESTER.from(healthResult)).doesNotHaveJsonPath(REACTIVE_STATUS);
@@ -170,8 +169,7 @@ static void assertReactiveConfiguration(CapturedOutput output, int port) {
170169

171170
assertThat(BASIC_JSON_TESTER.from(healthResult)).extractingJsonPathStringValue(REACTIVE_STATUS).isEqualTo("UP");
172171

173-
assertThat(BASIC_JSON_TESTER.from(healthResult))
174-
.extractingJsonPathArrayValue(REACTIVE_SERVICES)
172+
assertThat(BASIC_JSON_TESTER.from(healthResult)).extractingJsonPathArrayValue(REACTIVE_SERVICES)
175173
.containsExactlyInAnyOrder("kubernetes", "busybox-service");
176174

177175
assertThat(BASIC_JSON_TESTER.from(healthResult)).doesNotHaveJsonPath(BLOCKING_STATUS);

0 commit comments

Comments
 (0)