MCPcopy
hub / github.com/kubernetes/kubectl / TestStatefulSetScale

Function TestStatefulSetScale

pkg/scale/scale_test.go:289–312  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

287}
288
289func TestStatefulSetScale(t *testing.T) {
290 scaleClientExpectedAction := []string{"patch"}
291 scaleClient := createFakeScaleClient("statefulsets", "foo", 2, nil)
292 scaler := NewScaler(scaleClient)
293 count := uint(3)
294 name := "foo"
295 actualSize := new(int32)
296 err := scaler.Scale("default", name, count, actualSize, nil, nil, nil, stsgvr, false)
297 if err != nil {
298 t.Fatal(err)
299 }
300 if *actualSize != 3 {
301 t.Errorf("expected actualSize to be 3, got %d", *actualSize)
302 }
303 actions := scaleClient.Actions()
304 if len(actions) != len(scaleClientExpectedAction) {
305 t.Errorf("unexpected actions: %v, expected %d actions got %d", actions, len(scaleClientExpectedAction), len(actions))
306 }
307 for i, verb := range scaleClientExpectedAction {
308 if actions[i].GetVerb() != verb {
309 t.Errorf("unexpected action: %+v, expected %s", actions[i].GetVerb(), verb)
310 }
311 }
312}
313
314func TestStatefulSetScaleRetry(t *testing.T) {
315 scaleClientExpectedAction := []string{"patch", "get"}

Callers

nothing calls this directly

Calls 3

ScaleMethod · 0.95
createFakeScaleClientFunction · 0.85
NewScalerFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…