Skip to content

Commit 9bd01ca

Browse files
committed
Replace Get operations with polling and skip VAC tests during integration test
1 parent 82a4f6c commit 9bd01ca

File tree

3 files changed

+20
-11
lines changed

3 files changed

+20
-11
lines changed

cmd/gce-pd-csi-driver/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ var (
5757
attachDiskBackoffJitter = flag.Float64("attach-disk-backoff-jitter", 0.0, "Jitter for attachDisk backoff")
5858
attachDiskBackoffSteps = flag.Int("attach-disk-backoff-steps", 24, "Steps for attachDisk backoff")
5959
attachDiskBackoffCap = flag.Duration("attach-disk-backoff-cap", 0, "Cap for attachDisk backoff")
60-
waitForOpBackoffDuration = flag.Duration("wait-op-backoff-duration", 3*time.Second, "Duration for wait for operation backoff")
60+
waitForOpBackoffDuration = flag.Duration("wait-op-backoff-duration", 2*time.Minute, "Duration for wait for operation backoff")
6161
waitForOpBackoffFactor = flag.Float64("wait-op-backoff-factor", 0.0, "Factor for wait for operation backoff")
6262
waitForOpBackoffJitter = flag.Float64("wait-op-backoff-jitter", 0.0, "Jitter for wait for operation backoff")
63-
waitForOpBackoffSteps = flag.Int("wait-op-backoff-steps", 100, "Steps for wait for operation backoff")
63+
waitForOpBackoffSteps = flag.Int("wait-op-backoff-steps", 3, "Steps for wait for operation backoff")
6464
waitForOpBackoffCap = flag.Duration("wait-op-backoff-cap", 0, "Cap for wait for operation backoff")
6565

6666
enableDeviceInUseCheck = flag.Bool("enable-device-in-use-check-on-node-unstage", true, "If set to true, block NodeUnstageVolume requests until the specified device is not in use")

pkg/gce-cloud-provider/compute/gce-compute.go

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,12 @@ var AttachDiskBackoff = wait.Backoff{
7676
Cap: 0}
7777

7878
// WaitForOpBackoff is backoff used to wait for Global, Regional or Zonal operation to complete.
79-
// Default values are similar to Poll every 3 seconds with 5 minute timeout.
79+
// Default values are similar to Poll every 2 minutes with 6 minute timeout.
8080
var WaitForOpBackoff = wait.Backoff{
81-
Duration: 3 * time.Second,
81+
Duration: 2 * time.Minute,
8282
Factor: 0.0,
8383
Jitter: 0.0,
84-
Steps: 100,
84+
Steps: 3,
8585
Cap: 0}
8686

8787
// Custom error type to propagate error messages up to clients.
@@ -1066,37 +1066,42 @@ func (cloud *CloudProvider) getRegionalDiskTypeURI(project string, region, diskT
10661066
func (cloud *CloudProvider) waitForZonalOp(ctx context.Context, project, opName string, zone string) error {
10671067
// The v1 API can query for v1, alpha, or beta operations.
10681068
return wait.ExponentialBackoff(WaitForOpBackoff, func() (bool, error) {
1069-
pollOp, err := cloud.service.ZoneOperations.Get(project, zone, opName).Context(ctx).Do()
1069+
waitOp, err := cloud.service.ZoneOperations.Wait(project, zone, opName).Context(ctx).Do()
1070+
// 5** codes represent server errors which should be retried e.g. server overload or gateway overload
1071+
// In this case do not return an error so ExponentialBackoff will retry
1072+
if err != nil && waitOp.HttpErrorStatusCode >= 500 && waitOp.HttpErrorStatusCode <= 599 {
1073+
return false, nil
1074+
}
10701075
if err != nil {
10711076
klog.Errorf("WaitForOp(op: %s, zone: %#v) failed to poll the operation", opName, zone)
10721077
return false, err
10731078
}
1074-
done, err := opIsDone(pollOp)
1079+
done, err := opIsDone(waitOp)
10751080
return done, err
10761081
})
10771082
}
10781083

10791084
func (cloud *CloudProvider) waitForRegionalOp(ctx context.Context, project, opName string, region string) error {
10801085
// The v1 API can query for v1, alpha, or beta operations.
10811086
return wait.ExponentialBackoff(WaitForOpBackoff, func() (bool, error) {
1082-
pollOp, err := cloud.service.RegionOperations.Get(project, region, opName).Context(ctx).Do()
1087+
waitOp, err := cloud.service.RegionOperations.Wait(project, region, opName).Context(ctx).Do()
10831088
if err != nil {
10841089
klog.Errorf("WaitForOp(op: %s, region: %#v) failed to poll the operation", opName, region)
10851090
return false, err
10861091
}
1087-
done, err := opIsDone(pollOp)
1092+
done, err := opIsDone(waitOp)
10881093
return done, err
10891094
})
10901095
}
10911096

10921097
func (cloud *CloudProvider) waitForGlobalOp(ctx context.Context, project, opName string) error {
10931098
return wait.ExponentialBackoff(WaitForOpBackoff, func() (bool, error) {
1094-
pollOp, err := cloud.service.GlobalOperations.Get(project, opName).Context(ctx).Do()
1099+
waitOp, err := cloud.service.GlobalOperations.Wait(project, opName).Context(ctx).Do()
10951100
if err != nil {
10961101
klog.Errorf("waitForGlobalOp(op: %s) failed to poll the operation", opName)
10971102
return false, err
10981103
}
1099-
done, err := opIsDone(pollOp)
1104+
done, err := opIsDone(waitOp)
11001105
return done, err
11011106
})
11021107
}

test/k8s-integration/main.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,8 @@ func generateGCETestSkip(testParams *testParameters) string {
639639
skipString := "\\[Disruptive\\]|\\[Serial\\]"
640640
// Skip mount options test until we fix the invalid mount options for xfs.
641641
skipString = skipString + "|csi-gcepd-sc-xfs.*provisioning.should.provision.storage.with.mount.options"
642+
// Skip VolumeAttributesClass tests while it's a beta feature.
643+
skipString = skipString + "|\\[Feature:VolumeAttributesClass\\]"
642644

643645
v := apimachineryversion.MustParseSemantic(testParams.clusterVersion)
644646

@@ -745,6 +747,8 @@ func generateGKETestSkip(testParams *testParameters) string {
745747

746748
// Skip mount options test until we fix the invalid mount options for xfs.
747749
skipString = skipString + "|csi-gcepd-sc-xfs.*provisioning.should.provision.storage.with.mount.options"
750+
// Skip VolumeAttributesClass tests while it's a beta feature.
751+
skipString = skipString + "|\\[Feature:VolumeAttributesClass\\]"
748752

749753
// Skip rwop test when node version is less than 1.32. Test was added only
750754
// in 1.32 and above, see tags in

0 commit comments

Comments
 (0)