mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-07-06 02:02:43 +00:00
Fix issue with nondeterminism in tests (#226)
This commit is contained in:
parent
cb538a3535
commit
88b1f092ff
|
@ -4,20 +4,24 @@ import (
|
|||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
"github.com/hashicorp/terraform/terraform"
|
||||
)
|
||||
|
||||
func TestAccComputeProjectMetadataItem_basic(t *testing.T) {
|
||||
// Key must be unique to avoid concurrent tests interfering with each other
|
||||
key := "myKey" + acctest.RandString(10)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckProjectMetadataItemDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccProjectMetadataItem_basic("myKey", "myValue"),
|
||||
Config: testAccProjectMetadataItem_basic(key, "myValue"),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckProjectMetadataItem_hasMetadata("myKey", "myValue"),
|
||||
testAccCheckProjectMetadataItem_hasMetadata(key, "myValue"),
|
||||
),
|
||||
},
|
||||
},
|
||||
|
@ -25,15 +29,18 @@ func TestAccComputeProjectMetadataItem_basic(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestAccComputeProjectMetadataItem_basicWithEmptyVal(t *testing.T) {
|
||||
// Key must be unique to avoid concurrent tests interfering with each other
|
||||
key := "myKey" + acctest.RandString(10)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckProjectMetadataItemDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccProjectMetadataItem_basic("myKey", ""),
|
||||
Config: testAccProjectMetadataItem_basic(key, ""),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckProjectMetadataItem_hasMetadata("myKey", ""),
|
||||
testAccCheckProjectMetadataItem_hasMetadata(key, ""),
|
||||
),
|
||||
},
|
||||
},
|
||||
|
@ -41,21 +48,24 @@ func TestAccComputeProjectMetadataItem_basicWithEmptyVal(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestAccComputeProjectMetadataItem_basicUpdate(t *testing.T) {
|
||||
// Key must be unique to avoid concurrent tests interfering with each other
|
||||
key := "myKey" + acctest.RandString(10)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckProjectMetadataItemDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccProjectMetadataItem_basic("myKey", "myValue"),
|
||||
Config: testAccProjectMetadataItem_basic(key, "myValue"),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckProjectMetadataItem_hasMetadata("myKey", "myValue"),
|
||||
testAccCheckProjectMetadataItem_hasMetadata(key, "myValue"),
|
||||
),
|
||||
},
|
||||
{
|
||||
Config: testAccProjectMetadataItem_basic("myKey", "myUpdatedValue"),
|
||||
Config: testAccProjectMetadataItem_basic(key, "myUpdatedValue"),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckProjectMetadataItem_hasMetadata("myKey", "myUpdatedValue"),
|
||||
testAccCheckProjectMetadataItem_hasMetadata(key, "myUpdatedValue"),
|
||||
),
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue
Block a user