Skip to content

Commit 06b9006

Browse files
authored
Merge pull request kubernetes-sigs#1299 from k8s-infra-cherrypick-robot/cherry-pick-1298-to-release-1.24
[release-1.24] cleanup: rename WaitUntilTimeout func
2 parents 9c9d3a2 + 26aa2a4 commit 06b9006

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

pkg/blob/controllerserver.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,7 @@ func (d *Driver) copyBlobContainer(req *csi.CreateVolumeRequest, accountSasToken
783783
_, percent, _ := d.azcopy.GetAzcopyJob(dstContainerName, authAzcopyEnv)
784784
return fmt.Errorf("timeout waiting for copy blob container %s to %s complete, current copy percent: %s%%", srcContainerName, dstContainerName, percent)
785785
}
786-
copyErr := util.WaitForExecCompletion(time.Duration(d.waitForAzCopyTimeoutMinutes)*time.Minute, execFunc, timeoutFunc)
786+
copyErr := util.WaitUntilTimeout(time.Duration(d.waitForAzCopyTimeoutMinutes)*time.Minute, execFunc, timeoutFunc)
787787
if copyErr != nil {
788788
klog.Warningf("CopyBlobContainer(%s, %s, %s) failed with error: %v", resourceGroupName, accountName, dstPath, copyErr)
789789
} else {

pkg/blob/nodeserver.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ func (d *Driver) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRe
353353
mountOptions := util.JoinMountOptions(mountFlags, []string{"sec=sys,vers=3,nolock"})
354354
execFunc := func() error { return d.mounter.MountSensitive(source, targetPath, mountType, mountOptions, []string{}) }
355355
timeoutFunc := func() error { return fmt.Errorf("time out") }
356-
if err := volumehelper.WaitForExecCompletion(2*time.Minute, execFunc, timeoutFunc); err != nil {
356+
if err := volumehelper.WaitUntilTimeout(2*time.Minute, execFunc, timeoutFunc); err != nil {
357357
var helpLinkMsg string
358358
if d.appendMountErrorHelpLink {
359359
helpLinkMsg = "\nPlease refer to http://aka.ms/blobmounterror for possible causes and solutions for mount errors."

pkg/util/util.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,8 +395,8 @@ type ExecFunc func() (err error)
395395
// TimeoutFunc returns output and error if an ExecFunc timeout
396396
type TimeoutFunc func() (err error)
397397

398-
// WaitForExecCompletion waits for the exec function to complete or return timeout error
399-
func WaitForExecCompletion(timeout time.Duration, execFunc ExecFunc, timeoutFunc TimeoutFunc) error {
398+
// WaitUntilTimeout waits for the exec function to complete or return timeout error
399+
func WaitUntilTimeout(timeout time.Duration, execFunc ExecFunc, timeoutFunc TimeoutFunc) error {
400400
// Create a channel to receive the result of the azcopy exec function
401401
done := make(chan bool)
402402
var err error

pkg/util/util_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ func TestSetVolumeOwnership(t *testing.T) {
657657
}
658658
}
659659

660-
func TestWaitForExecCompletion(t *testing.T) {
660+
func TestWaitUntilTimeout(t *testing.T) {
661661
tests := []struct {
662662
desc string
663663
timeout time.Duration
@@ -702,7 +702,7 @@ func TestWaitForExecCompletion(t *testing.T) {
702702
}
703703

704704
for _, test := range tests {
705-
err := WaitForExecCompletion(test.timeout, test.execFunc, test.timeoutFunc)
705+
err := WaitUntilTimeout(test.timeout, test.execFunc, test.timeoutFunc)
706706
if err != nil && (err.Error() != test.expectedErr.Error()) {
707707
t.Errorf("unexpected error: %v, expected error: %v", err, test.expectedErr)
708708
}

0 commit comments

Comments
 (0)