From 27f3a6d8d83964520fe57cf2c98696e4577c01c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wenkai=20Yin=28=E5=B0=B9=E6=96=87=E5=BC=80=29?= Date: Wed, 10 Nov 2021 09:13:30 +0800 Subject: [PATCH] Check the failed phases either when uploading the snapshot in E2E testing (#4162) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the snapshot uploading is failed, it should not be treat as completed and continue. This commit covers both the phases of in progress and failed when uploading snapshot with vSphere plugin Signed-off-by: Wenkai Yin(尹文开) --- test/e2e/velero_utils.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/e2e/velero_utils.go b/test/e2e/velero_utils.go index d60d2bb65..7e8a8bb6a 100644 --- a/test/e2e/velero_utils.go +++ b/test/e2e/velero_utils.go @@ -449,11 +449,12 @@ func waitForVSphereUploadCompletion(ctx context.Context, timeout time.Duration, // Canceled - the operation was canceled, the snapshot ID is not valid if len(comps) == 2 { phase := comps[1] - if phase == "New" || - phase == "InProgress" || - phase == "Snapshotted" || - phase == "Uploading" { + switch phase { + case "Uploaded": + case "New", "InProgress", "Snapshotted", "Uploading": complete = false + default: + return false, fmt.Errorf("unexpected snapshot phase: %s", phase) } } }