mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-09-06 09:06:44 +00:00
![Joe Selman](/assets/img/avatar_default.png)
This reverts commit 8ab9d96d25
and revives
the original commit that adds t.Parallel to all acceptance tests. It
turns out test failures were unrelated to this change (rather, they were
related to quota issues).
64 lines
1.6 KiB
Go
64 lines
1.6 KiB
Go
package google
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
|
|
"github.com/hashicorp/terraform/helper/acctest"
|
|
"github.com/hashicorp/terraform/helper/resource"
|
|
)
|
|
|
|
func TestAccSpannerInstance_importInstance(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
resourceName := "google_spanner_instance.basic"
|
|
instanceName := fmt.Sprintf("span-itest-%s", acctest.RandString(10))
|
|
|
|
resource.Test(t, resource.TestCase{
|
|
PreCheck: func() { testAccPreCheck(t) },
|
|
Providers: testAccProviders,
|
|
CheckDestroy: testAccCheckSpannerInstanceDestroy,
|
|
Steps: []resource.TestStep{
|
|
resource.TestStep{
|
|
Config: testAccSpannerInstance_basic(instanceName),
|
|
},
|
|
|
|
resource.TestStep{
|
|
ResourceName: resourceName,
|
|
ImportStateId: instanceName,
|
|
ImportState: true,
|
|
ImportStateVerify: true,
|
|
},
|
|
},
|
|
})
|
|
}
|
|
|
|
func TestAccSpannerInstance_importProjectInstance(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
resourceName := "google_spanner_instance.basic"
|
|
instanceName := fmt.Sprintf("span-itest-%s", acctest.RandString(10))
|
|
projectId := getTestProjectFromEnv()
|
|
if projectId == "" {
|
|
t.Skip("Unable to locate projectId via environment variables ... skipping ")
|
|
return
|
|
}
|
|
|
|
resource.Test(t, resource.TestCase{
|
|
PreCheck: func() { testAccPreCheck(t) },
|
|
Providers: testAccProviders,
|
|
CheckDestroy: testAccCheckSpannerInstanceDestroy,
|
|
Steps: []resource.TestStep{
|
|
resource.TestStep{
|
|
Config: testAccSpannerInstance_basicWithProject(projectId, instanceName),
|
|
},
|
|
|
|
resource.TestStep{
|
|
ResourceName: resourceName,
|
|
ImportState: true,
|
|
ImportStateVerify: true,
|
|
},
|
|
},
|
|
})
|
|
}
|