Skip to content

Commit

Permalink
test: fix migration test to use package clusterRequest (with correct …
Browse files Browse the repository at this point in the history
…region)
  • Loading branch information
EspenAlbert committed Jul 12, 2024
1 parent a23a2a9 commit 7051cbf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,12 @@ import (
func TestMigBackupRSOnlineArchiveWithNoChangeBetweenVersions(t *testing.T) {
var (
onlineArchiveResourceName = "mongodbatlas_online_archive.users_archive"
clusterInfo = acc.GetClusterInfo(t, &acc.ClusterRequest{
ReplicationSpecs: []acc.ReplicationSpecRequest{
{AutoScalingDiskGbEnabled: true},
},
Tags: map[string]string{
"ArchiveTest": "true", "Owner": "test",
},
})
clusterName = clusterInfo.ClusterName
projectID = clusterInfo.ProjectID
clusterTerraformStr = clusterInfo.ClusterTerraformStr
clusterResourceName = clusterInfo.ClusterResourceName
deleteExpirationDays = 0
clusterInfo = acc.GetClusterInfo(t, &clusterRequest)
clusterName = clusterInfo.ClusterName
projectID = clusterInfo.ProjectID
clusterTerraformStr = clusterInfo.ClusterTerraformStr
clusterResourceName = clusterInfo.ClusterResourceName
deleteExpirationDays = 0
)
if mig.IsProviderVersionAtLeast("1.12.2") {
deleteExpirationDays = 7
Expand Down
11 changes: 2 additions & 9 deletions internal/service/onlinearchive/resource_online_archive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"fmt"
"log"
"regexp"
"strings"
"testing"
"time"

Expand Down Expand Up @@ -38,12 +37,6 @@ func TestAccBackupRSOnlineArchive(t *testing.T) {
clusterResourceName = clusterInfo.ClusterResourceName
)

config1 := clusterTerraformStr
config2 := configWithDailySchedule(clusterTerraformStr, clusterResourceName, 1, 7)
config3 := configWithDailySchedule(clusterTerraformStr, clusterResourceName, 2, 8)
if config1 != config2 {
t.Fatal(strings.Join([]string{config1, "\n#CONFIG2\n", config2, "\n#CONFIG3\n", config3}, "\n"))
}
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { acc.PreCheckBasic(t) },
ProtoV6ProviderFactories: acc.TestAccProviderV6Factories,
Expand All @@ -56,7 +49,7 @@ func TestAccBackupRSOnlineArchive(t *testing.T) {
),
},
{
Config: config2,
Config: configWithDailySchedule(clusterTerraformStr, clusterResourceName, 1, 7),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttrSet(onlineArchiveResourceName, "state"),
resource.TestCheckResourceAttrSet(onlineArchiveResourceName, "archive_id"),
Expand All @@ -72,7 +65,7 @@ func TestAccBackupRSOnlineArchive(t *testing.T) {
),
},
{
Config: config3,
Config: configWithDailySchedule(clusterTerraformStr, clusterResourceName, 2, 8),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttrSet(onlineArchiveResourceName, "state"),
resource.TestCheckResourceAttrSet(onlineArchiveResourceName, "archive_id"),
Expand Down

0 comments on commit 7051cbf

Please sign in to comment.