Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 17, 2025

WireMock test stubs were using urlEqualTo (full URL + query params) when urlPathEqualTo (path only) was appropriate. This matters when URLs don't contain query parameters but tests need to allow them to be added dynamically.

Changes

  • Replaced 33 instances of urlEqualTo with urlPathEqualTo in stub definitions where URLs lack query parameters
  • Retained urlEqualTo in 1 case where query parameters are explicitly part of the URL match

Example

// Before - incorrectly requires exact URL match
apiServer.stubFor(
    delete(urlEqualTo("/api/v1/namespaces/default/pods/foo1"))
        .willReturn(aResponse().withStatus(200).withBody(json.serialize(status))));

// After - correctly matches path only
apiServer.stubFor(
    delete(urlPathEqualTo("/api/v1/namespaces/default/pods/foo1"))
        .willReturn(aResponse().withStatus(200).withBody(json.serialize(status))));

// Kept urlEqualTo when query params are explicit
apiServer.stubFor(
    patch(urlEqualTo("/api/v1/namespaces/ns/pods/pod?fieldManager=kubectl&force=false"))
        .willReturn(aResponse().withStatus(200).withBody(json.serialize(pod))));

Files Modified

  • util/src/test/java/io/kubernetes/client/util/generic/GenericKubernetesApiForCoreApiTest.java (15 changes)
  • util/src/test/java/io/kubernetes/client/util/generic/GenericKubernetesApiTest.java (9 changes)
  • util/src/test/java/io/kubernetes/client/util/generic/GenericKubernetesGetApiTest.java (4 changes)
  • spring/src/test/java/io/kubernetes/client/spring/extended/manifests/KubernetesManifestTest.java (2 changes)
  • util/src/test/java/io/kubernetes/client/util/generic/KubernetesApiResponseTest.java (2 changes)
  • examples/examples-release-latest/src/test/java/io/kubernetes/client/examples/ExampleTest.java (1 change)
Original prompt

This section details on the original issue you should resolve

<issue_title>substitute urlPathEqualTo for urlEqualTo where appropriate.</issue_title>
<issue_description>urlEqualTo is intended for the full URL. Anywhere we don't include query parameters we should use urlPathEqualTo</issue_description>

<agent_instructions>urlEqualTo is intended for the full URL. Anywhere we don't include query parameters we should use urlPathEqualTo</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Nov 17, 2025
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Nov 17, 2025
Copilot AI changed the title [WIP] Substitute urlPathEqualTo for urlEqualTo where appropriate Replace urlEqualTo with urlPathEqualTo in WireMock test stubs Nov 17, 2025
Copilot AI requested a review from brendandburns November 17, 2025 22:26
Copilot finished work on behalf of brendandburns November 17, 2025 22:26
Copy link
Contributor

@brendandburns brendandburns left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 17, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: brendandburns, Copilot

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 17, 2025
@brendandburns brendandburns removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 17, 2025
@brendandburns brendandburns marked this pull request as ready for review November 18, 2025 17:51
@k8s-ci-robot k8s-ci-robot merged commit 3c7856d into master Nov 18, 2025
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

substitute urlPathEqualTo for urlEqualTo where appropriate.

3 participants