From d20bd165a922760af87c476cf40e5a3d29bc8c19 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Wed, 5 Jun 2024 13:10:16 +0800 Subject: [PATCH] Skip parallel files upload and download test for Restic case. Signed-off-by: Xun Jiang --- test/e2e/test/test.go | 22 ++++++++++++++++------ test/types.go | 2 ++ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/test/e2e/test/test.go b/test/e2e/test/test.go index 9f64f3b1f4..66b6621838 100644 --- a/test/e2e/test/test.go +++ b/test/e2e/test/test.go @@ -19,7 +19,7 @@ package test import ( "context" "fmt" - "math/rand" + "math/rand/v2" "strings" "time" @@ -105,8 +105,7 @@ func (t *TestCase) Init() error { } func (t *TestCase) GenerateUUID() string { - rand.Seed(time.Now().UnixNano()) - return fmt.Sprintf("%08d", rand.Intn(100000000)) + return fmt.Sprintf("%08d", rand.IntN(100000000)) } func (t *TestCase) CreateResources() error { @@ -168,9 +167,16 @@ func (t *TestCase) Verify() error { func (t *TestCase) Start() error { t.Ctx, t.CtxCancel = context.WithTimeout(context.Background(), 1*time.Hour) veleroCfg := t.GetTestCase().VeleroCfg - if (veleroCfg.CloudProvider == Azure || veleroCfg.CloudProvider == AWS) && strings.Contains(t.GetTestCase().CaseBaseName, "nodeport") { + + if (veleroCfg.CloudProvider == Azure || veleroCfg.CloudProvider == AWS) && + strings.Contains(t.GetTestCase().CaseBaseName, "nodeport") { Skip("Skip due to issue https://github.com/kubernetes/kubernetes/issues/114384 on AKS") } + + if veleroCfg.UploaderType == UploaderTypeRestic && + strings.Contains(t.GetTestCase().CaseBaseName, "ParallelFiles") { + Skip("Skip Parallel Files upload and download test cases for environments using Restic as uploader.") + } return nil } @@ -178,11 +184,15 @@ func (t *TestCase) Clean() error { veleroCfg := t.GetTestCase().VeleroCfg if !veleroCfg.Debug { By(fmt.Sprintf("Clean namespace with prefix %s after test", t.CaseBaseName), func() { - CleanupNamespaces(t.Ctx, t.Client, t.CaseBaseName) + if err := CleanupNamespaces(t.Ctx, t.Client, t.CaseBaseName); err != nil { + fmt.Println("Fail to cleanup namespaces: ", err) + } }) By("Clean backups after test", func() { veleroCfg.ClientToInstallVelero = &t.Client - DeleteAllBackups(t.Ctx, &veleroCfg) + if err := DeleteAllBackups(t.Ctx, &veleroCfg); err != nil { + fmt.Println("Fail to clean backups after test: ", err) + } }) } return nil diff --git a/test/types.go b/test/types.go index 6ba28b549b..7b9eb5a537 100644 --- a/test/types.go +++ b/test/types.go @@ -38,6 +38,8 @@ const AWS = "aws" const Gcp = "gcp" const Vsphere = "vsphere" +const UploaderTypeRestic = "restic" + var PublicCloudProviders = []string{AWS, Azure, Gcp, Vsphere} var LocalCloudProviders = []string{Kind, VanillaZFS} var CloudProviders = append(PublicCloudProviders, LocalCloudProviders...)