Skip to content

Commit

Permalink
Updates and bug fixes to azurerm_cosmosdb_account (#1055)
Browse files Browse the repository at this point in the history
* Intial commit of updates to azurerm_cosmosdb_account resource

* Updates to properly wait for adding/removing locations to be compleated

* Updated cosmosdb_account resource to rename/reprioritize non-primary locations

* Fixed failing azurerm_cosmosdb_account import tests

* azurerm_cosmosdb_account minor updates and fixes

* Fixed broken azurerm_cosmosdb_account import test

* Small change to azurerm_cosmosdb_account tests

* Updated cosmosdb_account with requested changes.

* resGroup -> resourceGroup to fix the build

* Fixing some minor nits

* Reverted flattenAndSetTags merge regression

* azurerm_cosmosdb_account: revert setting both failover_policy and geo_location on read, resulted in endless plans

* Raising errors picked up when flattening geo_locations/failover_policiess
  • Loading branch information
katbyte authored and tombuildsstuff committed Apr 17, 2018
1 parent 86b2d23 commit 8f474d4
Show file tree
Hide file tree
Showing 9 changed files with 1,186 additions and 333 deletions.
28 changes: 14 additions & 14 deletions azurerm/import_arm_cosmosdb_account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@ package azurerm
import (
"testing"

"github.com/Azure/azure-sdk-for-go/services/cosmos-db/mgmt/2015-04-08/documentdb"
"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
)

func TestAccAzureRMCosmosDBAccount_importBoundedStaleness(t *testing.T) {
func TestAccAzureRMCosmosDBAccount_importEventualConsistency(t *testing.T) {
resourceName := "azurerm_cosmosdb_account.test"

ri := acctest.RandInt()
config := testAccAzureRMCosmosDBAccount_boundedStaleness(ri, testLocation())
config := testAccAzureRMCosmosDBAccount_basic(ri, testLocation(), string(documentdb.Eventual), "", "")

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Expand All @@ -31,11 +32,11 @@ func TestAccAzureRMCosmosDBAccount_importBoundedStaleness(t *testing.T) {
})
}

func TestAccAzureRMCosmosDBAccount_importBoundedStalenessComplete(t *testing.T) {
func TestAccAzureRMCosmosDBAccount_importSession(t *testing.T) {
resourceName := "azurerm_cosmosdb_account.test"

ri := acctest.RandInt()
config := testAccAzureRMCosmosDBAccount_boundedStalenessComplete(ri, testLocation())
config := testAccAzureRMCosmosDBAccount_basic(ri, testLocation(), string(documentdb.Session), "", "")

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Expand All @@ -55,11 +56,11 @@ func TestAccAzureRMCosmosDBAccount_importBoundedStalenessComplete(t *testing.T)
})
}

func TestAccAzureRMCosmosDBAccount_importEventualConsistency(t *testing.T) {
func TestAccAzureRMCosmosDBAccount_importStrong(t *testing.T) {
resourceName := "azurerm_cosmosdb_account.test"

ri := acctest.RandInt()
config := testAccAzureRMCosmosDBAccount_eventualConsistency(ri, testLocation())
config := testAccAzureRMCosmosDBAccount_basic(ri, testLocation(), string(documentdb.Strong), "", "")

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Expand All @@ -79,11 +80,11 @@ func TestAccAzureRMCosmosDBAccount_importEventualConsistency(t *testing.T) {
})
}

func TestAccAzureRMCosmosDBAccount_importMongoDB(t *testing.T) {
func TestAccAzureRMCosmosDBAccount_importBoundedStaleness(t *testing.T) {
resourceName := "azurerm_cosmosdb_account.test"

ri := acctest.RandInt()
config := testAccAzureRMCosmosDBAccount_mongoDB(ri, testLocation())
config := testAccAzureRMCosmosDBAccount_basic(ri, testLocation(), string(documentdb.BoundedStaleness), "", "")

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Expand All @@ -103,11 +104,11 @@ func TestAccAzureRMCosmosDBAccount_importMongoDB(t *testing.T) {
})
}

func TestAccAzureRMCosmosDBAccount_importSession(t *testing.T) {
func TestAccAzureRMCosmosDBAccount_importBoundedStalenessComplete(t *testing.T) {
resourceName := "azurerm_cosmosdb_account.test"

ri := acctest.RandInt()
config := testAccAzureRMCosmosDBAccount_session(ri, testLocation())
config := testAccAzureRMCosmosDBAccount_boundedStaleness_complete(ri, testLocation())

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Expand All @@ -127,11 +128,11 @@ func TestAccAzureRMCosmosDBAccount_importSession(t *testing.T) {
})
}

func TestAccAzureRMCosmosDBAccount_importStrong(t *testing.T) {
func TestAccAzureRMCosmosDBAccount_importMongoDB(t *testing.T) {
resourceName := "azurerm_cosmosdb_account.test"

ri := acctest.RandInt()
config := testAccAzureRMCosmosDBAccount_strong(ri, testLocation())
config := testAccAzureRMCosmosDBAccount_mongoDB(ri, testLocation())

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Expand All @@ -141,7 +142,6 @@ func TestAccAzureRMCosmosDBAccount_importStrong(t *testing.T) {
{
Config: config,
},

{
ResourceName: resourceName,
ImportState: true,
Expand All @@ -155,7 +155,7 @@ func TestAccAzureRMCosmosDBAccount_importGeoReplicated(t *testing.T) {
resourceName := "azurerm_cosmosdb_account.test"

ri := acctest.RandInt()
config := testAccAzureRMCosmosDBAccount_geoReplicated(ri, testLocation(), testAltLocation())
config := testAccAzureRMCosmosDBAccount_geoReplicated_customId(ri, testLocation(), testAltLocation())

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Expand Down
Loading

0 comments on commit 8f474d4

Please sign in to comment.