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

Function TestReplicaSetScale

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

Source from the content-addressed store, hash-verified

400}
401
402func TestReplicaSetScale(t *testing.T) {
403 scaleClientExpectedAction := []string{"patch"}
404 scaleClient := createFakeScaleClient("replicasets", "foo", 10, nil)
405 scaler := NewScaler(scaleClient)
406 count := uint(3)
407 name := "foo"
408 actualSize := new(int32)
409 err := scaler.Scale("default", name, count, actualSize, nil, nil, nil, rsgvr, false)
410 if err != nil {
411 t.Fatal(err)
412 }
413 if *actualSize != 3 {
414 t.Errorf("expected actualSize to be 3, got %d", *actualSize)
415 }
416 actions := scaleClient.Actions()
417 if len(actions) != len(scaleClientExpectedAction) {
418 t.Errorf("unexpected actions: %v, expected %d actions got %d", actions, len(scaleClientExpectedAction), len(actions))
419 }
420 for i, verb := range scaleClientExpectedAction {
421 if actions[i].GetVerb() != verb {
422 t.Errorf("unexpected action: %+v, expected %s", actions[i].GetVerb(), verb)
423 }
424 }
425}
426
427func TestReplicaSetScaleRetry(t *testing.T) {
428 verbsOnError := map[string]*apierrors.StatusError{

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…