Skip to content

Commit

Permalink
Merge pull request #7590 from danfengliu/add-vsc-checkpoint-for-migra…
Browse files Browse the repository at this point in the history
…tion-test

Add checkpoint of VSC for data movement migration test
  • Loading branch information
danfengliu authored Apr 29, 2024
2 parents 6f7807c + 82fc557 commit a798182
Show file tree
Hide file tree
Showing 34 changed files with 203 additions and 270 deletions.
2 changes: 1 addition & 1 deletion test/e2e/backups/ttl.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func TTLTest() {
fmt.Sprintf("Failed to delete namespace %s", BackupCfg.BackupName))
})

if veleroCfg.CloudProvider == Aws && useVolumeSnapshots {
if veleroCfg.CloudProvider == AWS && useVolumeSnapshots {
fmt.Println("Waiting 7 minutes to make sure the snapshots are ready...")
time.Sleep(7 * time.Minute)
}
Expand Down
42 changes: 20 additions & 22 deletions test/e2e/basic/backup-volume-info/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ limitations under the License.
package basic

import (
"context"
"fmt"
"strconv"
"strings"
Expand Down Expand Up @@ -45,26 +44,6 @@ type BackupVolumeInfo struct {

func (v *BackupVolumeInfo) Init() error {
v.TestCase.Init()

BeforeEach(func() {
if v.VeleroCfg.CloudProvider == Vsphere && (!strings.Contains(v.CaseBaseName, "fs-upload") && !strings.Contains(v.CaseBaseName, "skipped")) {
fmt.Printf("Skip snapshot case %s for vsphere environment.\n", v.CaseBaseName)
Skip("Skip snapshot case due to vsphere environment doesn't cover the CSI test, and it doesn't have a Velero native snapshot plugin.")
}

if strings.Contains(v.VeleroCfg.Features, FeatureCSI) {
if strings.Contains(v.CaseBaseName, "native-snapshot") {
fmt.Printf("Skip native snapshot case %s when the CSI feature is enabled.\n", v.CaseBaseName)
Skip("Skip native snapshot case due to CSI feature is enabled.")
}
} else {
if strings.Contains(v.CaseBaseName, "csi") {
fmt.Printf("Skip CSI related case %s when the CSI feature is not enabled.\n", v.CaseBaseName)
Skip("Skip CSI cases due to CSI feature is not enabled.")
}
}
})

v.CaseBaseName = v.CaseBaseName + v.UUIDgen
v.BackupName = "backup-" + v.CaseBaseName
v.RestoreName = "restore-" + v.CaseBaseName
Expand Down Expand Up @@ -98,8 +77,27 @@ func (v *BackupVolumeInfo) Init() error {
return nil
}

func (v *BackupVolumeInfo) Start() error {
if v.VeleroCfg.CloudProvider == Vsphere && (!strings.Contains(v.CaseBaseName, "fs-upload") && !strings.Contains(v.CaseBaseName, "skipped")) {
fmt.Printf("Skip snapshot case %s for vsphere environment.\n", v.CaseBaseName)
Skip("Skip snapshot case due to vsphere environment doesn't cover the CSI test, and it doesn't have a Velero native snapshot plugin.")
}

if strings.Contains(v.VeleroCfg.Features, FeatureCSI) {
if strings.Contains(v.CaseBaseName, "native-snapshot") {
fmt.Printf("Skip native snapshot case %s when the CSI feature is enabled.\n", v.CaseBaseName)
Skip("Skip native snapshot case due to CSI feature is enabled.")
}
} else {
if strings.Contains(v.CaseBaseName, "csi") {
fmt.Printf("Skip CSI related case %s when the CSI feature is not enabled.\n", v.CaseBaseName)
Skip("Skip CSI cases due to CSI feature is not enabled.")
}
}
v.TestCase.Start()
return nil
}
func (v *BackupVolumeInfo) CreateResources() error {
v.Ctx, v.CtxCancel = context.WithTimeout(context.Background(), v.TimeoutDuration)
labels := map[string]string{
"volume-info": "true",
}
Expand Down
5 changes: 3 additions & 2 deletions test/e2e/basic/backup-volume-info/native_snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ var NativeSnapshotVolumeInfoTest func() = TestFunc(&NativeSnapshotVolumeInfo{
BackupVolumeInfo{
SnapshotVolumes: true,
TestCase: TestCase{
CaseBaseName: "native-snapshot-volumeinfo",
UseVolumeSnapshots: true,
CaseBaseName: "native-snapshot-volumeinfo",
TestMsg: &TestMSG{
Desc: "Test backup's VolumeInfo metadata content for native snapshot case.",
Text: "The VolumeInfo should be generated, and the NativeSnapshotInfo structure should not be nil.",
Expand All @@ -54,7 +55,7 @@ func (n *NativeSnapshotVolumeInfo) Verify() error {
BackupObjectsPrefix+"/"+n.BackupName,
)

Expect(err).ShouldNot(HaveOccurred(), fmt.Sprintf("Fail to get VolumeInfo metadata in the Backup Repository."))
Expect(err).ShouldNot(HaveOccurred(), "Fail to get VolumeInfo metadata in the Backup Repository.")

fmt.Printf("The VolumeInfo metadata content: %+v\n", *volumeInfo[0])
Expect(len(volumeInfo) > 0).To(BeIdenticalTo(true))
Expand Down
2 changes: 0 additions & 2 deletions test/e2e/basic/namespace-mapping.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"fmt"
"strings"
"time"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
Expand Down Expand Up @@ -86,7 +85,6 @@ func (n *NamespaceMapping) Init() error {
}

func (n *NamespaceMapping) CreateResources() error {
n.Ctx, n.CtxCancel = context.WithTimeout(context.Background(), 60*time.Minute)
for index, ns := range *n.NSIncluded {
n.kibishiiData.Levels = len(*n.NSIncluded) + index
By(fmt.Sprintf("Creating namespaces ...%s\n", ns), func() {
Expand Down
4 changes: 1 addition & 3 deletions test/e2e/basic/nodeport.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"fmt"
"strings"
"time"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
Expand Down Expand Up @@ -61,9 +60,8 @@ func (n *NodePort) Init() error {
}
return nil
}
func (n *NodePort) CreateResources() error {
n.Ctx, n.CtxCancel = context.WithTimeout(context.Background(), 60*time.Minute)

func (n *NodePort) CreateResources() error {
for _, ns := range *n.NSIncluded {
By(fmt.Sprintf("Creating service %s in namespaces %s ......\n", n.serviceName, ns), func() {
Expect(CreateNamespace(n.Ctx, n.Client, ns)).To(Succeed(), fmt.Sprintf("Failed to create namespace %s", ns))
Expand Down
2 changes: 0 additions & 2 deletions test/e2e/basic/pvc-selected-node-changing.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package basic
import (
"context"
"fmt"
"time"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
Expand Down Expand Up @@ -64,7 +63,6 @@ func (p *PVCSelectedNodeChanging) Init() error {
}

func (p *PVCSelectedNodeChanging) CreateResources() error {
p.Ctx, p.CtxCancel = context.WithTimeout(context.Background(), 60*time.Minute)
By(fmt.Sprintf("Create namespace %s", p.namespace), func() {
Expect(CreateNamespace(p.Ctx, p.Client, p.namespace)).To(Succeed(),
fmt.Sprintf("Failed to create namespace %s", p.namespace))
Expand Down
1 change: 0 additions & 1 deletion test/e2e/basic/resources-check/namespaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ func (m *MultiNSBackup) Init() error {
}

func (m *MultiNSBackup) CreateResources() error {
m.Ctx, m.CtxCancel = context.WithTimeout(context.Background(), m.TimeoutDuration)
fmt.Printf("Creating namespaces ...\n")
labels := map[string]string{
"ns-test": "true",
Expand Down
3 changes: 0 additions & 3 deletions test/e2e/basic/resources-check/namespaces_annotation.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@ limitations under the License.
package basic

import (
"context"
"fmt"
"strings"
"time"

"github.com/pkg/errors"

Expand Down Expand Up @@ -63,7 +61,6 @@ func (n *NSAnnotationCase) Init() error {
}

func (n *NSAnnotationCase) CreateResources() error {
n.Ctx, n.CtxCancel = context.WithTimeout(context.Background(), 60*time.Minute)
for nsNum := 0; nsNum < n.NamespacesTotal; nsNum++ {
createNSName := fmt.Sprintf("%s-%00000d", n.CaseBaseName, nsNum)
createAnnotationName := fmt.Sprintf("annotation-%s-%00000d", n.CaseBaseName, nsNum)
Expand Down
3 changes: 0 additions & 3 deletions test/e2e/basic/resources-check/rbac.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ limitations under the License.
package basic

import (
"context"
"fmt"
"strings"
"time"

"github.com/pkg/errors"

Expand Down Expand Up @@ -79,7 +77,6 @@ func (r *RBACCase) Init() error {
}

func (r *RBACCase) CreateResources() error {
r.Ctx, r.CtxCancel = context.WithTimeout(context.Background(), 10*time.Minute)
for nsNum := 0; nsNum < r.NamespacesTotal; nsNum++ {
createNSName := fmt.Sprintf("%s-%00000d", r.CaseBaseName, nsNum)
fmt.Printf("Creating namespaces ...%s\n", createNSName)
Expand Down
3 changes: 1 addition & 2 deletions test/e2e/basic/storage-class-changing.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package basic
import (
"context"
"fmt"
"time"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
Expand Down Expand Up @@ -67,11 +66,11 @@ func (s *StorageClasssChanging) Init() error {
}
return nil
}

func (s *StorageClasssChanging) CreateResources() error {
label := map[string]string{
"app": "test",
}
s.Ctx, s.CtxCancel = context.WithTimeout(context.Background(), 10*time.Minute)

By(("Installing storage class..."), func() {
Expect(InstallTestStorageClasses(fmt.Sprintf("../testdata/storage-class/%s.yaml", s.VeleroCfg.CloudProvider))).To(Succeed(), "Failed to install storage class")
Expand Down
Loading

0 comments on commit a798182

Please sign in to comment.