diff --git a/spring-cloud-kubernetes-client-config/pom.xml b/spring-cloud-kubernetes-client-config/pom.xml
index 8e0f926015..a83fd6e827 100644
--- a/spring-cloud-kubernetes-client-config/pom.xml
+++ b/spring-cloud-kubernetes-client-config/pom.xml
@@ -83,8 +83,8 @@
- com.github.tomakehurst
- wiremock-jre8-standalone
+ org.wiremock
+ wiremock-standalone
test
diff --git a/spring-cloud-kubernetes-client-discovery/pom.xml b/spring-cloud-kubernetes-client-discovery/pom.xml
index 5e7952df0f..7152643894 100644
--- a/spring-cloud-kubernetes-client-discovery/pom.xml
+++ b/spring-cloud-kubernetes-client-discovery/pom.xml
@@ -66,8 +66,8 @@
test
- com.github.tomakehurst
- wiremock-jre8-standalone
+ org.wiremock
+ wiremock-standalone
test
diff --git a/spring-cloud-kubernetes-client-loadbalancer/pom.xml b/spring-cloud-kubernetes-client-loadbalancer/pom.xml
index 1c1bd42db3..2d407ed141 100644
--- a/spring-cloud-kubernetes-client-loadbalancer/pom.xml
+++ b/spring-cloud-kubernetes-client-loadbalancer/pom.xml
@@ -37,8 +37,8 @@
test
- com.github.tomakehurst
- wiremock-jre8-standalone
+ org.wiremock
+ wiremock-standalone
test
diff --git a/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configserver/pom.xml b/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configserver/pom.xml
index a9e93d679e..acd85edb83 100644
--- a/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configserver/pom.xml
+++ b/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configserver/pom.xml
@@ -43,8 +43,8 @@
test
- com.github.tomakehurst
- wiremock-jre8-standalone
+ org.wiremock
+ wiremock-standalone
test
diff --git a/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configserver/src/test/java/org/springframework/cloud/kubernetes/configserver/BootstrapConfigServerIntegrationTest.java b/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configserver/src/test/java/org/springframework/cloud/kubernetes/configserver/it/BootstrapConfigServerIntegrationTest.java
similarity index 78%
rename from spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configserver/src/test/java/org/springframework/cloud/kubernetes/configserver/BootstrapConfigServerIntegrationTest.java
rename to spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configserver/src/test/java/org/springframework/cloud/kubernetes/configserver/it/BootstrapConfigServerIntegrationTest.java
index f6e9d2b6f1..4892665cac 100644
--- a/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configserver/src/test/java/org/springframework/cloud/kubernetes/configserver/BootstrapConfigServerIntegrationTest.java
+++ b/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configserver/src/test/java/org/springframework/cloud/kubernetes/configserver/it/BootstrapConfigServerIntegrationTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2021 the original author or authors.
+ * Copyright 2013-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,9 +14,10 @@
* limitations under the License.
*/
-package org.springframework.cloud.kubernetes.configserver;
+package org.springframework.cloud.kubernetes.configserver.it;
import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.cloud.kubernetes.configserver.KubernetesConfigServerApplication;
/**
* @author Ryan Baxter
@@ -26,6 +27,6 @@
"spring.profiles.include=kubernetes", "spring.cloud.kubernetes.secrets.enableApi=true",
"spring.cloud.bootstrap.enabled=true" },
classes = { KubernetesConfigServerApplication.class })
-public class BootstrapConfigServerIntegrationTest extends ConfigServerIntegrationTest {
+class BootstrapConfigServerIntegrationTest extends ConfigServerIntegrationTest {
}
diff --git a/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configserver/src/test/java/org/springframework/cloud/kubernetes/configserver/ConfigDataConfigServerIntegrationTest.java b/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configserver/src/test/java/org/springframework/cloud/kubernetes/configserver/it/ConfigDataConfigServerIntegrationTest.java
similarity index 65%
rename from spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configserver/src/test/java/org/springframework/cloud/kubernetes/configserver/ConfigDataConfigServerIntegrationTest.java
rename to spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configserver/src/test/java/org/springframework/cloud/kubernetes/configserver/it/ConfigDataConfigServerIntegrationTest.java
index 2088dfee31..98847decc2 100644
--- a/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configserver/src/test/java/org/springframework/cloud/kubernetes/configserver/ConfigDataConfigServerIntegrationTest.java
+++ b/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configserver/src/test/java/org/springframework/cloud/kubernetes/configserver/it/ConfigDataConfigServerIntegrationTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2021 the original author or authors.
+ * Copyright 2013-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,20 +14,19 @@
* limitations under the License.
*/
-package org.springframework.cloud.kubernetes.configserver;
+package org.springframework.cloud.kubernetes.configserver.it;
-import com.github.tomakehurst.wiremock.WireMockServer;
import com.github.tomakehurst.wiremock.client.WireMock;
import io.kubernetes.client.util.ClientBuilder;
-import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
import org.mockito.MockedStatic;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cloud.kubernetes.client.KubernetesClientUtils;
+import org.springframework.cloud.kubernetes.configserver.KubernetesConfigServerApplication;
+import org.springframework.cloud.kubernetes.configserver.TestBootstrapConfig;
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
import static org.mockito.Mockito.mockStatic;
/**
@@ -36,27 +35,20 @@
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
properties = { "spring.main.cloud-platform=KUBERNETES", "spring.cloud.kubernetes.client.namespace=default",
"spring.profiles.include=kubernetes", "spring.cloud.kubernetes.secrets.enableApi=true" },
- classes = { KubernetesConfigServerApplication.class })
-public class ConfigDataConfigServerIntegrationTest extends ConfigServerIntegrationTest {
+ classes = { KubernetesConfigServerApplication.class, TestBootstrapConfig.class })
+class ConfigDataConfigServerIntegrationTest extends ConfigServerIntegrationTest {
- private static WireMockServer wireMockServer;
-
- private static MockedStatic clientUtilsMock;
-
- @BeforeAll
- static void setup() {
- wireMockServer = new WireMockServer(options().dynamicPort());
- wireMockServer.start();
- WireMock.configureFor(wireMockServer.port());
+ private MockedStatic clientUtilsMock;
+ @BeforeEach
+ void setup() {
clientUtilsMock = mockStatic(KubernetesClientUtils.class);
clientUtilsMock.when(KubernetesClientUtils::kubernetesApiClient)
.thenReturn(new ClientBuilder().setBasePath(wireMockServer.baseUrl()).build());
}
- @AfterAll
- static void teardown() {
- wireMockServer.stop();
+ @AfterEach
+ void teardown() {
clientUtilsMock.close();
}
diff --git a/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configserver/src/test/java/org/springframework/cloud/kubernetes/configserver/ConfigServerIntegrationTest.java b/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configserver/src/test/java/org/springframework/cloud/kubernetes/configserver/it/ConfigServerIntegrationTest.java
similarity index 93%
rename from spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configserver/src/test/java/org/springframework/cloud/kubernetes/configserver/ConfigServerIntegrationTest.java
rename to spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configserver/src/test/java/org/springframework/cloud/kubernetes/configserver/it/ConfigServerIntegrationTest.java
index 141af25611..c88ecfa9da 100644
--- a/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configserver/src/test/java/org/springframework/cloud/kubernetes/configserver/ConfigServerIntegrationTest.java
+++ b/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configserver/src/test/java/org/springframework/cloud/kubernetes/configserver/it/ConfigServerIntegrationTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2021 the original author or authors.
+ * Copyright 2013-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,8 +14,9 @@
* limitations under the License.
*/
-package org.springframework.cloud.kubernetes.configserver;
+package org.springframework.cloud.kubernetes.configserver.it;
+import com.github.tomakehurst.wiremock.WireMockServer;
import com.github.tomakehurst.wiremock.client.WireMock;
import io.kubernetes.client.openapi.JSON;
import io.kubernetes.client.openapi.models.V1ConfigMapBuilder;
@@ -45,8 +46,11 @@ abstract class ConfigServerIntegrationTest {
@Autowired
private TestRestTemplate testRestTemplate;
+ @Autowired
+ WireMockServer wireMockServer;
+
@BeforeEach
- public void beforeEach() {
+ void beforeEach() {
V1ConfigMapList TEST_CONFIGMAP = new V1ConfigMapList().addItemsItem(new V1ConfigMapBuilder().withMetadata(
new V1ObjectMetaBuilder().withName("test-cm").withNamespace("default").withResourceVersion("1").build())
.addToData("app.name", "test").build());
@@ -67,7 +71,7 @@ public void beforeEach() {
}
@Test
- public void enabled() {
+ void enabled() {
Environment env = testRestTemplate.getForObject("/test-cm/default", Environment.class);
assertThat(env.getPropertySources().size()).isEqualTo(2);
assertThat(env.getPropertySources().get(0).getName().equals("configmap.test-cm.default")).isTrue();
diff --git a/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configuration-watcher/pom.xml b/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configuration-watcher/pom.xml
index 6c104fb147..1a6c091cb7 100644
--- a/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configuration-watcher/pom.xml
+++ b/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configuration-watcher/pom.xml
@@ -51,8 +51,8 @@
- com.github.tomakehurst
- wiremock-jre8-standalone
+ org.wiremock
+ wiremock-standalone
test
diff --git a/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-discoveryserver/pom.xml b/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-discoveryserver/pom.xml
index 83cc2eeca4..4085fd087d 100644
--- a/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-discoveryserver/pom.xml
+++ b/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-discoveryserver/pom.xml
@@ -40,8 +40,8 @@
test
- com.github.tomakehurst
- wiremock-jre8-standalone
+ org.wiremock
+ wiremock-standalone
test
diff --git a/spring-cloud-kubernetes-dependencies/pom.xml b/spring-cloud-kubernetes-dependencies/pom.xml
index f52c99133b..d43cee2f84 100644
--- a/spring-cloud-kubernetes-dependencies/pom.xml
+++ b/spring-cloud-kubernetes-dependencies/pom.xml
@@ -35,7 +35,7 @@
0.13.0
6.9.2
19.0.0
- 2.26.3
+ 3.4.2
4.4
@@ -213,8 +213,8 @@
- com.github.tomakehurst
- wiremock-jre8-standalone
+ org.wiremock
+ wiremock-standalone
${wiremock.version}
test
diff --git a/spring-cloud-kubernetes-discovery/pom.xml b/spring-cloud-kubernetes-discovery/pom.xml
index 10ae3e6208..4627f29ee6 100644
--- a/spring-cloud-kubernetes-discovery/pom.xml
+++ b/spring-cloud-kubernetes-discovery/pom.xml
@@ -51,8 +51,8 @@
test
- com.github.tomakehurst
- wiremock-jre8-standalone
+ org.wiremock
+ wiremock-standalone
test
diff --git a/spring-cloud-kubernetes-fabric8-discovery/pom.xml b/spring-cloud-kubernetes-fabric8-discovery/pom.xml
index 0ed2f61626..863a8a5e3b 100644
--- a/spring-cloud-kubernetes-fabric8-discovery/pom.xml
+++ b/spring-cloud-kubernetes-fabric8-discovery/pom.xml
@@ -106,8 +106,8 @@
test
- com.github.tomakehurst
- wiremock-jre8-standalone
+ org.wiremock
+ wiremock-standalone
test
diff --git a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-k8s-client-configuration-watcher/pom.xml b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-k8s-client-configuration-watcher/pom.xml
index 451cdc46b9..1f235b31df 100644
--- a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-k8s-client-configuration-watcher/pom.xml
+++ b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-k8s-client-configuration-watcher/pom.xml
@@ -13,7 +13,7 @@
jar
- 2.26.3
+ 3.4.2
@@ -38,8 +38,8 @@
spring-boot-starter-test
- com.github.tomakehurst
- wiremock-jre8-standalone
+ org.wiremock
+ wiremock-standalone
${wiremock.version}
test
diff --git a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-k8s-client-configuration-watcher/src/test/java/org/springframework/cloud/kubernetes/configuration/watcher/ActuatorRefreshIT.java b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-k8s-client-configuration-watcher/src/test/java/org/springframework/cloud/kubernetes/configuration/watcher/ActuatorRefreshIT.java
index 5eea8aa0a7..38f0e15d12 100644
--- a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-k8s-client-configuration-watcher/src/test/java/org/springframework/cloud/kubernetes/configuration/watcher/ActuatorRefreshIT.java
+++ b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-k8s-client-configuration-watcher/src/test/java/org/springframework/cloud/kubernetes/configuration/watcher/ActuatorRefreshIT.java
@@ -16,7 +16,7 @@
package org.springframework.cloud.kubernetes.configuration.watcher;
-import java.net.SocketException;
+import java.net.SocketTimeoutException;
import java.time.Duration;
import com.github.tomakehurst.wiremock.client.WireMock;
@@ -100,8 +100,8 @@ void after() {
@Test
void testActuatorRefresh() {
- WireMock.configureFor(WIREMOCK_HOST, WIREMOCK_PORT, WIREMOCK_PATH);
- await().timeout(Duration.ofSeconds(60)).ignoreException(SocketException.class)
+ WireMock.configureFor(WIREMOCK_HOST, WIREMOCK_PORT);
+ await().timeout(Duration.ofSeconds(60)).ignoreException(SocketTimeoutException.class)
.until(() -> WireMock
.stubFor(WireMock.post(WireMock.urlEqualTo("/actuator/refresh"))
.willReturn(WireMock.aResponse().withBody("{}").withStatus(200)))
@@ -128,7 +128,7 @@ void testActuatorRefreshReloadDisabled() {
TestUtil.patchForDisabledReload(SPRING_CLOUD_K8S_CONFIG_WATCHER_APP_NAME, NAMESPACE, DOCKER_IMAGE);
- WireMock.configureFor(WIREMOCK_HOST, WIREMOCK_PORT, WIREMOCK_PATH);
+ WireMock.configureFor(WIREMOCK_HOST, WIREMOCK_PORT);
await().timeout(Duration.ofSeconds(60))
.until(() -> WireMock
.stubFor(WireMock.post(WireMock.urlEqualTo("/actuator/refresh"))
diff --git a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-k8s-client-configuration-watcher/src/test/java/org/springframework/cloud/kubernetes/configuration/watcher/ActuatorRefreshMultipleNamespacesIT.java b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-k8s-client-configuration-watcher/src/test/java/org/springframework/cloud/kubernetes/configuration/watcher/ActuatorRefreshMultipleNamespacesIT.java
index c8ae889a26..08e1e6793d 100644
--- a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-k8s-client-configuration-watcher/src/test/java/org/springframework/cloud/kubernetes/configuration/watcher/ActuatorRefreshMultipleNamespacesIT.java
+++ b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-k8s-client-configuration-watcher/src/test/java/org/springframework/cloud/kubernetes/configuration/watcher/ActuatorRefreshMultipleNamespacesIT.java
@@ -16,7 +16,7 @@
package org.springframework.cloud.kubernetes.configuration.watcher;
-import java.net.SocketException;
+import java.net.SocketTimeoutException;
import java.nio.charset.StandardCharsets;
import java.time.Duration;
import java.util.Base64;
@@ -99,7 +99,7 @@ static void afterAll() throws Exception {
*/
@Test
void testConfigMapActuatorRefreshMultipleNamespaces() {
- WireMock.configureFor(WIREMOCK_HOST, WIREMOCK_PORT, WIREMOCK_PATH);
+ WireMock.configureFor(WIREMOCK_HOST, WIREMOCK_PORT);
await().timeout(Duration.ofSeconds(60))
.until(() -> WireMock
.stubFor(WireMock.post(WireMock.urlEqualTo("/actuator/refresh"))
@@ -145,7 +145,7 @@ void testConfigMapActuatorRefreshMultipleNamespaces() {
*
*/
void testSecretActuatorRefreshMultipleNamespaces() {
- await().timeout(Duration.ofSeconds(60)).ignoreException(SocketException.class)
+ await().timeout(Duration.ofSeconds(60)).ignoreException(SocketTimeoutException.class)
.until(() -> WireMock
.stubFor(WireMock.post(WireMock.urlEqualTo("/actuator/refresh"))
.willReturn(WireMock.aResponse().withBody("{}").withStatus(200)))
diff --git a/spring-cloud-kubernetes-test-support/src/main/resources/wiremock/wiremock-deployment.yaml b/spring-cloud-kubernetes-test-support/src/main/resources/wiremock/wiremock-deployment.yaml
index 90e096cf80..b429648107 100644
--- a/spring-cloud-kubernetes-test-support/src/main/resources/wiremock/wiremock-deployment.yaml
+++ b/spring-cloud-kubernetes-test-support/src/main/resources/wiremock/wiremock-deployment.yaml
@@ -13,7 +13,7 @@ spec:
spec:
containers:
- name: service-wiremock
- image: wiremock/wiremock:2.35.0
+ image: wiremock/wiremock:3.4.2
args: ["--verbose"]
imagePullPolicy: IfNotPresent
readinessProbe: