Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,11 @@ void informerInjection() throws InterruptedException {
get(urlPathEqualTo("/api/v1/pods"))
.withPostServeAction("semaphore", getParams)
.withQueryParam("watch", equalTo("false"))
.atPriority(1)
.willReturn(
aResponse()
.withStatus(200)
.withHeader("Content-Type", "application/json")
.withBody(
JSON.serialize(
new V1PodList()
Expand All @@ -137,15 +139,22 @@ void informerInjection() throws InterruptedException {
get(urlPathEqualTo("/api/v1/pods"))
.withPostServeAction("semaphore", watchParams)
.withQueryParam("watch", equalTo("true"))
.willReturn(aResponse().withStatus(200).withBody("{}")));
.atPriority(2)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add .atPriority() to WireMock stubs to ensure proper matching order (priority 1 for watch=false, priority 2 for watch=true)

i like this idea!

.willReturn(
aResponse()
.withStatus(200)
.withHeader("Content-Type", "application/json")
.withBody("{}")));

apiServer.stubFor(
get(urlPathEqualTo("/api/v1/namespaces/default/configmaps"))
.withPostServeAction("semaphore", getParams)
.withQueryParam("watch", equalTo("false"))
.atPriority(1)
.willReturn(
aResponse()
.withStatus(200)
.withHeader("Content-Type", "application/json")
.withBody(
JSON.serialize(
new V1ConfigMapList()
Expand All @@ -155,7 +164,12 @@ void informerInjection() throws InterruptedException {
get(urlPathEqualTo("/api/v1/namespaces/default/configmaps"))
.withPostServeAction("semaphore", watchParams)
.withQueryParam("watch", equalTo("true"))
.willReturn(aResponse().withStatus(200).withBody("{}")));
.atPriority(2)
.willReturn(
aResponse()
.withStatus(200)
.withHeader("Content-Type", "application/json")
.withBody("{}")));

// These will be released for each web call above.
getCount.acquire(2);
Expand Down
Loading