diff --git a/controllers/provisioners/eks/create_test.go b/controllers/provisioners/eks/create_test.go index f73b7b3d..cd371812 100644 --- a/controllers/provisioners/eks/create_test.go +++ b/controllers/provisioners/eks/create_test.go @@ -370,6 +370,15 @@ func TestCreateLatestAMI(t *testing.T) { ig.GetEKSConfiguration().Image = "latest" ssmMock.latestAMI = testLatestAmiID + ec2Mock.InstanceTypes = []*ec2.InstanceTypeInfo{ + &ec2.InstanceTypeInfo{ + InstanceType: aws.String("m5.large"), + ProcessorInfo: &ec2.ProcessorInfo{ + SupportedArchitectures: []*string{aws.String("x86_64")}, + }, + }, + } + err := ctx.CloudDiscovery() g.Expect(err).NotTo(gomega.HaveOccurred()) // Must happen after ctx.CloudDiscover() diff --git a/controllers/provisioners/eks/update_test.go b/controllers/provisioners/eks/update_test.go index ec4cf622..3be098c8 100644 --- a/controllers/provisioners/eks/update_test.go +++ b/controllers/provisioners/eks/update_test.go @@ -729,6 +729,30 @@ func TestUpdateWithLatestAmiID(t *testing.T) { } asgMock.AutoScalingGroups = []*autoscaling.Group{mockScalingGroup} + // skip role creation + ig.GetEKSConfiguration().SetInstanceProfileName("some-profile") + ig.GetEKSConfiguration().SetRoleName("some-role") + iamMock.Role = &iam.Role{ + Arn: aws.String("some-arn"), + RoleName: aws.String("some-role"), + } + + // Setup Latest AMI + ig.GetEKSConfiguration().Image = "latest" + ssmMock.latestAMI = testLatestAmiID + + ec2Mock.InstanceTypes = []*ec2.InstanceTypeInfo{ + &ec2.InstanceTypeInfo{ + InstanceType: aws.String("m5.large"), + ProcessorInfo: &ec2.ProcessorInfo{ + SupportedArchitectures: []*string{aws.String("x86_64")}, + }, + }, + } + + err := ctx.CloudDiscovery() + g.Expect(err).NotTo(gomega.HaveOccurred()) + ctx.SetDiscoveredState(&DiscoveredState{ Publisher: kubeprovider.EventPublisher{ Client: k.Kubernetes, @@ -752,11 +776,7 @@ func TestUpdateWithLatestAmiID(t *testing.T) { }, }) - // Setup Latest AMI - ig.GetEKSConfiguration().Image = "latest" - ssmMock.latestAMI = testLatestAmiID - - err := ctx.Update() + err = ctx.Update() g.Expect(err).NotTo(gomega.HaveOccurred()) g.Expect(ctx.GetInstanceGroup().Spec.EKSSpec.EKSConfiguration.Image).To(gomega.Equal(testLatestAmiID)) }