File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
extended/src/test/java/io/kubernetes/client/extended/kubectl Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change 2727import io .kubernetes .client .openapi .models .V1Deployment ;
2828import io .kubernetes .client .openapi .models .V1Pod ;
2929import io .kubernetes .client .openapi .models .V1ReplicaSet ;
30+ import io .kubernetes .client .openapi .models .V1StatefulSet ;
3031import io .kubernetes .client .util .ClientBuilder ;
3132import java .io .IOException ;
3233import org .junit .Before ;
@@ -90,6 +91,29 @@ public void testKubectlScaleReplicaSetShouldWork() throws KubectlException {
9091 assertNotNull (scaled );
9192 }
9293
94+ @ Test
95+ public void testKubectlScaleStatefulSetShouldWork () throws KubectlException {
96+ wireMockRule .stubFor (
97+ patch (urlPathEqualTo ("/apis/apps/v1/namespaces/default/statefulsets/foo" ))
98+ .willReturn (
99+ aResponse ()
100+ .withStatus (200 )
101+ .withBody ("{\" metadata\" :{\" name\" :\" foo\" ,\" namespace\" :\" default\" }}" )));
102+ V1StatefulSet scaled =
103+ Kubectl .scale (V1StatefulSet .class )
104+ .apiClient (apiClient )
105+ .name ("foo" )
106+ .namespace ("default" )
107+ .replicas (8 )
108+ .execute ();
109+ wireMockRule .verify (
110+ 1 ,
111+ patchRequestedFor (urlPathEqualTo ("/apis/apps/v1/namespaces/default/statefulsets/foo" ))
112+ .withRequestBody (
113+ equalToJson ("[{\" op\" :\" replace\" ,\" path\" :\" /spec/replicas\" ,\" value\" :8}]" )));
114+ assertNotNull (scaled );
115+ }
116+
93117 @ Test
94118 public void testKubectlScaleShouldThrow () {
95119 assertThrows (
You can’t perform that action at this time.
0 commit comments