Skip to content

Commit

Permalink
Merge pull request #3686 from yue9944882/sanitize-ut-api-path
Browse files Browse the repository at this point in the history
Nit: Sanitize mock API paths in the tests
  • Loading branch information
k8s-ci-robot authored Sep 13, 2024
2 parents e687bd6 + 8d34647 commit 0fe7329
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ void kubectlDelete() throws KubectlException, ApiException {
.withStatus(201)
.withBody(ADD_JOB)));
apiServer.stubFor(
delete(urlPathEqualTo("/apis/batch%2Fv1/batch%2Fv1/namespaces/foo/jobs/bar"))
delete(urlPathEqualTo("/apis/batch/v1/namespaces/foo/jobs/bar"))
.inScenario("JobDeletionScenario")
.whenScenarioStateIs(Scenario.STARTED)
.willReturn(aResponse()
Expand All @@ -153,7 +153,7 @@ void kubectlDelete() throws KubectlException, ApiException {
);

apiServer.stubFor(
delete(urlPathEqualTo("/apis/batch%2Fv1/batch%2Fv1/namespaces/foo/jobs/bar"))
delete(urlPathEqualTo("/apis/batch/v1/namespaces/foo/jobs/bar"))
.inScenario("JobDeletionScenario")
.whenScenarioStateIs("SecondCall")
.willReturn(aResponse()
Expand Down Expand Up @@ -204,7 +204,7 @@ void kubectlDelete() throws KubectlException, ApiException {
BatchV1Api api = new BatchV1Api();
api.setApiClient(apiClient);
api.createNamespacedJob("foo", job).execute();
ModelMapper.addModelMap(api.getAPIResources().execute().getGroupVersion(), job.getApiVersion(), job.getKind(), "jobs", true, V1Job.class);
ModelMapper.addModelMap("batch", "v1", job.getKind(), "jobs", true, V1Job.class);

KubectlDelete<V1Job> kubectlDelete = Kubectl.delete(V1Job.class);
kubectlDelete.apiClient(apiClient);
Expand All @@ -215,7 +215,7 @@ void kubectlDelete() throws KubectlException, ApiException {
kubectlDelete.execute();
apiServer.verify(
1,
deleteRequestedFor(urlPathEqualTo("/apis/batch%2Fv1/batch%2Fv1/namespaces/foo/jobs/bar"))
deleteRequestedFor(urlPathEqualTo("/apis/batch/v1/namespaces/foo/jobs/bar"))
.withRequestBody(equalToJson("{\"propagationPolicy\" : \"Foreground\"}")));
assertThatThrownBy(() -> {
KubectlDelete<V1Job> kubectlDelete2 = Kubectl.delete(V1Job.class);
Expand Down

0 comments on commit 0fe7329

Please sign in to comment.