Skip to content

Commit c45a0d1

Browse files
committed
resetting wiremock rule to resolve flakiness
1 parent 69eb334 commit c45a0d1

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

spring/src/test/java/io/kubernetes/client/spring/extended/controller/KubernetesInformerCreatorTest.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
import static com.github.tomakehurst.wiremock.client.WireMock.equalTo;
55
import static com.github.tomakehurst.wiremock.client.WireMock.get;
66
import static com.github.tomakehurst.wiremock.client.WireMock.getRequestedFor;
7-
import static com.github.tomakehurst.wiremock.client.WireMock.moreThan;
8-
import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
97
import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
108
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
119
import static com.github.tomakehurst.wiremock.client.WireMock.verify;
@@ -104,7 +102,7 @@ public void testInformerInjection() throws InterruptedException {
104102
.kind("ConfigMap")
105103
.metadata(new V1ObjectMeta().namespace("default").name("bar1"));
106104

107-
stubFor(
105+
wireMockRule.stubFor(
108106
get(urlMatching("^/api/v1/pods.*"))
109107
.withQueryParam("watch", equalTo("false"))
110108
.willReturn(
@@ -116,12 +114,12 @@ public void testInformerInjection() throws InterruptedException {
116114
new V1PodList()
117115
.metadata(new V1ListMeta().resourceVersion("0"))
118116
.items(Arrays.asList(foo1))))));
119-
stubFor(
117+
wireMockRule.stubFor(
120118
get(urlMatching("^/api/v1/pods.*"))
121119
.withQueryParam("watch", equalTo("true"))
122120
.willReturn(aResponse().withStatus(200).withBody("{}")));
123121

124-
stubFor(
122+
wireMockRule.stubFor(
125123
get(urlMatching("^/api/v1/configmaps.*"))
126124
.withQueryParam("watch", equalTo("false"))
127125
.willReturn(
@@ -133,7 +131,7 @@ public void testInformerInjection() throws InterruptedException {
133131
new V1ConfigMapList()
134132
.metadata(new V1ListMeta().resourceVersion("0"))
135133
.items(Arrays.asList(bar1))))));
136-
stubFor(
134+
wireMockRule.stubFor(
137135
get(urlMatching("^/api/v1/configmaps.*"))
138136
.withQueryParam("watch", equalTo("true"))
139137
.willReturn(aResponse().withStatus(200).withBody("{}")));
@@ -146,14 +144,12 @@ public void testInformerInjection() throws InterruptedException {
146144
1,
147145
getRequestedFor(urlPathEqualTo("/api/v1/pods")).withQueryParam("watch", equalTo("false")));
148146
verify(
149-
moreThan(0),
150147
getRequestedFor(urlPathEqualTo("/api/v1/pods")).withQueryParam("watch", equalTo("true")));
151148
verify(
152149
1,
153150
getRequestedFor(urlPathEqualTo("/api/v1/configmaps"))
154151
.withQueryParam("watch", equalTo("false")));
155152
verify(
156-
moreThan(0),
157153
getRequestedFor(urlPathEqualTo("/api/v1/configmaps"))
158154
.withQueryParam("watch", equalTo("true")));
159155

0 commit comments

Comments
 (0)