Skip to content

Commit

Permalink
added MongoDBv3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
katbyte committed Sep 28, 2018
1 parent f8aa0c5 commit 43af731
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 6 deletions.
1 change: 1 addition & 0 deletions azurerm/resource_arm_cosmos_db_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ func resourceArmCosmosDBAccount() *schema.Resource {
"EnableTable",
"EnableGremlin",
`EnableCassandra`,
`MongoDBv3.4`,
}, true),
},
},
Expand Down
81 changes: 75 additions & 6 deletions azurerm/resource_arm_cosmos_db_account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ func TestAccAzureRMCosmosDBAccount_mongoDB(t *testing.T) {
})
}

func TestAccAzureRMCosmosDBAccount_gremlin(t *testing.T) {
func TestAccAzureRMCosmosDBAccount_capabilityGremlin(t *testing.T) {
ri := acctest.RandInt()
resourceName := "azurerm_cosmosdb_account.test"

Expand All @@ -272,7 +272,7 @@ func TestAccAzureRMCosmosDBAccount_gremlin(t *testing.T) {
CheckDestroy: testCheckAzureRMCosmosDBAccountDestroy,
Steps: []resource.TestStep{
{
Config: testAccAzureRMCosmosDBAccount_gremlin(ri, testLocation()),
Config: testAccAzureRMCosmosDBAccount_capabilityGremlin(ri, testLocation()),
Check: resource.ComposeAggregateTestCheckFunc(
checkAccAzureRMCosmosDBAccount_basic(resourceName, testLocation(), string(documentdb.BoundedStaleness), 1),
resource.TestCheckResourceAttr(resourceName, "kind", "GlobalDocumentDB"),
Expand All @@ -287,7 +287,7 @@ func TestAccAzureRMCosmosDBAccount_gremlin(t *testing.T) {
})
}

func TestAccAzureRMCosmosDBAccount_table(t *testing.T) {
func TestAccAzureRMCosmosDBAccount_capabilityTable(t *testing.T) {
ri := acctest.RandInt()
resourceName := "azurerm_cosmosdb_account.test"

Expand All @@ -297,7 +297,7 @@ func TestAccAzureRMCosmosDBAccount_table(t *testing.T) {
CheckDestroy: testCheckAzureRMCosmosDBAccountDestroy,
Steps: []resource.TestStep{
{
Config: testAccAzureRMCosmosDBAccount_table(ri, testLocation()),
Config: testAccAzureRMCosmosDBAccount_capabilityTable(ri, testLocation()),
Check: resource.ComposeAggregateTestCheckFunc(
checkAccAzureRMCosmosDBAccount_basic(resourceName, testLocation(), string(documentdb.BoundedStaleness), 1),
resource.TestCheckResourceAttr(resourceName, "kind", "GlobalDocumentDB"),
Expand All @@ -312,6 +312,55 @@ func TestAccAzureRMCosmosDBAccount_table(t *testing.T) {
})
}

func TestAccAzureRMCosmosDBAccount_capabilityCassandra(t *testing.T) {
ri := acctest.RandInt()
resourceName := "azurerm_cosmosdb_account.test"

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testCheckAzureRMCosmosDBAccountDestroy,
Steps: []resource.TestStep{
{
Config: testAccAzureRMCosmosDBAccount_capabilityCassandra(ri, testLocation()),
Check: resource.ComposeAggregateTestCheckFunc(
checkAccAzureRMCosmosDBAccount_basic(resourceName, testLocation(), string(documentdb.BoundedStaleness), 1),
resource.TestCheckResourceAttr(resourceName, "kind", "GlobalDocumentDB"),
),
},
{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
},
},
})
}

func TestAccAzureRMCosmosDBAccount_capabilityMongo35(t *testing.T) {
ri := acctest.RandInt()
resourceName := "azurerm_cosmosdb_account.test"

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testCheckAzureRMCosmosDBAccountDestroy,
Steps: []resource.TestStep{
{
Config: testAccAzureRMCosmosDBAccount_capabilityMongo34(ri, testLocation()),
Check: resource.ComposeAggregateTestCheckFunc(
checkAccAzureRMCosmosDBAccount_basic(resourceName, testLocation(), string(documentdb.BoundedStaleness), 1),
resource.TestCheckResourceAttr(resourceName, "kind", "MongoDB"),
),
},
{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
},
},
})
}
func TestAbcAzureRMCosmosDBAccount_updatePropertiesAndLocation(t *testing.T) {
ri := acctest.RandInt()
resourceName := "azurerm_cosmosdb_account.test"
Expand Down Expand Up @@ -554,7 +603,7 @@ func testAccAzureRMCosmosDBAccount_mongoDB(rInt int, location string) string {
`)
}

func testAccAzureRMCosmosDBAccount_gremlin(rInt int, location string) string {
func testAccAzureRMCosmosDBAccount_capabilityGremlin(rInt int, location string) string {
return testAccAzureRMCosmosDBAccount_basic(rInt, location, string(documentdb.BoundedStaleness), "", `
kind = "GlobalDocumentDB"
Expand All @@ -564,7 +613,7 @@ func testAccAzureRMCosmosDBAccount_gremlin(rInt int, location string) string {
`)
}

func testAccAzureRMCosmosDBAccount_table(rInt int, location string) string {
func testAccAzureRMCosmosDBAccount_capabilityTable(rInt int, location string) string {
return testAccAzureRMCosmosDBAccount_basic(rInt, location, string(documentdb.BoundedStaleness), "", `
kind = "GlobalDocumentDB"
Expand All @@ -574,6 +623,26 @@ func testAccAzureRMCosmosDBAccount_table(rInt int, location string) string {
`)
}

func testAccAzureRMCosmosDBAccount_capabilityCassandra(rInt int, location string) string {
return testAccAzureRMCosmosDBAccount_basic(rInt, location, string(documentdb.BoundedStaleness), "", `
kind = "GlobalDocumentDB"
capabilities = {
name = "EnableCassandra"
}
`)
}

func testAccAzureRMCosmosDBAccount_capabilityMongo34(rInt int, location string) string {
return testAccAzureRMCosmosDBAccount_basic(rInt, location, string(documentdb.BoundedStaleness), "", `
kind = "MongoDB"
capabilities = {
name = "MongoDBv3.4"
}
`)
}

func testAccAzureRMCosmosDBAccount_geoReplicated(rInt int, location string, altLocation string) string {
return testAccAzureRMCosmosDBAccount_basic(rInt, location, string(documentdb.BoundedStaleness), "", fmt.Sprintf(`
geo_location {
Expand Down

0 comments on commit 43af731

Please sign in to comment.