Skip to content

Commit bc526a8

Browse files
committed
AWS: GP3 volume throughput tests
1 parent f28019d commit bc526a8

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
@@ -316,6 +316,110 @@ func TestMachineCreation(t *testing.T) {
316316
},
317317
expectedError: "",
318318
},
319+
{
320+
name: "with VolumeType set to gp3 and Throughput not set",
321+
platformType: osconfigv1.AWSPlatformType,
322+
clusterID: "aws-cluster",
323+
providerSpecValue: &kruntime.RawExtension{
324+
Object: &machinev1beta1.AWSMachineProviderConfig{
325+
AMI: machinev1beta1.AWSResourceReference{
326+
ID: ptr.To[string]("ami"),
327+
},
328+
BlockDevices: []machinev1beta1.BlockDeviceMappingSpec{
329+
{
330+
EBS: &machinev1beta1.EBSBlockDeviceSpec{
331+
VolumeType: ptr.To[string]("gp3"),
332+
},
333+
},
334+
},
335+
},
336+
},
337+
expectedError: "",
338+
},
339+
{
340+
name: "with VolumeType set to gp3 and Throughput set under minium value",
341+
platformType: osconfigv1.AWSPlatformType,
342+
clusterID: "aws-cluster",
343+
providerSpecValue: &kruntime.RawExtension{
344+
Object: &machinev1beta1.AWSMachineProviderConfig{
345+
AMI: machinev1beta1.AWSResourceReference{
346+
ID: ptr.To[string]("ami"),
347+
},
348+
BlockDevices: []machinev1beta1.BlockDeviceMappingSpec{
349+
{
350+
EBS: &machinev1beta1.EBSBlockDeviceSpec{
351+
VolumeType: ptr.To[string]("gp3"),
352+
ThroughputMib: ptr.To[int32](124),
353+
},
354+
},
355+
},
356+
},
357+
},
358+
expectedError: "providerSpec.blockDevices[0].ebs.throughputMib must be a value between 125 and 2000",
359+
},
360+
{
361+
name: "with VolumeType set to gp3 and Throughput set over maxium value",
362+
platformType: osconfigv1.AWSPlatformType,
363+
clusterID: "aws-cluster",
364+
providerSpecValue: &kruntime.RawExtension{
365+
Object: &machinev1beta1.AWSMachineProviderConfig{
366+
AMI: machinev1beta1.AWSResourceReference{
367+
ID: ptr.To[string]("ami"),
368+
},
369+
BlockDevices: []machinev1beta1.BlockDeviceMappingSpec{
370+
{
371+
EBS: &machinev1beta1.EBSBlockDeviceSpec{
372+
VolumeType: ptr.To[string]("gp3"),
373+
ThroughputMib: ptr.To[int32](2001),
374+
},
375+
},
376+
},
377+
},
378+
},
379+
expectedError: "providerSpec.blockDevices[0].ebs.throughputMib must be a value between 125 and 2000",
380+
},
381+
{
382+
name: "with VolumeType set to gp3 and Throughput set within range",
383+
platformType: osconfigv1.AWSPlatformType,
384+
clusterID: "aws-cluster",
385+
providerSpecValue: &kruntime.RawExtension{
386+
Object: &machinev1beta1.AWSMachineProviderConfig{
387+
AMI: machinev1beta1.AWSResourceReference{
388+
ID: ptr.To[string]("ami"),
389+
},
390+
BlockDevices: []machinev1beta1.BlockDeviceMappingSpec{
391+
{
392+
EBS: &machinev1beta1.EBSBlockDeviceSpec{
393+
VolumeType: ptr.To[string]("gp3"),
394+
ThroughputMib: ptr.To[int32](1000),
395+
},
396+
},
397+
},
398+
},
399+
},
400+
expectedError: "",
401+
},
402+
{
403+
name: "with Throughput set on non gp3 volume",
404+
platformType: osconfigv1.AWSPlatformType,
405+
clusterID: "aws-cluster",
406+
providerSpecValue: &kruntime.RawExtension{
407+
Object: &machinev1beta1.AWSMachineProviderConfig{
408+
AMI: machinev1beta1.AWSResourceReference{
409+
ID: ptr.To[string]("ami"),
410+
},
411+
BlockDevices: []machinev1beta1.BlockDeviceMappingSpec{
412+
{
413+
EBS: &machinev1beta1.EBSBlockDeviceSpec{
414+
VolumeType: ptr.To[string]("io1"),
415+
ThroughputMib: ptr.To[int32](124),
416+
},
417+
},
418+
},
419+
},
420+
},
421+
expectedError: "providerSpec.blockDevices[0].ebs.throughputMib is only valid for gp3 volumes",
422+
},
319423
{
320424
name: "with Azure and a nil provider spec value",
321425
platformType: osconfigv1.AzurePlatformType,

0 commit comments

Comments
 (0)