Skip to content

Commit 8756a8b

Browse files
authored
Remove one integration test 2 (13) (#1434)
1 parent 0df84dc commit 8756a8b

File tree

12 files changed

+62
-375
lines changed

12 files changed

+62
-375
lines changed

spring-cloud-kubernetes-integration-tests/pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@
5858
<module>spring-cloud-kubernetes-discoveryclient-it</module>
5959
<module>spring-cloud-kubernetes-client-loadbalancer-it</module>
6060
<module>spring-cloud-kubernetes-configuration-watcher-it</module>
61-
<module>spring-cloud-kubernetes-core-k8s-client-it</module>
6261
<module>spring-cloud-kubernetes-client-event-and-polling-reload</module>
6362
<module>spring-cloud-kubernetes-client-configmap-event-reload-multiple-apps</module>
6463
<module>spring-cloud-kubernetes-client-secrets-event-reload-multiple-apps</module>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ void filterMatchesBothNamespacesViaThePredicate() {
308308
// patch the deployment to change what namespaces are take into account
309309
KubernetesClientDiscoveryClientUtils.patchForTwoNamespacesMatchViaThePredicate(DEPLOYMENT_NAME, NAMESPACE);
310310

311-
new KubernetesClientDiscoveryFilterITDelegate().filterMatchesBothNamespacesViaThePredicate(util);
311+
new KubernetesClientDiscoveryFilterITDelegate().filterMatchesBothNamespacesViaThePredicate();
312312
}
313313

314314
@Test
@@ -339,7 +339,7 @@ void testDefaultConfiguration() {
339339

340340
KubernetesClientDiscoveryClientUtils.patchForBlockingAndReactiveHealth(DEPLOYMENT_NAME, NAMESPACE);
341341

342-
new KubernetesClientDiscoveryHealthITDelegate().testDefaultConfiguration(util, K3S);
342+
new KubernetesClientDiscoveryHealthITDelegate().testDefaultConfiguration(K3S);
343343
}
344344

345345
private void deleteNamespacesAndWiremock() {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ void filterMatchesOneNamespaceViaThePredicate(Util util) {
9595
* As such, both services are found via 'getInstances' call.
9696
* </pre>
9797
*/
98-
void filterMatchesBothNamespacesViaThePredicate(Util util) {
98+
void filterMatchesBothNamespacesViaThePredicate() {
9999

100100
// patch the deployment to change what namespaces are take into account
101101
KubernetesClientDiscoveryClientUtils.patchForTwoNamespacesMatchViaThePredicate(DEPLOYMENT_NAME, NAMESPACE);

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

Lines changed: 59 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import reactor.util.retry.RetryBackoffSpec;
3030

3131
import org.springframework.boot.test.json.BasicJsonTester;
32-
import org.springframework.cloud.kubernetes.integration.tests.commons.native_client.Util;
3332
import org.springframework.core.ParameterizedTypeReference;
3433
import org.springframework.http.HttpMethod;
3534
import org.springframework.http.client.reactive.ReactorClientHttpConnector;
@@ -142,7 +141,7 @@ void testReactiveConfiguration(K3sContainer container) {
142141
/**
143142
* Both blocking and reactive are enabled.
144143
*/
145-
void testDefaultConfiguration(Util util, K3sContainer container) {
144+
void testDefaultConfiguration(K3sContainer container) {
146145

147146
KubernetesClientDiscoveryClientUtils.patchForBlockingAndReactiveHealth(DEPLOYMENT_NAME, NAMESPACE);
148147

@@ -153,9 +152,12 @@ void testDefaultConfiguration(Util util, K3sContainer container) {
153152
"received InstanceRegisteredEvent from pod with 'app' label value : spring-cloud-kubernetes-client-discovery-it");
154153

155154
WebClient healthClient = builder().baseUrl("http://localhost/actuator/health").build();
155+
WebClient infoClient = builder().baseUrl("http://localhost/actuator/info").build();
156156

157157
String healthResult = healthClient.method(HttpMethod.GET).retrieve().bodyToMono(String.class)
158158
.retryWhen(retrySpec()).block();
159+
String infoResult = infoClient.method(HttpMethod.GET).retrieve().bodyToMono(String.class)
160+
.retryWhen(retrySpec()).block();
159161

160162
Assertions.assertThat(BASIC_JSON_TESTER.from(healthResult))
161163
.extractingJsonPathStringValue("$.components.discoveryComposite.status").isEqualTo("UP");
@@ -180,6 +182,61 @@ void testDefaultConfiguration(Util util, K3sContainer container) {
180182
"$.components.reactiveDiscoveryClients.components.['Kubernetes Reactive Discovery Client'].details.services")
181183
.containsExactlyInAnyOrder("spring-cloud-kubernetes-client-discovery-it", "kubernetes");
182184

185+
// assert health/info also
186+
assertHealth(healthResult);
187+
assertInfo(infoResult);
188+
}
189+
190+
private void assertHealth(String healthResult) {
191+
Assertions.assertThat(BASIC_JSON_TESTER.from(healthResult)).extractingJsonPathStringValue(
192+
"$.components.kubernetes.status").isEqualTo("UP");
193+
194+
Assertions.assertThat(BASIC_JSON_TESTER.from(healthResult)).extractingJsonPathStringValue(
195+
"$.components.kubernetes.details.hostIp").isNotEmpty();
196+
197+
Assertions.assertThat(BASIC_JSON_TESTER.from(healthResult)).extractingJsonPathBooleanValue(
198+
"$.components.kubernetes.details.inside").isEqualTo(true);
199+
200+
Assertions.assertThat(BASIC_JSON_TESTER.from(healthResult)).extractingJsonPathStringValue(
201+
"$.components.kubernetes.details.labels.app").isEqualTo("spring-cloud-kubernetes-client-discovery-it");
202+
203+
Assertions.assertThat(BASIC_JSON_TESTER.from(healthResult)).extractingJsonPathStringValue(
204+
"$.components.kubernetes.details.namespace").isNotEmpty();
205+
206+
Assertions.assertThat(BASIC_JSON_TESTER.from(healthResult)).extractingJsonPathStringValue(
207+
"$.components.kubernetes.details.nodeName").isNotEmpty();
208+
209+
Assertions.assertThat(BASIC_JSON_TESTER.from(healthResult)).extractingJsonPathStringValue(
210+
"$.components.kubernetes.details.podIp").isNotEmpty();
211+
212+
Assertions.assertThat(BASIC_JSON_TESTER.from(healthResult)).extractingJsonPathStringValue(
213+
"$.components.kubernetes.details.podName").isNotEmpty();
214+
215+
Assertions.assertThat(BASIC_JSON_TESTER.from(healthResult)).extractingJsonPathStringValue(
216+
"$.components.kubernetes.details.serviceAccount").isNotEmpty();
217+
}
218+
219+
private void assertInfo(String infoResult) {
220+
Assertions.assertThat(BASIC_JSON_TESTER.from(infoResult)).extractingJsonPathStringValue(
221+
"$.kubernetes.hostIp").isNotEmpty();
222+
223+
Assertions.assertThat(BASIC_JSON_TESTER.from(infoResult)).extractingJsonPathBooleanValue(
224+
"$.kubernetes.inside").isEqualTo(true);
225+
226+
Assertions.assertThat(BASIC_JSON_TESTER.from(infoResult)).extractingJsonPathStringValue(
227+
"$.kubernetes.namespace").isNotEmpty();
228+
229+
Assertions.assertThat(BASIC_JSON_TESTER.from(infoResult)).extractingJsonPathStringValue(
230+
"$.kubernetes.nodeName").isNotEmpty();
231+
232+
Assertions.assertThat(BASIC_JSON_TESTER.from(infoResult)).extractingJsonPathStringValue(
233+
"$.kubernetes.podIp").isNotEmpty();
234+
235+
Assertions.assertThat(BASIC_JSON_TESTER.from(infoResult)).extractingJsonPathStringValue(
236+
"$.kubernetes.podName").isNotEmpty();
237+
238+
Assertions.assertThat(BASIC_JSON_TESTER.from(infoResult)).extractingJsonPathStringValue(
239+
"$.kubernetes.serviceAccount").isNotEmpty();
183240
}
184241

185242
private WebClient.Builder builder() {

spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-core-k8s-client-it/pom.xml

Lines changed: 0 additions & 105 deletions
This file was deleted.

spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-core-k8s-client-it/src/main/java/org/springframework/cloud/kubernetes/core/k8s/it/CoreK8SApplicationIt.java

Lines changed: 0 additions & 32 deletions
This file was deleted.

spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-core-k8s-client-it/src/main/resources/application.yaml

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)