Skip to content

Commit 710235e

Browse files
committed
AWS: GP3 volume throughput tests
1 parent c7353ef commit 710235e

File tree

1 file changed

+104
-0
lines changed

1 file changed

+104
-0
lines changed

pkg/webhooks/machine_webhook_test.go

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,110 @@ func TestMachineCreation(t *testing.T) {
451451
},
452452
expectedError: "admission webhook \"validation.machine.machine.openshift.io\" denied the request: spec.hostPlacement.dedicatedHost.id: Invalid value: \"invalid\": id must start with 'h-' followed by 17 lowercase hexadecimal characters (0-9 and a-f)",
453453
},
454+
{
455+
name: "with VolumeType set to gp3 and Throughput not set",
456+
platformType: osconfigv1.AWSPlatformType,
457+
clusterID: "aws-cluster",
458+
providerSpecValue: &kruntime.RawExtension{
459+
Object: &machinev1beta1.AWSMachineProviderConfig{
460+
AMI: machinev1beta1.AWSResourceReference{
461+
ID: ptr.To[string]("ami"),
462+
},
463+
BlockDevices: []machinev1beta1.BlockDeviceMappingSpec{
464+
{
465+
EBS: &machinev1beta1.EBSBlockDeviceSpec{
466+
VolumeType: ptr.To[string]("gp3"),
467+
},
468+
},
469+
},
470+
},
471+
},
472+
expectedError: "",
473+
},
474+
{
475+
name: "with VolumeType set to gp3 and Throughput set under minium value",
476+
platformType: osconfigv1.AWSPlatformType,
477+
clusterID: "aws-cluster",
478+
providerSpecValue: &kruntime.RawExtension{
479+
Object: &machinev1beta1.AWSMachineProviderConfig{
480+
AMI: machinev1beta1.AWSResourceReference{
481+
ID: ptr.To[string]("ami"),
482+
},
483+
BlockDevices: []machinev1beta1.BlockDeviceMappingSpec{
484+
{
485+
EBS: &machinev1beta1.EBSBlockDeviceSpec{
486+
VolumeType: ptr.To[string]("gp3"),
487+
ThroughputMib: ptr.To[int32](124),
488+
},
489+
},
490+
},
491+
},
492+
},
493+
expectedError: "providerSpec.blockDevices[0].ebs.throughputMib must be a value between 125 and 2000",
494+
},
495+
{
496+
name: "with VolumeType set to gp3 and Throughput set over maxium value",
497+
platformType: osconfigv1.AWSPlatformType,
498+
clusterID: "aws-cluster",
499+
providerSpecValue: &kruntime.RawExtension{
500+
Object: &machinev1beta1.AWSMachineProviderConfig{
501+
AMI: machinev1beta1.AWSResourceReference{
502+
ID: ptr.To[string]("ami"),
503+
},
504+
BlockDevices: []machinev1beta1.BlockDeviceMappingSpec{
505+
{
506+
EBS: &machinev1beta1.EBSBlockDeviceSpec{
507+
VolumeType: ptr.To[string]("gp3"),
508+
ThroughputMib: ptr.To[int32](2001),
509+
},
510+
},
511+
},
512+
},
513+
},
514+
expectedError: "providerSpec.blockDevices[0].ebs.throughputMib must be a value between 125 and 2000",
515+
},
516+
{
517+
name: "with VolumeType set to gp3 and Throughput set within range",
518+
platformType: osconfigv1.AWSPlatformType,
519+
clusterID: "aws-cluster",
520+
providerSpecValue: &kruntime.RawExtension{
521+
Object: &machinev1beta1.AWSMachineProviderConfig{
522+
AMI: machinev1beta1.AWSResourceReference{
523+
ID: ptr.To[string]("ami"),
524+
},
525+
BlockDevices: []machinev1beta1.BlockDeviceMappingSpec{
526+
{
527+
EBS: &machinev1beta1.EBSBlockDeviceSpec{
528+
VolumeType: ptr.To[string]("gp3"),
529+
ThroughputMib: ptr.To[int32](1000),
530+
},
531+
},
532+
},
533+
},
534+
},
535+
expectedError: "",
536+
},
537+
{
538+
name: "with Throughput set on non gp3 volume",
539+
platformType: osconfigv1.AWSPlatformType,
540+
clusterID: "aws-cluster",
541+
providerSpecValue: &kruntime.RawExtension{
542+
Object: &machinev1beta1.AWSMachineProviderConfig{
543+
AMI: machinev1beta1.AWSResourceReference{
544+
ID: ptr.To[string]("ami"),
545+
},
546+
BlockDevices: []machinev1beta1.BlockDeviceMappingSpec{
547+
{
548+
EBS: &machinev1beta1.EBSBlockDeviceSpec{
549+
VolumeType: ptr.To[string]("io1"),
550+
ThroughputMib: ptr.To[int32](124),
551+
},
552+
},
553+
},
554+
},
555+
},
556+
expectedError: "providerSpec.blockDevices[0].ebs.throughputMib is only valid for gp3 volumes",
557+
},
454558
{
455559
name: "with Azure and a nil provider spec value",
456560
platformType: osconfigv1.AzurePlatformType,

0 commit comments

Comments
 (0)