@@ -89,19 +89,14 @@ public void testKubectlDeleteLabelNamespacedResourceShouldWork() throws KubectlE
89
89
.withBody ("{\" metadata\" :{\" name\" :\" foo\" ,\" namespace\" :\" default\" }}" )));
90
90
wireMockRule .stubFor (
91
91
put (urlPathEqualTo ("/api/v1/namespaces/default/pods/foo" ))
92
+ .withRequestBody (
93
+ matchingJsonPath (
94
+ "$.metadata.labels" , equalToJson ("{ \" k1\" : \" null\" }" )))
92
95
.willReturn (
93
96
aResponse ()
94
97
.withStatus (200 )
95
98
.withBody ("{\" metadata\" :{\" name\" :\" foo\" ,\" namespace\" :\" default\" }}" )));
96
99
97
- Kubectl .label (V1Pod .class )
98
- .apiClient (apiClient )
99
- .skipDiscovery ()
100
- .namespace ("default" )
101
- .name ("foo" )
102
- .addLabel ("k1" , "v1" )
103
- .execute ();
104
-
105
100
V1Pod unlabelledPod =
106
101
Kubectl .label (V1Pod .class )
107
102
.apiClient (apiClient )
@@ -111,8 +106,8 @@ public void testKubectlDeleteLabelNamespacedResourceShouldWork() throws KubectlE
111
106
.deleteLabel ("k1" )
112
107
.execute ();
113
108
114
- wireMockRule .verify (2 , getRequestedFor (urlPathEqualTo ("/api/v1/namespaces/default/pods/foo" )));
115
- wireMockRule .verify (2 , putRequestedFor (urlPathEqualTo ("/api/v1/namespaces/default/pods/foo" )));
109
+ wireMockRule .verify (1 , getRequestedFor (urlPathEqualTo ("/api/v1/namespaces/default/pods/foo" )));
110
+ wireMockRule .verify (1 , putRequestedFor (urlPathEqualTo ("/api/v1/namespaces/default/pods/foo" )));
116
111
assertNotNull (unlabelledPod );
117
112
}
118
113
@@ -178,24 +173,20 @@ public void testKubectlDeleteLabelClusterResourceShouldWork() throws KubectlExce
178
173
.willReturn (aResponse ().withStatus (200 ).withBody ("{\" metadata\" :{\" name\" :\" foo\" }}" )));
179
174
wireMockRule .stubFor (
180
175
put (urlPathEqualTo ("/api/v1/nodes/foo" ))
176
+ .withRequestBody (
177
+ matchingJsonPath (
178
+ "$.metadata.labels" , equalToJson ("{ \" k1\" : \" null\" }" )))
181
179
.willReturn (aResponse ().withStatus (200 ).withBody ("{\" metadata\" :{\" name\" :\" foo\" }}" )));
182
180
183
- Kubectl .label (V1Node .class )
184
- .apiClient (apiClient )
185
- .skipDiscovery ()
186
- .name ("foo" )
187
- .addLabel ("k1" , "v1" )
188
- .execute ();
189
-
190
181
V1Node unlabelledNode =
191
182
Kubectl .label (V1Node .class )
192
183
.apiClient (apiClient )
193
184
.skipDiscovery ()
194
185
.name ("foo" )
195
186
.deleteLabel ("k1" )
196
187
.execute ();
197
- wireMockRule .verify (2 , getRequestedFor (urlPathEqualTo ("/api/v1/nodes/foo" )));
198
- wireMockRule .verify (2 , putRequestedFor (urlPathEqualTo ("/api/v1/nodes/foo" )));
188
+ wireMockRule .verify (1 , getRequestedFor (urlPathEqualTo ("/api/v1/nodes/foo" )));
189
+ wireMockRule .verify (1 , putRequestedFor (urlPathEqualTo ("/api/v1/nodes/foo" )));
199
190
assertNotNull (unlabelledNode );
200
191
}
201
192
0 commit comments