MCPcopy
hub / github.com/kubernetes/kops / TestWarmPoolOnlyRoll

Function TestWarmPoolOnlyRoll

pkg/instancegroups/instancegroups_test.go:30–68  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

28)
29
30func TestWarmPoolOnlyRoll(t *testing.T) {
31 ctx := context.Background()
32 c, cloud := getTestSetup()
33
34 groupName := "warmPoolOnly"
35 instanceID := "node-1"
36
37 groups := make(map[string]*cloudinstances.CloudInstanceGroup)
38 makeGroup(groups, c.K8sClient, cloud, groupName, kopsapi.InstanceGroupRoleNode, 0, 0)
39
40 group := groups[groupName]
41 group.MinSize = 0
42 group.MaxSize = 10
43
44 maxSurge := intstr.FromString("25%")
45
46 group.InstanceGroup.Spec.RollingUpdate = &kopsapi.RollingUpdate{
47 MaxSurge: &maxSurge,
48 }
49
50 cloud.Autoscaling().AttachInstances(ctx, &autoscaling.AttachInstancesInput{
51 AutoScalingGroupName: &groupName,
52 InstanceIds: []string{instanceID},
53 })
54
55 instance, err := group.NewCloudInstance("node-1", cloudinstances.CloudInstanceStatusNeedsUpdate, nil)
56 if err != nil {
57 t.Fatalf("could not create cloud instance: %v", err)
58 }
59
60 instance.State = cloudinstances.WarmPool
61
62 {
63 err := c.rollingUpdateInstanceGroup(ctx, group, 0*time.Second)
64 if err != nil {
65 t.Fatalf("could not roll instance group: %v", err)
66 }
67 }
68}

Callers

nothing calls this directly

Calls 7

getTestSetupFunction · 0.85
makeGroupFunction · 0.85
FromStringMethod · 0.80
NewCloudInstanceMethod · 0.80
AttachInstancesMethod · 0.65
AutoscalingMethod · 0.65

Tested by

no test coverage detected