mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-08 14:21:18 +00:00
fix-ctx-issue
1. Fix issue of kubectl client and server mismatch version in GitAction E2E job, refer to https://github.com/elastic/cloud-on-k8s/issues/4737; 2. Adapt to the changing of keyword for involing Kpoia as fs backupper, new installtion breaked upgrade and migration tests; 3. Accept multi-labels of Ginkgo focus as input of E2E make command; 4. Distinguish workload namespace from each tests; 5. Fix issues of not using Velero util to perform Velero commands; 6. Add snapshot test case for NamespaceMapping E2E test; 7. Collect debug bundle after catching error of Velero backup or restore command; Signed-off-by: danfengl <danfengl@vmware.com>
This commit is contained in:
@@ -21,17 +21,24 @@ type NamespaceMapping struct {
|
||||
kibishiiData *KibishiiData
|
||||
}
|
||||
|
||||
var OneNamespaceMappingTest func() = TestFunc(&NamespaceMapping{TestCase: TestCase{NSBaseName: "ns", NSIncluded: &[]string{"ns1"}}})
|
||||
var MultiNamespacesMappingTest func() = TestFunc(&NamespaceMapping{TestCase: TestCase{NSBaseName: "ns", NSIncluded: &[]string{"ns1", "ns2"}}})
|
||||
const NamespaceBaseName string = "ns-mp-"
|
||||
|
||||
var OneNamespaceMappingResticTest func() = TestFunc(&NamespaceMapping{TestCase: TestCase{NSBaseName: NamespaceBaseName, NSIncluded: &[]string{NamespaceBaseName + "1"}, UseVolumeSnapshots: false}})
|
||||
var MultiNamespacesMappingResticTest func() = TestFunc(&NamespaceMapping{TestCase: TestCase{NSBaseName: NamespaceBaseName, NSIncluded: &[]string{NamespaceBaseName + "1", NamespaceBaseName + "2"}, UseVolumeSnapshots: false}})
|
||||
var OneNamespaceMappingSnapshotTest func() = TestFunc(&NamespaceMapping{TestCase: TestCase{NSBaseName: NamespaceBaseName, NSIncluded: &[]string{NamespaceBaseName + "1"}, UseVolumeSnapshots: true}})
|
||||
var MultiNamespacesMappingSnapshotTest func() = TestFunc(&NamespaceMapping{TestCase: TestCase{NSBaseName: NamespaceBaseName, NSIncluded: &[]string{NamespaceBaseName + "1", NamespaceBaseName + "2"}, UseVolumeSnapshots: true}})
|
||||
|
||||
func (n *NamespaceMapping) Init() error {
|
||||
n.Client = TestClientInstance
|
||||
n.kibishiiData = &KibishiiData{2, 10, 10, 1024, 1024, 0, 2}
|
||||
|
||||
backupType := "restic"
|
||||
if n.UseVolumeSnapshots {
|
||||
backupType = "snapshot"
|
||||
}
|
||||
n.TestMsg = &TestMSG{
|
||||
Desc: "Backup resources with include namespace test",
|
||||
FailedMSG: "Failed to backup with namespace include",
|
||||
Text: fmt.Sprintf("should backup namespaces %s", *n.NSIncluded),
|
||||
Desc: fmt.Sprintf("Restore namespace %s with namespace mapping by %s test", *n.NSIncluded, backupType),
|
||||
FailedMSG: "Failed to restore with namespace mapping",
|
||||
Text: fmt.Sprintf("should restore namespace %s with namespace mapping by %s", *n.NSIncluded, backupType),
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -49,15 +56,20 @@ func (n *NamespaceMapping) StartRun() error {
|
||||
n.BackupName = n.BackupName + ns
|
||||
n.RestoreName = n.RestoreName + ns
|
||||
}
|
||||
n.BackupName = n.BackupName + "backup-ns-mapping-" + UUIDgen.String()
|
||||
n.RestoreName = n.RestoreName + "restore-ns-mapping-" + UUIDgen.String()
|
||||
n.BackupName = n.BackupName + UUIDgen.String()
|
||||
n.RestoreName = n.RestoreName + UUIDgen.String()
|
||||
|
||||
n.MappedNamespaceList = mappedNSList
|
||||
fmt.Println(mappedNSList)
|
||||
n.BackupArgs = []string{
|
||||
"create", "--namespace", VeleroCfg.VeleroNamespace, "backup", n.BackupName,
|
||||
"--include-namespaces", strings.Join(*n.NSIncluded, ","),
|
||||
"--default-volumes-to-fs-backup", "--wait",
|
||||
"--include-namespaces", strings.Join(*n.NSIncluded, ","), "--wait",
|
||||
}
|
||||
if n.UseVolumeSnapshots {
|
||||
n.BackupArgs = append(n.BackupArgs, "--snapshot-volumes")
|
||||
} else {
|
||||
n.BackupArgs = append(n.BackupArgs, "--snapshot-volumes=false")
|
||||
n.BackupArgs = append(n.BackupArgs, "--default-volumes-to-fs-backup")
|
||||
}
|
||||
n.RestoreArgs = []string{
|
||||
"create", "--namespace", VeleroCfg.VeleroNamespace, "restore", n.RestoreName,
|
||||
|
||||
Reference in New Issue
Block a user