@@ -82,29 +82,28 @@ public void testKubectlLabelNamespacedResourceShouldWork() throws KubectlExcepti
82
82
@ Test
83
83
public void testKubectlDeleteLabelNamespacedResourceShouldWork () throws KubectlException {
84
84
wireMockRule .stubFor (
85
- get (urlPathEqualTo ("/api/v1/namespaces/default/pods/foo" ))
86
- .willReturn (
87
- aResponse ()
88
- .withStatus (200 )
89
- .withBody ("{\" metadata\" :{\" name\" :\" foo\" ,\" namespace\" :\" default\" }}" )));
85
+ get (urlPathEqualTo ("/api/v1/namespaces/default/pods/foo" ))
86
+ .willReturn (
87
+ aResponse ()
88
+ .withStatus (200 )
89
+ .withBody ("{\" metadata\" :{\" name\" :\" foo\" ,\" namespace\" :\" default\" }}" )));
90
90
wireMockRule .stubFor (
91
- put (urlPathEqualTo ("/api/v1/namespaces/default/pods/foo" ))
92
- .withRequestBody (
93
- matchingJsonPath (
94
- "$.metadata.labels" , equalToJson ("{ \" k1\" : \" null\" }" )))
95
- .willReturn (
96
- aResponse ()
97
- .withStatus (200 )
98
- .withBody ("{\" metadata\" :{\" name\" :\" foo\" ,\" namespace\" :\" default\" }}" )));
91
+ put (urlPathEqualTo ("/api/v1/namespaces/default/pods/foo" ))
92
+ .withRequestBody (
93
+ matchingJsonPath ("$.metadata.labels" , equalToJson ("{ \" k1\" : \" null\" }" )))
94
+ .willReturn (
95
+ aResponse ()
96
+ .withStatus (200 )
97
+ .withBody ("{\" metadata\" :{\" name\" :\" foo\" ,\" namespace\" :\" default\" }}" )));
99
98
100
99
V1Pod unlabelledPod =
101
- Kubectl .label (V1Pod .class )
102
- .apiClient (apiClient )
103
- .skipDiscovery ()
104
- .namespace ("default" )
105
- .name ("foo" )
106
- .deleteLabel ("k1" )
107
- .execute ();
100
+ Kubectl .label (V1Pod .class )
101
+ .apiClient (apiClient )
102
+ .skipDiscovery ()
103
+ .namespace ("default" )
104
+ .name ("foo" )
105
+ .deleteLabel ("k1" )
106
+ .execute ();
108
107
109
108
wireMockRule .verify (1 , getRequestedFor (urlPathEqualTo ("/api/v1/namespaces/default/pods/foo" )));
110
109
wireMockRule .verify (1 , putRequestedFor (urlPathEqualTo ("/api/v1/namespaces/default/pods/foo" )));
@@ -169,28 +168,26 @@ public void testKubectlLabelClusterResourceShouldWork() throws KubectlException
169
168
@ Test
170
169
public void testKubectlDeleteLabelClusterResourceShouldWork () throws KubectlException {
171
170
wireMockRule .stubFor (
172
- get (urlPathEqualTo ("/api/v1/nodes/foo" ))
173
- .willReturn (aResponse ().withStatus (200 ).withBody ("{\" metadata\" :{\" name\" :\" foo\" }}" )));
171
+ get (urlPathEqualTo ("/api/v1/nodes/foo" ))
172
+ .willReturn (aResponse ().withStatus (200 ).withBody ("{\" metadata\" :{\" name\" :\" foo\" }}" )));
174
173
wireMockRule .stubFor (
175
- put (urlPathEqualTo ("/api/v1/nodes/foo" ))
176
- .withRequestBody (
177
- matchingJsonPath (
178
- "$.metadata.labels" , equalToJson ("{ \" k1\" : \" null\" }" )))
179
- .willReturn (aResponse ().withStatus (200 ).withBody ("{\" metadata\" :{\" name\" :\" foo\" }}" )));
174
+ put (urlPathEqualTo ("/api/v1/nodes/foo" ))
175
+ .withRequestBody (
176
+ matchingJsonPath ("$.metadata.labels" , equalToJson ("{ \" k1\" : \" null\" }" )))
177
+ .willReturn (aResponse ().withStatus (200 ).withBody ("{\" metadata\" :{\" name\" :\" foo\" }}" )));
180
178
181
179
V1Node unlabelledNode =
182
- Kubectl .label (V1Node .class )
183
- .apiClient (apiClient )
184
- .skipDiscovery ()
185
- .name ("foo" )
186
- .deleteLabel ("k1" )
187
- .execute ();
180
+ Kubectl .label (V1Node .class )
181
+ .apiClient (apiClient )
182
+ .skipDiscovery ()
183
+ .name ("foo" )
184
+ .deleteLabel ("k1" )
185
+ .execute ();
188
186
wireMockRule .verify (1 , getRequestedFor (urlPathEqualTo ("/api/v1/nodes/foo" )));
189
187
wireMockRule .verify (1 , putRequestedFor (urlPathEqualTo ("/api/v1/nodes/foo" )));
190
188
assertNotNull (unlabelledNode );
191
189
}
192
190
193
-
194
191
@ Test
195
192
public void testKubectlLabelClusterResourceReceiveForbiddenShouldThrowException ()
196
193
throws KubectlException {
0 commit comments