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

Function TestStatefulSetScaleFailsPreconditions

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

Source from the content-addressed store, hash-verified

378}
379
380func TestStatefulSetScaleFailsPreconditions(t *testing.T) {
381 scaleClientExpectedAction := []string{"get"}
382 scaleClient := createFakeScaleClient("statefulsets", "foo", 10, nil)
383 scaler := NewScaler(scaleClient)
384 preconditions := ScalePrecondition{2, ""}
385 count := uint(3)
386 name := "foo"
387 err := scaler.Scale("default", name, count, nil, &preconditions, nil, nil, stsgvr, false)
388 if err == nil {
389 t.Fatal("expected to get an error but none was returned")
390 }
391 actions := scaleClient.Actions()
392 if len(actions) != len(scaleClientExpectedAction) {
393 t.Errorf("unexpected actions: %v, expected %d actions got %d", actions, len(scaleClientExpectedAction), len(actions))
394 }
395 for i, verb := range scaleClientExpectedAction {
396 if actions[i].GetVerb() != verb {
397 t.Errorf("unexpected action: %+v, expected %s", actions[i].GetVerb(), verb)
398 }
399 }
400}
401
402func TestReplicaSetScale(t *testing.T) {
403 scaleClientExpectedAction := []string{"patch"}

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…