Skip to content

Add pd-extreme e2e test case of defaulting to default iops when iops not set #1309

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions pkg/gce-cloud-provider/compute/gce-compute.go
Original file line number Diff line number Diff line change
Expand Up @@ -574,12 +574,15 @@ func (cloud *CloudProvider) insertZonalDisk(
}

diskToCreate := &computev1.Disk{
Name: volKey.Name,
SizeGb: common.BytesToGbRoundUp(capBytes),
Description: description,
Type: cloud.GetDiskTypeURI(project, volKey, params.DiskType),
Labels: params.Labels,
ProvisionedIops: params.ProvisionedIOPSOnCreate,
Name: volKey.Name,
SizeGb: common.BytesToGbRoundUp(capBytes),
Description: description,
Type: cloud.GetDiskTypeURI(project, volKey, params.DiskType),
Labels: params.Labels,
}

if params.ProvisionedIOPSOnCreate > 0 {
diskToCreate.ProvisionedIops = params.ProvisionedIOPSOnCreate
}

if snapshotID != "" {
Expand Down
74 changes: 58 additions & 16 deletions test/e2e/tests/single_zone_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,22 @@ import (
const (
testNamePrefix = "gcepd-csi-e2e-"

defaultSizeGb int64 = 5
defaultExtremeSizeGb int64 = 500
defaultHdTSizeGb int64 = 2048
defaultRepdSizeGb int64 = 200
defaultMwSizeGb int64 = 200
defaultVolumeLimit int64 = 127
readyState = "READY"
standardDiskType = "pd-standard"
extremeDiskType = "pd-extreme"
hdtDiskType = "hyperdisk-throughput"
provisionedIOPSOnCreate = "12345"
provisionedIOPSOnCreateInt = int64(12345)
provisionedThroughputOnCreate = "66Mi"
provisionedThroughputOnCreateInt = int64(66)

defaultEpsilon = 500000000 // 500M
defaultSizeGb int64 = 5
defaultExtremeSizeGb int64 = 500
defaultHdTSizeGb int64 = 2048
defaultRepdSizeGb int64 = 200
defaultMwSizeGb int64 = 200
defaultVolumeLimit int64 = 127
readyState = "READY"
standardDiskType = "pd-standard"
extremeDiskType = "pd-extreme"
hdtDiskType = "hyperdisk-throughput"
provisionedIOPSOnCreate = "12345"
provisionedIOPSOnCreateInt = int64(12345)
provisionedIOPSOnCreateDefaultInt = int64(100000)
provisionedThroughputOnCreate = "66Mi"
provisionedThroughputOnCreateInt = int64(66)
defaultEpsilon = 500000000 // 500M
)

var _ = Describe("GCE PD CSI Driver", func() {
Expand Down Expand Up @@ -424,6 +424,48 @@ var _ = Describe("GCE PD CSI Driver", func() {
Entry("on pd-extreme", extremeDiskType),
)

DescribeTable("Should create and delete pd-extreme disk with default iops",
func(diskType string) {
Expect(testContexts).ToNot(BeEmpty())
testContext := getRandomTestContext()

p, z, _ := testContext.Instance.GetIdentity()
client := testContext.Client

// Create Disk
diskParams := map[string]string{
common.ParameterKeyType: diskType,
}
volName := testNamePrefix + string(uuid.NewUUID())

diskSize := defaultExtremeSizeGb

volume, err := client.CreateVolume(volName, diskParams, diskSize, nil, nil)

Expect(err).To(BeNil(), "CreateVolume failed with error: %v", err)

// Validate Disk Created
cloudDisk, err := computeService.Disks.Get(p, z, volName).Do()
Expect(err).To(BeNil(), "Could not get disk from cloud directly")
Expect(cloudDisk.Status).To(Equal(readyState))
Expect(cloudDisk.SizeGb).To(Equal(defaultExtremeSizeGb))
Expect(cloudDisk.Type).To(ContainSubstring(extremeDiskType))
Expect(cloudDisk.ProvisionedIops).To(Equal(provisionedIOPSOnCreateDefaultInt))
Expect(cloudDisk.Name).To(Equal(volName))

defer func() {
// Delete Disk
client.DeleteVolume(volume.VolumeId)
Expect(err).To(BeNil(), "DeleteVolume failed")

// Validate Disk Deleted
_, err = computeService.Disks.Get(p, z, volName).Do()
Expect(gce.IsGCEError(err, "notFound")).To(BeTrue(), "Expected disk to not be found")
}()
},
Entry("on pd-extreme", extremeDiskType),
)

DescribeTable("Should create and delete disk with labels",
func(diskType string) {
Expect(testContexts).ToNot(BeEmpty())
Expand Down