Skip to content

Commit 0fe7329

Browse files
authored
Merge pull request #3686 from yue9944882/sanitize-ut-api-path
Nit: Sanitize mock API paths in the tests
2 parents e687bd6 + 8d34647 commit 0fe7329

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

extended/src/test/java/io/kubernetes/client/extended/kubectl/KubectlDeleteTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ void kubectlDelete() throws KubectlException, ApiException {
142142
.withStatus(201)
143143
.withBody(ADD_JOB)));
144144
apiServer.stubFor(
145-
delete(urlPathEqualTo("/apis/batch%2Fv1/batch%2Fv1/namespaces/foo/jobs/bar"))
145+
delete(urlPathEqualTo("/apis/batch/v1/namespaces/foo/jobs/bar"))
146146
.inScenario("JobDeletionScenario")
147147
.whenScenarioStateIs(Scenario.STARTED)
148148
.willReturn(aResponse()
@@ -153,7 +153,7 @@ void kubectlDelete() throws KubectlException, ApiException {
153153
);
154154

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

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

0 commit comments

Comments
 (0)