Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 25 additions & 33 deletions test/e2e/backuprestores/backup_restores_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,28 +44,20 @@ func TestRestores(t *testing.T) {
g.GenerateProjectAndCluster("backupRestores")
require.NotEmpty(t, g.ClusterName)

projectID := g.ProjectID
clusterName := g.ClusterName

g.ProjectID = ""
g.ClusterName = ""

g.GenerateProjectAndCluster("backupRestores2")
require.NotEmpty(t, g.ClusterName)

projectID2 := g.ProjectID
clusterName2 := g.ClusterName
g2 := internal.NewAtlasE2ETestGenerator(t, internal.WithSnapshot(), internal.WithBackup())
g2.GenerateProjectAndCluster("backupRestores2")
require.NotEmpty(t, g2.ClusterName)

g.Run("Create snapshot", func(t *testing.T) { //nolint:thelper // g.Run replaces t.Run
cmd := exec.Command(cliPath,
backupsEntity,
snapshotsEntity,
"create",
clusterName,
g.ClusterName,
"--desc",
"test-snapshot",
"--projectId",
projectID,
g.ProjectID,
"-o=json")
cmd.Env = os.Environ()
resp, err := internal.RunAndGetStdOut(cmd)
Expand All @@ -85,9 +77,9 @@ func TestRestores(t *testing.T) {
"watch",
snapshotID,
"--clusterName",
clusterName,
g.ClusterName,
"--projectId",
projectID)
g.ProjectID)
cmd.Env = os.Environ()
resp, _ := internal.RunAndGetStdOut(cmd)
t.Log(string(resp))
Expand All @@ -100,15 +92,15 @@ func TestRestores(t *testing.T) {
"start",
"automated",
"--clusterName",
clusterName,
g.ClusterName,
"--snapshotId",
snapshotID,
"--projectId",
projectID,
g.ProjectID,
"--targetProjectId",
projectID2,
g2.ProjectID,
"--targetClusterName",
clusterName2,
g2.ClusterName,
"-o=json")
cmd.Env = os.Environ()
resp, err := internal.RunAndGetStdOut(cmd)
Expand All @@ -126,9 +118,9 @@ func TestRestores(t *testing.T) {
"watch",
restoreJobID,
"--clusterName",
clusterName,
g.ClusterName,
"--projectId",
projectID,
g.ProjectID,
"-o=json")
cmd.Env = os.Environ()
resp, err := internal.RunAndGetStdOut(cmd)
Expand All @@ -141,9 +133,9 @@ func TestRestores(t *testing.T) {
backupsEntity,
restoresEntity,
"list",
clusterName,
g.ClusterName,
"--projectId",
projectID,
g.ProjectID,
"-o=json")
cmd.Env = os.Environ()
resp, err := internal.RunAndGetStdOut(cmd)
Expand All @@ -161,9 +153,9 @@ func TestRestores(t *testing.T) {
"describe",
restoreJobID,
"--clusterName",
clusterName,
g.ClusterName,
"--projectId",
projectID,
g.ProjectID,
"-o=json")
cmd.Env = os.Environ()
resp, err := internal.RunAndGetStdOut(cmd)
Expand All @@ -182,11 +174,11 @@ func TestRestores(t *testing.T) {
"start",
"download",
"--clusterName",
clusterName,
g.ClusterName,
"--snapshotId",
snapshotID,
"--projectId",
projectID,
g.ProjectID,
"-o=json")
cmd.Env = os.Environ()
resp, err := internal.RunAndGetStdOut(cmd)
Expand All @@ -204,9 +196,9 @@ func TestRestores(t *testing.T) {
"watch",
restoreJobID,
"--clusterName",
clusterName,
g.ClusterName,
"--projectId",
projectID,
g.ProjectID,
"-o=json")
cmd.Env = os.Environ()
resp, err := internal.RunAndGetStdOut(cmd)
Expand All @@ -221,9 +213,9 @@ func TestRestores(t *testing.T) {
"delete",
snapshotID,
"--clusterName",
clusterName,
g.ClusterName,
"--projectId",
projectID,
g.ProjectID,
"--force")
cmd.Env = os.Environ()
resp, err := internal.RunAndGetStdOut(cmd)
Expand All @@ -241,9 +233,9 @@ func TestRestores(t *testing.T) {
"watch",
snapshotID,
"--clusterName",
clusterName,
g.ClusterName,
"--projectId",
projectID)
g.ProjectID)
cmd.Env = os.Environ()
resp, _ := internal.RunAndGetStdOut(cmd)
t.Log(string(resp))
Expand Down
2 changes: 1 addition & 1 deletion test/internal/atlas_e2e_test_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ func (g *AtlasE2ETestGenerator) GenerateCluster() {
g.generateClusterWithPrefix("cluster")
}

// generateProjectAndCluster calls both generateProject and generateCluster.
// GenerateProjectAndCluster calls both generateProject and generateCluster.
func (g *AtlasE2ETestGenerator) GenerateProjectAndCluster(prefix string) {
g.t.Helper()

Expand Down
Loading