@@ -44,28 +44,20 @@ func TestRestores(t *testing.T) {
44
44
g .GenerateProjectAndCluster ("backupRestores" )
45
45
require .NotEmpty (t , g .ClusterName )
46
46
47
- projectID := g .ProjectID
48
- clusterName := g .ClusterName
49
-
50
- g .ProjectID = ""
51
- g .ClusterName = ""
52
-
53
- g .GenerateProjectAndCluster ("backupRestores2" )
54
- require .NotEmpty (t , g .ClusterName )
55
-
56
- projectID2 := g .ProjectID
57
- clusterName2 := g .ClusterName
47
+ g2 := internal .NewAtlasE2ETestGenerator (t , internal .WithSnapshot (), internal .WithBackup ())
48
+ g2 .GenerateProjectAndCluster ("backupRestores2" )
49
+ require .NotEmpty (t , g2 .ClusterName )
58
50
59
51
g .Run ("Create snapshot" , func (t * testing.T ) { //nolint:thelper // g.Run replaces t.Run
60
52
cmd := exec .Command (cliPath ,
61
53
backupsEntity ,
62
54
snapshotsEntity ,
63
55
"create" ,
64
- clusterName ,
56
+ g . ClusterName ,
65
57
"--desc" ,
66
58
"test-snapshot" ,
67
59
"--projectId" ,
68
- projectID ,
60
+ g . ProjectID ,
69
61
"-o=json" )
70
62
cmd .Env = os .Environ ()
71
63
resp , err := internal .RunAndGetStdOut (cmd )
@@ -85,9 +77,9 @@ func TestRestores(t *testing.T) {
85
77
"watch" ,
86
78
snapshotID ,
87
79
"--clusterName" ,
88
- clusterName ,
80
+ g . ClusterName ,
89
81
"--projectId" ,
90
- projectID )
82
+ g . ProjectID )
91
83
cmd .Env = os .Environ ()
92
84
resp , _ := internal .RunAndGetStdOut (cmd )
93
85
t .Log (string (resp ))
@@ -100,15 +92,15 @@ func TestRestores(t *testing.T) {
100
92
"start" ,
101
93
"automated" ,
102
94
"--clusterName" ,
103
- clusterName ,
95
+ g . ClusterName ,
104
96
"--snapshotId" ,
105
97
snapshotID ,
106
98
"--projectId" ,
107
- projectID ,
99
+ g . ProjectID ,
108
100
"--targetProjectId" ,
109
- projectID2 ,
101
+ g2 . ProjectID ,
110
102
"--targetClusterName" ,
111
- clusterName2 ,
103
+ g2 . ClusterName ,
112
104
"-o=json" )
113
105
cmd .Env = os .Environ ()
114
106
resp , err := internal .RunAndGetStdOut (cmd )
@@ -126,9 +118,9 @@ func TestRestores(t *testing.T) {
126
118
"watch" ,
127
119
restoreJobID ,
128
120
"--clusterName" ,
129
- clusterName ,
121
+ g . ClusterName ,
130
122
"--projectId" ,
131
- projectID ,
123
+ g . ProjectID ,
132
124
"-o=json" )
133
125
cmd .Env = os .Environ ()
134
126
resp , err := internal .RunAndGetStdOut (cmd )
@@ -141,9 +133,9 @@ func TestRestores(t *testing.T) {
141
133
backupsEntity ,
142
134
restoresEntity ,
143
135
"list" ,
144
- clusterName ,
136
+ g . ClusterName ,
145
137
"--projectId" ,
146
- projectID ,
138
+ g . ProjectID ,
147
139
"-o=json" )
148
140
cmd .Env = os .Environ ()
149
141
resp , err := internal .RunAndGetStdOut (cmd )
@@ -161,9 +153,9 @@ func TestRestores(t *testing.T) {
161
153
"describe" ,
162
154
restoreJobID ,
163
155
"--clusterName" ,
164
- clusterName ,
156
+ g . ClusterName ,
165
157
"--projectId" ,
166
- projectID ,
158
+ g . ProjectID ,
167
159
"-o=json" )
168
160
cmd .Env = os .Environ ()
169
161
resp , err := internal .RunAndGetStdOut (cmd )
@@ -182,11 +174,11 @@ func TestRestores(t *testing.T) {
182
174
"start" ,
183
175
"download" ,
184
176
"--clusterName" ,
185
- clusterName ,
177
+ g . ClusterName ,
186
178
"--snapshotId" ,
187
179
snapshotID ,
188
180
"--projectId" ,
189
- projectID ,
181
+ g . ProjectID ,
190
182
"-o=json" )
191
183
cmd .Env = os .Environ ()
192
184
resp , err := internal .RunAndGetStdOut (cmd )
@@ -204,9 +196,9 @@ func TestRestores(t *testing.T) {
204
196
"watch" ,
205
197
restoreJobID ,
206
198
"--clusterName" ,
207
- clusterName ,
199
+ g . ClusterName ,
208
200
"--projectId" ,
209
- projectID ,
201
+ g . ProjectID ,
210
202
"-o=json" )
211
203
cmd .Env = os .Environ ()
212
204
resp , err := internal .RunAndGetStdOut (cmd )
@@ -221,9 +213,9 @@ func TestRestores(t *testing.T) {
221
213
"delete" ,
222
214
snapshotID ,
223
215
"--clusterName" ,
224
- clusterName ,
216
+ g . ClusterName ,
225
217
"--projectId" ,
226
- projectID ,
218
+ g . ProjectID ,
227
219
"--force" )
228
220
cmd .Env = os .Environ ()
229
221
resp , err := internal .RunAndGetStdOut (cmd )
@@ -241,9 +233,9 @@ func TestRestores(t *testing.T) {
241
233
"watch" ,
242
234
snapshotID ,
243
235
"--clusterName" ,
244
- clusterName ,
236
+ g . ClusterName ,
245
237
"--projectId" ,
246
- projectID )
238
+ g . ProjectID )
247
239
cmd .Env = os .Environ ()
248
240
resp , _ := internal .RunAndGetStdOut (cmd )
249
241
t .Log (string (resp ))
0 commit comments