Skip to content

Commit

Permalink
update tc
Browse files Browse the repository at this point in the history
  • Loading branch information
neil-yechenwei committed Dec 13, 2024
1 parent 4b224b4 commit bee484a
Showing 1 changed file with 18 additions and 19 deletions.
37 changes: 18 additions & 19 deletions internal/services/mongocluster/mongo_cluster_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@ type MongoClusterResource struct{}
func TestAccMongoClusterFreeTier(t *testing.T) {
acceptance.RunTestsInSequence(t, map[string]map[string]func(t *testing.T){
"freeTier": { // Run tests in sequence since each subscription is limited to one free tier cluster per region and free tier is currently only available in South India.
"basic": testAccMongoCluster_basic,
"geoReplica": testAccMongoCluster_geoReplica,
"update": testAccMongoCluster_update,
"import": testAccMongoCluster_requiresImport,
"basic": testAccMongoCluster_basic,
"update": testAccMongoCluster_update,
"import": testAccMongoCluster_requiresImport,
},
})
}
Expand All @@ -43,21 +42,6 @@ func testAccMongoCluster_basic(t *testing.T) {
})
}

func testAccMongoCluster_geoReplica(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_mongo_cluster", "test")
r := MongoClusterResource{}

data.ResourceSequentialTest(t, r, []acceptance.TestStep{
{
Config: r.geoReplica(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
},
data.ImportStep("administrator_password", "create_mode"),
})
}

func testAccMongoCluster_update(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_mongo_cluster", "test")
r := MongoClusterResource{}
Expand Down Expand Up @@ -117,6 +101,21 @@ func TestAccMongoCluster_previewFeature(t *testing.T) {
})
}

func TestAccMongoCluster_geoReplica(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_mongo_cluster", "test")
r := MongoClusterResource{}

data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.geoReplica(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
},
data.ImportStep("administrator_password", "create_mode", "source_location"),
})
}

func (r MongoClusterResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) {
id, err := mongoclusters.ParseMongoClusterID(state.ID)
if err != nil {
Expand Down

0 comments on commit bee484a

Please sign in to comment.