Skip to content

Commit af5ade5

Browse files
authored
Replace vel with dpaCR, rename velero_ to dpa_ (#549)
1 parent b2a7de5 commit af5ade5

File tree

5 files changed

+49
-49
lines changed

5 files changed

+49
-49
lines changed

tests/e2e/backup_restore_suite_test.go

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ type VerificationFunction func(client.Client, string) error
1818
var _ = Describe("AWS backup restore tests", func() {
1919
var _ = BeforeEach(func() {
2020
testSuiteInstanceName := "ts-" + instanceName
21-
vel.Name = testSuiteInstanceName
21+
dpaCR.Name = testSuiteInstanceName
2222

2323
credData, err := readFile(cloud)
2424
Expect(err).NotTo(HaveOccurred())
@@ -27,7 +27,7 @@ var _ = Describe("AWS backup restore tests", func() {
2727
})
2828

2929
var _ = AfterEach(func() {
30-
err := vel.Delete()
30+
err := dpaCR.Delete()
3131
Expect(err).ToNot(HaveOccurred())
3232

3333
})
@@ -64,10 +64,10 @@ var _ = Describe("AWS backup restore tests", func() {
6464
DescribeTable("backup and restore applications",
6565
func(brCase BackupRestoreCase, expectedErr error) {
6666

67-
err := vel.Build(brCase.BackupRestoreType)
67+
err := dpaCR.Build(brCase.BackupRestoreType)
6868
Expect(err).NotTo(HaveOccurred())
6969

70-
err = vel.CreateOrUpdate(&vel.CustomResource.Spec)
70+
err = dpaCR.CreateOrUpdate(&dpaCR.CustomResource.Spec)
7171
Expect(err).NotTo(HaveOccurred())
7272

7373
log.Printf("Waiting for velero pod to be running")
@@ -81,14 +81,14 @@ var _ = Describe("AWS backup restore tests", func() {
8181
if brCase.BackupRestoreType == csi {
8282
if clusterProfile == "aws" {
8383
log.Printf("Creating VolumeSnapshot for CSI backuprestore of %s", brCase.Name)
84-
err = installApplication(vel.Client, "./sample-applications/gp2-csi/volumeSnapshotClass.yaml")
84+
err = installApplication(dpaCR.Client, "./sample-applications/gp2-csi/volumeSnapshotClass.yaml")
8585
Expect(err).ToNot(HaveOccurred())
8686
} else {
8787
Skip("CSI testing is not provided for this cluster provider.")
8888
}
8989
}
9090

91-
if vel.CustomResource.Spec.BackupImages == nil || *vel.CustomResource.Spec.BackupImages {
91+
if dpaCR.CustomResource.Spec.BackupImages == nil || *dpaCR.CustomResource.Spec.BackupImages {
9292
log.Printf("Waiting for registry pods to be running")
9393
Eventually(areRegistryDeploymentsAvailable(namespace), timeoutMultiplier*time.Minute*3, time.Second*5).Should(BeTrue())
9494
}
@@ -102,48 +102,48 @@ var _ = Describe("AWS backup restore tests", func() {
102102

103103
// install app
104104
log.Printf("Installing application for case %s", brCase.Name)
105-
err = installApplication(vel.Client, brCase.ApplicationTemplate)
105+
err = installApplication(dpaCR.Client, brCase.ApplicationTemplate)
106106
Expect(err).ToNot(HaveOccurred())
107107
// wait for pods to be running
108108
Eventually(areApplicationPodsRunning(brCase.ApplicationNamespace), timeoutMultiplier*time.Minute*9, time.Second*5).Should(BeTrue())
109109

110110
// Run optional custom verification
111111
log.Printf("Running pre-backup function for case %s", brCase.Name)
112-
err = brCase.PreBackupVerify(vel.Client, brCase.ApplicationNamespace)
112+
err = brCase.PreBackupVerify(dpaCR.Client, brCase.ApplicationNamespace)
113113
Expect(err).ToNot(HaveOccurred())
114114

115115
// create backup
116116
log.Printf("Creating backup %s for case %s", backupName, brCase.Name)
117-
err = createBackupForNamespaces(vel.Client, namespace, backupName, []string{brCase.ApplicationNamespace})
117+
err = createBackupForNamespaces(dpaCR.Client, namespace, backupName, []string{brCase.ApplicationNamespace})
118118
Expect(err).ToNot(HaveOccurred())
119119

120120
// wait for backup to not be running
121-
Eventually(isBackupDone(vel.Client, namespace, backupName), timeoutMultiplier*time.Minute*4, time.Second*10).Should(BeTrue())
122-
Expect(getVeleroContainerFailureLogs(vel.Namespace)).To(Equal([]string{}))
121+
Eventually(isBackupDone(dpaCR.Client, namespace, backupName), timeoutMultiplier*time.Minute*4, time.Second*10).Should(BeTrue())
122+
Expect(getVeleroContainerFailureLogs(dpaCR.Namespace)).To(Equal([]string{}))
123123

124124
// check if backup succeeded
125-
succeeded, err := isBackupCompletedSuccessfully(vel.Client, namespace, backupName)
125+
succeeded, err := isBackupCompletedSuccessfully(dpaCR.Client, namespace, backupName)
126126
Expect(err).ToNot(HaveOccurred())
127127
Expect(succeeded).To(Equal(true))
128128
log.Printf("Backup for case %s succeeded", brCase.Name)
129129

130130
// uninstall app
131131
log.Printf("Uninstalling app for case %s", brCase.Name)
132-
err = uninstallApplication(vel.Client, brCase.ApplicationTemplate)
132+
err = uninstallApplication(dpaCR.Client, brCase.ApplicationTemplate)
133133
Expect(err).ToNot(HaveOccurred())
134134

135135
// Wait for namespace to be deleted
136136
Eventually(isNamespaceDeleted(brCase.ApplicationNamespace), timeoutMultiplier*time.Minute*2, time.Second*5).Should(BeTrue())
137137

138138
// run restore
139139
log.Printf("Creating restore %s for case %s", restoreName, brCase.Name)
140-
err = createRestoreFromBackup(vel.Client, namespace, backupName, restoreName)
140+
err = createRestoreFromBackup(dpaCR.Client, namespace, backupName, restoreName)
141141
Expect(err).ToNot(HaveOccurred())
142-
Eventually(isRestoreDone(vel.Client, namespace, restoreName), timeoutMultiplier*time.Minute*4, time.Second*10).Should(BeTrue())
143-
Expect(getVeleroContainerFailureLogs(vel.Namespace)).To(Equal([]string{}))
142+
Eventually(isRestoreDone(dpaCR.Client, namespace, restoreName), timeoutMultiplier*time.Minute*4, time.Second*10).Should(BeTrue())
143+
Expect(getVeleroContainerFailureLogs(dpaCR.Namespace)).To(Equal([]string{}))
144144

145145
// Check if restore succeeded
146-
succeeded, err = isRestoreCompletedSuccessfully(vel.Client, namespace, restoreName)
146+
succeeded, err = isRestoreCompletedSuccessfully(dpaCR.Client, namespace, restoreName)
147147
Expect(err).ToNot(HaveOccurred())
148148
Expect(succeeded).To(Equal(true))
149149

@@ -152,20 +152,20 @@ var _ = Describe("AWS backup restore tests", func() {
152152

153153
// Run optional custom verification
154154
log.Printf("Running post-restore function for case %s", brCase.Name)
155-
err = brCase.PostRestoreVerify(vel.Client, brCase.ApplicationNamespace)
155+
err = brCase.PostRestoreVerify(dpaCR.Client, brCase.ApplicationNamespace)
156156
Expect(err).ToNot(HaveOccurred())
157157

158158
// Test is successful, clean up everything
159159
log.Printf("Uninstalling application for case %s", brCase.Name)
160-
err = uninstallApplication(vel.Client, brCase.ApplicationTemplate)
160+
err = uninstallApplication(dpaCR.Client, brCase.ApplicationTemplate)
161161
Expect(err).ToNot(HaveOccurred())
162162

163163
// Wait for namespace to be deleted
164164
Eventually(isNamespaceDeleted(brCase.ApplicationNamespace), timeoutMultiplier*time.Minute*2, time.Second*5).Should(BeTrue())
165165

166166
if brCase.BackupRestoreType == csi {
167167
log.Printf("Deleting VolumeSnapshot for CSI backuprestore of %s", brCase.Name)
168-
err = uninstallApplication(vel.Client, "./sample-applications/gp2-csi/volumeSnapshotClass.yaml")
168+
err = uninstallApplication(dpaCR.Client, "./sample-applications/gp2-csi/volumeSnapshotClass.yaml")
169169
Expect(err).ToNot(HaveOccurred())
170170
}
171171

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,25 +32,25 @@ var _ = Describe("Configuration testing for DPA Custom Resource", func() {
3232
DescribeTable("Updating custom resource with new configuration",
3333

3434
func(installCase InstallCase, expectedErr error) {
35-
//TODO: Calling vel.build() is the old pattern.
35+
//TODO: Calling dpaCR.build() is the old pattern.
3636
//Change it later to make sure all the spec values are passed for every test case,
3737
// instead of assigning the values in advance to the DPA CR
38-
err := vel.Build(installCase.BRestoreType)
38+
err := dpaCR.Build(installCase.BRestoreType)
3939
Expect(err).NotTo(HaveOccurred())
40-
err = vel.CreateOrUpdate(installCase.DpaSpec)
40+
err = dpaCR.CreateOrUpdate(installCase.DpaSpec)
4141
Expect(err).ToNot(HaveOccurred())
4242
if installCase.WantError {
4343
// Eventually()
4444
log.Printf("Test case expected to error. Waiting for the error to show in DPA Status")
45-
Eventually(vel.GetNoErr().Status.Conditions[0].Type, timeoutMultiplier*time.Minute*3, time.Second*5).Should(Equal("Reconciled"))
46-
Eventually(vel.GetNoErr().Status.Conditions[0].Status, timeoutMultiplier*time.Minute*3, time.Second*5).Should(Equal(metav1.ConditionFalse))
47-
Eventually(vel.GetNoErr().Status.Conditions[0].Reason, timeoutMultiplier*time.Minute*3, time.Second*5).Should(Equal("Error"))
48-
Eventually(vel.GetNoErr().Status.Conditions[0].Message, timeoutMultiplier*time.Minute*3, time.Second*5).Should(Equal(expectedErr.Error()))
45+
Eventually(dpaCR.GetNoErr().Status.Conditions[0].Type, timeoutMultiplier*time.Minute*3, time.Second*5).Should(Equal("Reconciled"))
46+
Eventually(dpaCR.GetNoErr().Status.Conditions[0].Status, timeoutMultiplier*time.Minute*3, time.Second*5).Should(Equal(metav1.ConditionFalse))
47+
Eventually(dpaCR.GetNoErr().Status.Conditions[0].Reason, timeoutMultiplier*time.Minute*3, time.Second*5).Should(Equal("Error"))
48+
Eventually(dpaCR.GetNoErr().Status.Conditions[0].Message, timeoutMultiplier*time.Minute*3, time.Second*5).Should(Equal(expectedErr.Error()))
4949
return
5050
}
5151
log.Printf("Waiting for velero pod to be running")
5252
Eventually(areVeleroPodsRunning(namespace), timeoutMultiplier*time.Minute*3, time.Second*5).Should(BeTrue())
53-
dpa, err := vel.Get()
53+
dpa, err := dpaCR.Get()
5454
Expect(err).NotTo(HaveOccurred())
5555
if len(dpa.Spec.BackupLocations) > 0 {
5656
log.Printf("Checking for bsl spec")

tests/e2e/e2e_suite_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func TestOADPE2E(t *testing.T) {
4242
RunSpecs(t, "OADP E2E Suite")
4343
}
4444

45-
var vel *dpaCustomResource
45+
var dpaCR *dpaCustomResource
4646

4747
var _ = BeforeSuite(func() {
4848
flag.Parse()
@@ -56,22 +56,22 @@ var _ = BeforeSuite(func() {
5656
err = createCredentialsSecret(credData, namespace, getSecretRef(credSecretRef))
5757
Expect(err).NotTo(HaveOccurred())
5858

59-
vel = &dpaCustomResource{
59+
dpaCR = &dpaCustomResource{
6060
Namespace: namespace,
6161
}
62-
vel.CustomResource = dpa
62+
dpaCR.CustomResource = dpa
6363
testSuiteInstanceName := "ts-" + instanceName
64-
vel.Name = testSuiteInstanceName
64+
dpaCR.Name = testSuiteInstanceName
6565

66-
vel.SetClient()
66+
dpaCR.SetClient()
6767
Expect(doesNamespaceExist(namespace)).Should(BeTrue())
6868
})
6969

7070
var _ = AfterSuite(func() {
7171
log.Printf("Deleting Velero CR")
7272
errs := deleteSecret(namespace, getSecretRef(credSecretRef))
7373
Expect(errs).ToNot(HaveOccurred())
74-
err := vel.Delete()
74+
err := dpaCR.Delete()
7575
Expect(err).ToNot(HaveOccurred())
76-
Eventually(vel.IsDeleted(), timeoutMultiplier*time.Minute*2, time.Second*5).Should(BeTrue())
76+
Eventually(dpaCR.IsDeleted(), timeoutMultiplier*time.Minute*2, time.Second*5).Should(BeTrue())
7777
})

tests/e2e/subscription_suite_test.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,18 @@ import (
1616

1717
var _ = Describe("Subscription Config Suite Test", func() {
1818
var _ = BeforeEach(func() {
19-
log.Printf("Building veleroSpec")
20-
err := vel.Build(csi)
19+
log.Printf("Building dpaSpec")
20+
err := dpaCR.Build(csi)
2121
Expect(err).NotTo(HaveOccurred())
2222
//also test restic
23-
vel.CustomResource.Spec.Configuration.Restic.Enable = pointer.BoolPtr(true)
23+
dpaCR.CustomResource.Spec.Configuration.Restic.Enable = pointer.BoolPtr(true)
2424

25-
err = vel.Delete()
25+
err = dpaCR.Delete()
2626
Expect(err).ToNot(HaveOccurred())
27-
Eventually(vel.IsDeleted(), timeoutMultiplier*time.Minute*2, time.Second*5).Should(BeTrue())
27+
Eventually(dpaCR.IsDeleted(), timeoutMultiplier*time.Minute*2, time.Second*5).Should(BeTrue())
2828

2929
testSuiteInstanceName := "ts-" + instanceName
30-
vel.Name = testSuiteInstanceName
30+
dpaCR.Name = testSuiteInstanceName
3131

3232
credData, err := readFile(cloud)
3333
Expect(err).NotTo(HaveOccurred())
@@ -37,7 +37,7 @@ var _ = Describe("Subscription Config Suite Test", func() {
3737
})
3838

3939
var _ = AfterEach(func() {
40-
err := vel.Delete()
40+
err := dpaCR.Delete()
4141
Expect(err).ToNot(HaveOccurred())
4242
})
4343
type SubscriptionConfigTestCase struct {
@@ -47,12 +47,12 @@ var _ = Describe("Subscription Config Suite Test", func() {
4747
DescribeTable("Proxy test table",
4848
func(testCase SubscriptionConfigTestCase) {
4949
log.Printf("Getting Operator Subscription")
50-
s, err := vel.getOperatorSubscription()
50+
s, err := dpaCR.getOperatorSubscription()
5151
Expect(err).To(BeNil())
5252
log.Printf("Setting test case subscription config")
5353
s.Spec.Config = &testCase.SubscriptionConfig
5454
log.Printf("Updating Subscription")
55-
err = vel.Client.Update(context.Background(), s.Subscription)
55+
err = dpaCR.Client.Update(context.Background(), s.Subscription)
5656
Expect(err).To(BeNil())
5757

5858
// get csv from installplan from subscription
@@ -63,11 +63,11 @@ var _ = Describe("Subscription Config Suite Test", func() {
6363
Eventually(s.csvIsReady, time.Minute*9).Should(BeTrue())
6464

6565
log.Printf("CreatingOrUpdate test Velero")
66-
err = vel.CreateOrUpdate(&vel.CustomResource.Spec)
66+
err = dpaCR.CreateOrUpdate(&dpaCR.CustomResource.Spec)
6767
Expect(err).NotTo(HaveOccurred())
6868

6969
log.Printf("Getting velero object")
70-
velero, err := vel.Get()
70+
velero, err := dpaCR.Get()
7171
Expect(err).NotTo(HaveOccurred())
7272
log.Printf("Waiting for velero pod to be running")
7373
Eventually(areVeleroPodsRunning(namespace), timeoutMultiplier*time.Minute*3, time.Second*5).Should(BeTrue())
@@ -85,12 +85,12 @@ var _ = Describe("Subscription Config Suite Test", func() {
8585
podList, err := getVeleroPods(namespace)
8686
Expect(err).NotTo(HaveOccurred())
8787
log.Printf("Getting pods containers env vars")
88-
bl := vel.CustomResource.Spec.BackupLocations[0]
88+
bl := dpaCR.CustomResource.Spec.BackupLocations[0]
8989
for _, podInfo := range podList.Items {
9090
// we care about pods that have labels control-plane=controller-manager, component=velero, "component": "oadp-" + bsl.Name + "-" + bsl.Spec.Provider + "-registry",
9191
if podInfo.Labels["control-plane"] == "controller-manager" ||
9292
podInfo.Labels["app.kubernetes.io/name"] == "velero" ||
93-
podInfo.Labels["component"] == "oadp-"+fmt.Sprintf("%s-%d", vel.Name, 1)+"-"+bl.Velero.Provider+"-registry" {
93+
podInfo.Labels["component"] == "oadp-"+fmt.Sprintf("%s-%d", dpaCR.Name, 1)+"-"+bl.Velero.Provider+"-registry" {
9494
log.Printf("Checking env vars are passed to each container in " + podInfo.Name)
9595
for _, container := range podInfo.Spec.Containers {
9696
log.Printf("Checking env vars are passed to container " + container.Name)
@@ -102,7 +102,7 @@ var _ = Describe("Subscription Config Suite Test", func() {
102102
}
103103
}
104104
log.Printf("Deleting test Velero")
105-
err = vel.Delete()
105+
err = dpaCR.Delete()
106106
Expect(err).ToNot(HaveOccurred())
107107
}
108108

0 commit comments

Comments
 (0)