(t *testing.T)
| 28 | ) |
| 29 | |
| 30 | func 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 | } |
nothing calls this directly
no test coverage detected