Skip to content

Commit

Permalink
Update velero 1.12 and fix tests (#189)
Browse files Browse the repository at this point in the history
* update to velero 1.12

Signed-off-by: Michael Henriksen <[email protected]>

* update tests to pass on velero 1.12

Signed-off-by: Michael Henriksen <[email protected]>

---------

Signed-off-by: Michael Henriksen <[email protected]>
  • Loading branch information
mhenriks authored Oct 10, 2023
1 parent bacfcd5 commit 7819552
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 19 deletions.
2 changes: 1 addition & 1 deletion hack/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ DEPLOYMENT_TIMEOUT=600
USE_CSI=${USE_CSI:-1}
USE_RESTIC=${USE_RESTIC:-0}
CSI_PLUGIN=${CSI_PLUGIN:-velero/velero-plugin-for-csi:v0.5.1}
VELERO_VERSION=${VELERO_VERSION:-v1.11.1}
VELERO_VERSION=${VELERO_VERSION:-v1.12.0}
VELERO_DIR=_output/velero/bin

source cluster-up/hack/config.sh
Expand Down
3 changes: 2 additions & 1 deletion tests/framework/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,10 @@ func CreateBackupForNamespaceExcludeResources(ctx context.Context, backupName, n
return nil
}

func CreateBackupForSelector(ctx context.Context, backupName, selector, snapshotLocation string, backupNamespace string, wait bool) error {
func CreateBackupForSelector(ctx context.Context, backupName, selector, includedNamespace, snapshotLocation, backupNamespace string, wait bool) error {
args := []string{
"create", "backup", backupName,
"--include-namespaces", includedNamespace,
"--selector", selector,
"--namespace", backupNamespace,
}
Expand Down
34 changes: 22 additions & 12 deletions tests/resource_filtering_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1244,7 +1244,7 @@ var _ = Describe("Resource includes", func() {
framework.EventuallyDVWith(f.KvClient, f.Namespace.Name, otherDVName, 180, HaveSucceeded())

By("Crating backup test-backup")
err = framework.CreateBackupForSelector(timeout, backupName, "a.test.label=include", snapshotLocation, f.BackupNamespace, true)
err = framework.CreateBackupForSelector(timeout, backupName, "a.test.label=include", f.Namespace.Name, snapshotLocation, f.BackupNamespace, true)
Expect(err).ToNot(HaveOccurred())
err = framework.WaitForBackupPhase(timeout, backupName, f.BackupNamespace, velerov1api.BackupPhaseCompleted)
Expect(err).ToNot(HaveOccurred())
Expand Down Expand Up @@ -1289,7 +1289,7 @@ var _ = Describe("Resource includes", func() {
framework.EventuallyDVWith(f.KvClient, f.Namespace.Name, includedDVName, 180, HaveSucceeded())

By("Crating backup test-backup")
err = framework.CreateBackupForSelector(timeout, backupName, "a.test.label=include", snapshotLocation, f.BackupNamespace, true)
err = framework.CreateBackupForSelector(timeout, backupName, "a.test.label=include", f.Namespace.Name, snapshotLocation, f.BackupNamespace, true)
Expect(err).ToNot(HaveOccurred())
err = framework.WaitForBackupPhase(timeout, backupName, f.BackupNamespace, velerov1api.BackupPhaseCompleted)
Expect(err).ToNot(HaveOccurred())
Expand All @@ -1299,14 +1299,16 @@ var _ = Describe("Resource includes", func() {
Expect(err).ToNot(HaveOccurred())
Expect(backup.Status.Progress.ItemsBackedUp).To(Equal(backup.Status.Progress.TotalItems))

// The backup should contains the following 6 items:
// The backup should contains the following 8 items:
// - DataVolume CRD
// - DataVolume
// - PVC
// - PV
// - VolumeSnapshot
// - VolumeSnapshotContent
// - VolumeSpapshotClass
expectedItems := 6
// - Namespace
expectedItems := 8
if framework.IsDataVolumeGC(f.KvClient) {
expectedItems -= 1
}
Expand Down Expand Up @@ -1359,7 +1361,7 @@ var _ = Describe("Resource includes", func() {
Expect(err).ToNot(HaveOccurred())

By("Creating backup")
err = framework.CreateBackupForSelector(timeout, backupName, "a.test.label=included", snapshotLocation, f.BackupNamespace, true)
err = framework.CreateBackupForSelector(timeout, backupName, "a.test.label=included", f.Namespace.Name, snapshotLocation, f.BackupNamespace, true)
Expect(err).ToNot(HaveOccurred())

err = framework.WaitForBackupPhase(timeout, backupName, f.BackupNamespace, velerov1api.BackupPhaseCompleted)
Expand All @@ -1378,7 +1380,9 @@ var _ = Describe("Resource includes", func() {
// - 2 VolumeSnapshot
// - 2 VolumeSnapshotContent
// - VolumeSpapshotClass
expectedItems := 12
// - DataVolume CRD
// - Namespace
expectedItems := 14
if framework.IsDataVolumeGC(f.KvClient) {
expectedItems -= 2
}
Expand All @@ -1403,7 +1407,7 @@ var _ = Describe("Resource includes", func() {
framework.EventuallyDVWith(f.KvClient, f.Namespace.Name, vmSpec.Spec.DataVolumeTemplates[0].Name, 180, HaveSucceeded())

By("Creating backup")
err = framework.CreateBackupForSelector(timeout, backupName, "a.test.label=included", snapshotLocation, f.BackupNamespace, true)
err = framework.CreateBackupForSelector(timeout, backupName, "a.test.label=included", f.Namespace.Name, snapshotLocation, f.BackupNamespace, true)
Expect(err).ToNot(HaveOccurred())
err = framework.WaitForBackupPhase(timeout, backupName, f.BackupNamespace, velerov1api.BackupPhaseCompleted)
Expect(err).ToNot(HaveOccurred())
Expand All @@ -1421,7 +1425,9 @@ var _ = Describe("Resource includes", func() {
// - VolumeSnapshot
// - VolumeSnapshotContent
// - VolumeSpapshotClass
expectedItems := 7
// - DataVolume CRD
// - Namespace
expectedItems := 9
if framework.IsDataVolumeGC(f.KvClient) {
expectedItems -= 1
}
Expand Down Expand Up @@ -1449,7 +1455,7 @@ var _ = Describe("Resource includes", func() {
Expect(ok).To(BeTrue(), "VirtualMachineInstanceAgentConnected should be true")

By("Creating backup")
err = framework.CreateBackupForSelector(timeout, backupName, "a.test.label=included", snapshotLocation, f.BackupNamespace, true)
err = framework.CreateBackupForSelector(timeout, backupName, "a.test.label=included", f.Namespace.Name, snapshotLocation, f.BackupNamespace, true)
Expect(err).ToNot(HaveOccurred())
err = framework.WaitForBackupPhase(timeout, backupName, f.BackupNamespace, velerov1api.BackupPhaseCompleted)
Expect(err).ToNot(HaveOccurred())
Expand All @@ -1469,7 +1475,9 @@ var _ = Describe("Resource includes", func() {
// - VolumeSnapshot
// - VolumeSnapshotContent
// - VolumeSpapshotClass
expectedItems := 9
// - DataVolume CRD
// - Namespace
expectedItems := 11
if framework.IsDataVolumeGC(f.KvClient) {
expectedItems -= 1
}
Expand Down Expand Up @@ -1513,7 +1521,7 @@ var _ = Describe("Resource includes", func() {
Expect(ok).To(BeTrue(), "VirtualMachineInstanceAgentConnected should be true")

By("Creating backup")
err = framework.CreateBackupForSelector(timeout, backupName, "a.test.label=included", snapshotLocation, f.BackupNamespace, true)
err = framework.CreateBackupForSelector(timeout, backupName, "a.test.label=included", f.Namespace.Name, snapshotLocation, f.BackupNamespace, true)
Expect(err).ToNot(HaveOccurred())
err = framework.WaitForBackupPhase(timeout, backupName, f.BackupNamespace, velerov1api.BackupPhaseCompleted)
Expect(err).ToNot(HaveOccurred())
Expand All @@ -1536,7 +1544,9 @@ var _ = Describe("Resource includes", func() {
// - VolumeSnapshot (PVC)
// - VolumeSnapshotContent (PVC)
// - VolumeSpapshotClass
expectedItems := 12
// - DataVolume CRD
// - Namespace
expectedItems := 14
if framework.IsDataVolumeGC(f.KvClient) {
expectedItems -= 1
}
Expand Down
10 changes: 5 additions & 5 deletions tests/vm_backup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ var _ = Describe("[smoke] VM Backup", func() {
}, 2*time.Minute, 2*time.Second).Should(Succeed())

By("Creating backup")
err = framework.CreateBackupForSelector(timeout, backupName, "a.test.label=included", snapshotLocation, f.BackupNamespace, true)
err = framework.CreateBackupForSelector(timeout, backupName, "a.test.label=included", f.Namespace.Name, snapshotLocation, f.BackupNamespace, true)
Expect(err).ToNot(HaveOccurred())
err = framework.WaitForBackupPhase(timeout, backupName, f.BackupNamespace, velerov1api.BackupPhaseCompleted)
Expect(err).ToNot(HaveOccurred())
Expand Down Expand Up @@ -286,7 +286,7 @@ var _ = Describe("[smoke] VM Backup", func() {
Expect(err).ToNot(HaveOccurred())

By("Creating backup")
err = framework.CreateBackupForSelector(timeout, backupName, "a.test.label=included", snapshotLocation, f.BackupNamespace, true)
err = framework.CreateBackupForSelector(timeout, backupName, "a.test.label=included", f.Namespace.Name, snapshotLocation, f.BackupNamespace, true)
Expect(err).ToNot(HaveOccurred())
err = framework.WaitForBackupPhase(timeout, backupName, f.BackupNamespace, velerov1api.BackupPhaseCompleted)
Expect(err).ToNot(HaveOccurred())
Expand Down Expand Up @@ -334,7 +334,7 @@ var _ = Describe("[smoke] VM Backup", func() {
Expect(err).ToNot(HaveOccurred())

By("Creating backup")
err = framework.CreateBackupForSelector(timeout, backupName, "a.test.label=included", snapshotLocation, f.BackupNamespace, true)
err = framework.CreateBackupForSelector(timeout, backupName, "a.test.label=included", f.Namespace.Name, snapshotLocation, f.BackupNamespace, true)
Expect(err).ToNot(HaveOccurred())
err = framework.WaitForBackupPhase(timeout, backupName, f.BackupNamespace, velerov1api.BackupPhaseCompleted)
Expect(err).ToNot(HaveOccurred())
Expand Down Expand Up @@ -391,7 +391,7 @@ var _ = Describe("[smoke] VM Backup", func() {
Expect(ok).To(BeTrue())

By("Creating backup")
err = framework.CreateBackupForSelector(timeout, backupName, "a.test.label=included", snapshotLocation, f.BackupNamespace, true)
err = framework.CreateBackupForSelector(timeout, backupName, "a.test.label=included", f.Namespace.Name, snapshotLocation, f.BackupNamespace, true)
Expect(err).ToNot(HaveOccurred())
err = framework.WaitForBackupPhase(timeout, backupName, f.BackupNamespace, velerov1api.BackupPhaseCompleted)
Expect(err).ToNot(HaveOccurred())
Expand Down Expand Up @@ -441,7 +441,7 @@ var _ = Describe("[smoke] VM Backup", func() {
hotplugVolName := addVolumeAndVerify(f.KvClient, vm, dvName)

By("Creating backup")
err = framework.CreateBackupForSelector(timeout, backupName, "a.test.label=included", snapshotLocation, f.BackupNamespace, true)
err = framework.CreateBackupForSelector(timeout, backupName, "a.test.label=included", f.Namespace.Name, snapshotLocation, f.BackupNamespace, true)
Expect(err).ToNot(HaveOccurred())
err = framework.WaitForBackupPhase(timeout, backupName, f.BackupNamespace, velerov1api.BackupPhaseCompleted)
Expect(err).ToNot(HaveOccurred())
Expand Down

0 comments on commit 7819552

Please sign in to comment.