Skip to content

Commit

Permalink
Merge pull request #7860 from blackpiglet/update_e2e_for_1_14
Browse files Browse the repository at this point in the history
Skip parallel files upload and download test for Restic case
  • Loading branch information
Lyndon-Li authored Jun 13, 2024
2 parents 0d36572 + 200f16e commit 2fc6300
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
22 changes: 16 additions & 6 deletions test/e2e/test/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package test
import (
"context"
"fmt"
"math/rand"
"math/rand/v2"
"strings"
"time"

Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -168,21 +167,32 @@ 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
}

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
Expand Down
2 changes: 2 additions & 0 deletions test/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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...)
Expand Down

0 comments on commit 2fc6300

Please sign in to comment.