Upgrade org.wiremock dependency (#1599)

This commit is contained in:
erabii
2024-03-14 22:31:35 +02:00
committed by GitHub
parent fa07ce68d5
commit 19fa6ab6d6
16 changed files with 54 additions and 57 deletions

View File

@@ -83,8 +83,8 @@
</dependency>
<dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock-jre8-standalone</artifactId>
<groupId>org.wiremock</groupId>
<artifactId>wiremock-standalone</artifactId>
<scope>test</scope>
</dependency>

View File

@@ -66,8 +66,8 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock-jre8-standalone</artifactId>
<groupId>org.wiremock</groupId>
<artifactId>wiremock-standalone</artifactId>
<scope>test</scope>
</dependency>
<dependency>

View File

@@ -37,8 +37,8 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock-jre8-standalone</artifactId>
<groupId>org.wiremock</groupId>
<artifactId>wiremock-standalone</artifactId>
<scope>test</scope>
</dependency>
<dependency>

View File

@@ -43,8 +43,8 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock-jre8-standalone</artifactId>
<groupId>org.wiremock</groupId>
<artifactId>wiremock-standalone</artifactId>
<scope>test</scope>
</dependency>
<dependency>

View File

@@ -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 @@ import org.springframework.boot.test.context.SpringBootTest;
"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 {
}

View File

@@ -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 @@ import static org.mockito.Mockito.mockStatic;
@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<KubernetesClientUtils> clientUtilsMock;
@BeforeAll
static void setup() {
wireMockServer = new WireMockServer(options().dynamicPort());
wireMockServer.start();
WireMock.configureFor(wireMockServer.port());
private MockedStatic<KubernetesClientUtils> 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();
}

View File

@@ -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 @@ abstract class ConfigServerIntegrationTest {
}
@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();

View File

@@ -51,8 +51,8 @@
</exclusions>
</dependency>
<dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock-jre8-standalone</artifactId>
<groupId>org.wiremock</groupId>
<artifactId>wiremock-standalone</artifactId>
<scope>test</scope>
</dependency>

View File

@@ -40,8 +40,8 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock-jre8-standalone</artifactId>
<groupId>org.wiremock</groupId>
<artifactId>wiremock-standalone</artifactId>
<scope>test</scope>
</dependency>
<dependency>

View File

@@ -35,7 +35,7 @@
<hoverfly.version>0.13.0</hoverfly.version>
<kubernetes-fabric8-client.version>6.9.2</kubernetes-fabric8-client.version>
<kubernetes-native-client.version>19.0.0</kubernetes-native-client.version>
<wiremock.version>2.26.3</wiremock.version>
<wiremock.version>3.4.2</wiremock.version>
<commons.collections4.version>4.4</commons.collections4.version>
</properties>
<dependencyManagement>
@@ -213,8 +213,8 @@
</dependency>
<dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock-jre8-standalone</artifactId>
<groupId>org.wiremock</groupId>
<artifactId>wiremock-standalone</artifactId>
<version>${wiremock.version}</version>
<scope>test</scope>
</dependency>

View File

@@ -51,8 +51,8 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock-jre8-standalone</artifactId>
<groupId>org.wiremock</groupId>
<artifactId>wiremock-standalone</artifactId>
<scope>test</scope>
</dependency>
<dependency>

View File

@@ -106,8 +106,8 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock-jre8-standalone</artifactId>
<groupId>org.wiremock</groupId>
<artifactId>wiremock-standalone</artifactId>
<scope>test</scope>
</dependency>
<dependency>

View File

@@ -13,7 +13,7 @@
<packaging>jar</packaging>
<properties>
<wiremock.version>2.26.3</wiremock.version>
<wiremock.version>3.4.2</wiremock.version>
</properties>
<dependencies>
@@ -38,8 +38,8 @@
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
<dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock-jre8-standalone</artifactId>
<groupId>org.wiremock</groupId>
<artifactId>wiremock-standalone</artifactId>
<version>${wiremock.version}</version>
<scope>test</scope>
</dependency>

View File

@@ -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 @@ class ActuatorRefreshIT {
@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 @@ class ActuatorRefreshIT {
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"))

View File

@@ -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 @@ class ActuatorRefreshMultipleNamespacesIT {
*/
@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 @@ class ActuatorRefreshMultipleNamespacesIT {
* </pre>
*/
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)))

View File

@@ -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: