Skip to content

Commit 2951dd7

Browse files
committed
Revert "CLOUDP-309403: Flaky Test: mongodb-atlas-cli-master-github.com_mongodb_mongodb-atlas-cli_atlascli_test_e2e.TestRestores/atlas_backups_restores_e2e/e2e_atlas_backups (#3906)"
This reverts commit ad444c4.
1 parent e2f1531 commit 2951dd7

File tree

2 files changed

+34
-26
lines changed

2 files changed

+34
-26
lines changed

test/e2e/backuprestores/backup_restores_test.go

Lines changed: 33 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,28 @@ func TestRestores(t *testing.T) {
4444
g.GenerateProjectAndCluster("backupRestores")
4545
require.NotEmpty(t, g.ClusterName)
4646

47-
g2 := internal.NewAtlasE2ETestGenerator(t, internal.WithSnapshot(), internal.WithBackup())
48-
g2.GenerateProjectAndCluster("backupRestores2")
49-
require.NotEmpty(t, g2.ClusterName)
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
5058

5159
g.Run("Create snapshot", func(t *testing.T) { //nolint:thelper // g.Run replaces t.Run
5260
cmd := exec.Command(cliPath,
5361
backupsEntity,
5462
snapshotsEntity,
5563
"create",
56-
g.ClusterName,
64+
clusterName,
5765
"--desc",
5866
"test-snapshot",
5967
"--projectId",
60-
g.ProjectID,
68+
projectID,
6169
"-o=json")
6270
cmd.Env = os.Environ()
6371
resp, err := internal.RunAndGetStdOut(cmd)
@@ -77,9 +85,9 @@ func TestRestores(t *testing.T) {
7785
"watch",
7886
snapshotID,
7987
"--clusterName",
80-
g.ClusterName,
88+
clusterName,
8189
"--projectId",
82-
g.ProjectID)
90+
projectID)
8391
cmd.Env = os.Environ()
8492
resp, _ := internal.RunAndGetStdOut(cmd)
8593
t.Log(string(resp))
@@ -92,15 +100,15 @@ func TestRestores(t *testing.T) {
92100
"start",
93101
"automated",
94102
"--clusterName",
95-
g.ClusterName,
103+
clusterName,
96104
"--snapshotId",
97105
snapshotID,
98106
"--projectId",
99-
g.ProjectID,
107+
projectID,
100108
"--targetProjectId",
101-
g2.ProjectID,
109+
projectID2,
102110
"--targetClusterName",
103-
g2.ClusterName,
111+
clusterName2,
104112
"-o=json")
105113
cmd.Env = os.Environ()
106114
resp, err := internal.RunAndGetStdOut(cmd)
@@ -118,9 +126,9 @@ func TestRestores(t *testing.T) {
118126
"watch",
119127
restoreJobID,
120128
"--clusterName",
121-
g.ClusterName,
129+
clusterName,
122130
"--projectId",
123-
g.ProjectID,
131+
projectID,
124132
"-o=json")
125133
cmd.Env = os.Environ()
126134
resp, err := internal.RunAndGetStdOut(cmd)
@@ -133,9 +141,9 @@ func TestRestores(t *testing.T) {
133141
backupsEntity,
134142
restoresEntity,
135143
"list",
136-
g.ClusterName,
144+
clusterName,
137145
"--projectId",
138-
g.ProjectID,
146+
projectID,
139147
"-o=json")
140148
cmd.Env = os.Environ()
141149
resp, err := internal.RunAndGetStdOut(cmd)
@@ -153,9 +161,9 @@ func TestRestores(t *testing.T) {
153161
"describe",
154162
restoreJobID,
155163
"--clusterName",
156-
g.ClusterName,
164+
clusterName,
157165
"--projectId",
158-
g.ProjectID,
166+
projectID,
159167
"-o=json")
160168
cmd.Env = os.Environ()
161169
resp, err := internal.RunAndGetStdOut(cmd)
@@ -174,11 +182,11 @@ func TestRestores(t *testing.T) {
174182
"start",
175183
"download",
176184
"--clusterName",
177-
g.ClusterName,
185+
clusterName,
178186
"--snapshotId",
179187
snapshotID,
180188
"--projectId",
181-
g.ProjectID,
189+
projectID,
182190
"-o=json")
183191
cmd.Env = os.Environ()
184192
resp, err := internal.RunAndGetStdOut(cmd)
@@ -196,9 +204,9 @@ func TestRestores(t *testing.T) {
196204
"watch",
197205
restoreJobID,
198206
"--clusterName",
199-
g.ClusterName,
207+
clusterName,
200208
"--projectId",
201-
g.ProjectID,
209+
projectID,
202210
"-o=json")
203211
cmd.Env = os.Environ()
204212
resp, err := internal.RunAndGetStdOut(cmd)
@@ -213,9 +221,9 @@ func TestRestores(t *testing.T) {
213221
"delete",
214222
snapshotID,
215223
"--clusterName",
216-
g.ClusterName,
224+
clusterName,
217225
"--projectId",
218-
g.ProjectID,
226+
projectID,
219227
"--force")
220228
cmd.Env = os.Environ()
221229
resp, err := internal.RunAndGetStdOut(cmd)
@@ -233,9 +241,9 @@ func TestRestores(t *testing.T) {
233241
"watch",
234242
snapshotID,
235243
"--clusterName",
236-
g.ClusterName,
244+
clusterName,
237245
"--projectId",
238-
g.ProjectID)
246+
projectID)
239247
cmd.Env = os.Environ()
240248
resp, _ := internal.RunAndGetStdOut(cmd)
241249
t.Log(string(resp))

test/internal/atlas_e2e_test_generator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ func (g *AtlasE2ETestGenerator) GenerateCluster() {
347347
g.generateClusterWithPrefix("cluster")
348348
}
349349

350-
// GenerateProjectAndCluster calls both generateProject and generateCluster.
350+
// generateProjectAndCluster calls both generateProject and generateCluster.
351351
func (g *AtlasE2ETestGenerator) GenerateProjectAndCluster(prefix string) {
352352
g.t.Helper()
353353

0 commit comments

Comments
 (0)