Skip to content

Commit cb64dfb

Browse files
committed
ic: aws: add instance type architecture mistmatch unit test
To check that we are during pre-install validation against the architecture.
1 parent 6eb87d2 commit cb64dfb

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

pkg/asset/installconfig/aws/validation_test.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,11 @@ func validInstanceTypes() map[string]InstanceType {
223223
MemInMiB: 16384,
224224
Arches: []string{ec2.ArchitectureTypeX8664},
225225
},
226+
"m6g.xlarge": {
227+
DefaultVCpus: 4,
228+
MemInMiB: 16384,
229+
Arches: []string{ec2.ArchitectureTypeArm64},
230+
},
226231
}
227232
}
228233

@@ -365,6 +370,22 @@ func TestValidate(t *testing.T) {
365370
availZones: validAvailZones(),
366371
instanceTypes: validInstanceTypes(),
367372
expectErr: `^\Qcompute[0].platform.aws.type: Invalid value: "m5.dummy": instance type m5.dummy not found\E$`,
373+
}, {
374+
name: "mismatched instance architecture",
375+
installConfig: func() *types.InstallConfig {
376+
c := validInstallConfig()
377+
c.Platform.AWS = &aws.Platform{
378+
Region: "us-east-1",
379+
DefaultMachinePlatform: &aws.MachinePool{InstanceType: "m5.xlarge"},
380+
}
381+
c.ControlPlane.Architecture = types.ArchitectureARM64
382+
c.Compute[0].Platform.AWS.InstanceType = "m6g.xlarge"
383+
c.Compute[0].Architecture = types.ArchitectureAMD64
384+
return c
385+
}(),
386+
availZones: validAvailZones(),
387+
instanceTypes: validInstanceTypes(),
388+
expectErr: `^\[controlPlane.platform.aws.type: Invalid value: "m5.xlarge": instance type supported architectures \[amd64\] do not match specified architecture arm64, compute\[0\].platform.aws.type: Invalid value: "m6g.xlarge": instance type supported architectures \[arm64\] do not match specified architecture amd64\]$`,
368389
}, {
369390
name: "invalid no private subnets",
370391
installConfig: func() *types.InstallConfig {

0 commit comments

Comments
 (0)