@@ -23,25 +23,6 @@ var _ = Describe("AWS backup restore tests", func() {
23
23
24
24
err = createCredentialsSecret (credData , namespace , credSecretRef )
25
25
Expect (err ).NotTo (HaveOccurred ())
26
-
27
- err = vel .Build ()
28
- Expect (err ).NotTo (HaveOccurred ())
29
-
30
- err = vel .CreateOrUpdate (& vel .CustomResource .Spec )
31
- Expect (err ).NotTo (HaveOccurred ())
32
-
33
- log .Printf ("Waiting for velero pod to be running" )
34
- Eventually (isVeleroPodRunning (namespace ), timeoutMultiplier * time .Minute * 3 , time .Second * 5 ).Should (BeTrue ())
35
-
36
- if vel .CustomResource .Spec .EnableRestic == nil || * vel .CustomResource .Spec .EnableRestic {
37
- log .Printf ("Waiting for restic pods to be running" )
38
- Eventually (areResticPodsRunning (namespace ), timeoutMultiplier * time .Minute * 3 , time .Second * 5 ).Should (BeTrue ())
39
- }
40
-
41
- if vel .CustomResource .Spec .BackupImages == nil || * vel .CustomResource .Spec .BackupImages {
42
- log .Printf ("Waiting for registry pods to be running" )
43
- Eventually (areRegistryDeploymentsAvailable (namespace ), timeoutMultiplier * time .Minute * 3 , time .Second * 5 ).Should (BeTrue ())
44
- }
45
26
})
46
27
47
28
var _ = AfterEach (func () {
@@ -56,6 +37,7 @@ var _ = Describe("AWS backup restore tests", func() {
56
37
ApplicationTemplate string
57
38
ApplicationNamespace string
58
39
Name string
40
+ BackupRestoreType string
59
41
PreBackupVerify VerificationFunction
60
42
PostRestoreVerify VerificationFunction
61
43
MaxK8SVersion * k8sVersion
@@ -64,6 +46,32 @@ var _ = Describe("AWS backup restore tests", func() {
64
46
65
47
DescribeTable ("backup and restore applications" ,
66
48
func (brCase BackupRestoreCase , expectedErr error ) {
49
+
50
+ err := vel .Build (brCase .BackupRestoreType )
51
+ Expect (err ).NotTo (HaveOccurred ())
52
+
53
+ err = vel .CreateOrUpdate (& vel .CustomResource .Spec )
54
+ Expect (err ).NotTo (HaveOccurred ())
55
+
56
+ log .Printf ("Waiting for velero pod to be running" )
57
+ Eventually (isVeleroPodRunning (namespace ), timeoutMultiplier * time .Minute * 3 , time .Second * 5 ).Should (BeTrue ())
58
+
59
+ if brCase .BackupRestoreType == "restic" {
60
+ if vel .CustomResource .Spec .EnableRestic == nil || * vel .CustomResource .Spec .EnableRestic {
61
+ log .Printf ("Waiting for restic pods to be running" )
62
+ Eventually (areResticPodsRunning (namespace ), timeoutMultiplier * time .Minute * 3 , time .Second * 5 ).Should (BeTrue ())
63
+ }
64
+ }
65
+ if brCase .BackupRestoreType == "csi" {
66
+ log .Printf ("Creating VolumeSnapshot for CSI backuprestore of %s" , brCase .Name )
67
+ err = installApplication (vel .Client , "./sample-applications/mssql-persistent/volumeSnapshotClass.yaml" )
68
+ Expect (err ).ToNot (HaveOccurred ())
69
+ }
70
+
71
+ if vel .CustomResource .Spec .BackupImages == nil || * vel .CustomResource .Spec .BackupImages {
72
+ log .Printf ("Waiting for registry pods to be running" )
73
+ Eventually (areRegistryDeploymentsAvailable (namespace ), timeoutMultiplier * time .Minute * 3 , time .Second * 5 ).Should (BeTrue ())
74
+ }
67
75
if notVersionTarget , reason := NotServerVersionTarget (brCase .MinK8SVersion , brCase .MaxK8SVersion ); notVersionTarget {
68
76
Skip (reason )
69
77
}
@@ -74,7 +82,7 @@ var _ = Describe("AWS backup restore tests", func() {
74
82
75
83
// install app
76
84
log .Printf ("Installing application for case %s" , brCase .Name )
77
- err : = installApplication (vel .Client , brCase .ApplicationTemplate )
85
+ err = installApplication (vel .Client , brCase .ApplicationTemplate )
78
86
Expect (err ).ToNot (HaveOccurred ())
79
87
// wait for pods to be running
80
88
Eventually (areApplicationPodsRunning (brCase .ApplicationNamespace ), timeoutMultiplier * time .Minute * 2 , time .Second * 5 ).Should (BeTrue ())
@@ -131,11 +139,38 @@ var _ = Describe("AWS backup restore tests", func() {
131
139
log .Printf ("Uninstalling application for case %s" , brCase .Name )
132
140
err = uninstallApplication (vel .Client , brCase .ApplicationTemplate )
133
141
Expect (err ).ToNot (HaveOccurred ())
142
+
143
+ if brCase .BackupRestoreType == "csi" {
144
+ log .Printf ("Deleting VolumeSnapshot for CSI backuprestore of %s" , brCase .Name )
145
+ err = uninstallApplication (vel .Client , "./sample-applications/mssql-persistent/volumeSnapshotClass.yaml" )
146
+ Expect (err ).ToNot (HaveOccurred ())
147
+ }
134
148
},
149
+ Entry ("MSSQL application CSI" , BackupRestoreCase {
150
+ ApplicationTemplate : "./sample-applications/mssql-persistent/mssql-persistent-csi-template.yaml" ,
151
+ ApplicationNamespace : "mssql-persistent" ,
152
+ Name : "mssql-e2e" ,
153
+ BackupRestoreType : "csi" ,
154
+ PreBackupVerify : VerificationFunction (func (ocClient client.Client , namespace string ) error {
155
+ return nil
156
+ }),
157
+ PostRestoreVerify : VerificationFunction (func (ocClient client.Client , namespace string ) error {
158
+ // This test confirms that SCC restore logic in our plugin is working
159
+ exists , err := doesSCCExist (ocClient , "mssql-persistent-scc" )
160
+ if err != nil {
161
+ return err
162
+ }
163
+ if ! exists {
164
+ return errors .New ("did not find MSSQL scc after restore" )
165
+ }
166
+ return nil
167
+ }),
168
+ }, nil ),
135
169
Entry ("MSSQL application" , BackupRestoreCase {
136
170
ApplicationTemplate : "./sample-applications/mssql-persistent/mssql-persistent-template.yaml" ,
137
171
ApplicationNamespace : "mssql-persistent" ,
138
172
Name : "mssql-e2e" ,
173
+ BackupRestoreType : "restic" ,
139
174
PreBackupVerify : VerificationFunction (func (ocClient client.Client , namespace string ) error {
140
175
return nil
141
176
}),
@@ -155,6 +190,7 @@ var _ = Describe("AWS backup restore tests", func() {
155
190
ApplicationTemplate : "./sample-applications/parks-app/manifest.yaml" ,
156
191
ApplicationNamespace : "parks-app" ,
157
192
Name : "parks-e2e" ,
193
+ BackupRestoreType : "restic" ,
158
194
PreBackupVerify : VerificationFunction (func (ocClient client.Client , namespace string ) error {
159
195
Eventually (isDCReady (ocClient , "parks-app" , "restify" ), timeoutMultiplier * time .Minute * 5 , time .Second * 10 ).Should (BeTrue ())
160
196
return nil
@@ -168,6 +204,7 @@ var _ = Describe("AWS backup restore tests", func() {
168
204
ApplicationTemplate : "./sample-applications/parks-app/manifest4.8.yaml" ,
169
205
ApplicationNamespace : "parks-app" ,
170
206
Name : "parks-e2e" ,
207
+ BackupRestoreType : "restic" ,
171
208
PreBackupVerify : VerificationFunction (func (ocClient client.Client , namespace string ) error {
172
209
Eventually (isDCReady (ocClient , "parks-app" , "restify" ), timeoutMultiplier * time .Minute * 5 , time .Second * 10 ).Should (BeTrue ())
173
210
return nil
0 commit comments