Skip to content

Commit

Permalink
Modify gke vcr testacc check to not panic (#3310) (#5992)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Mar 27, 2020
1 parent a646d86 commit 44999c4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .changelog/3310.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:none

```
2 changes: 1 addition & 1 deletion google/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func closeRecorder(t *testing.T) {
}

func getTestAccProviders(testName string) map[string]terraform.ResourceProvider {
prov := Provider().(*schema.Provider)
prov := testAccProvider
provRand := random.Provider().(*schema.Provider)
envPath := os.Getenv("VCR_PATH")
recordingMode := os.Getenv("VCR_MODE")
Expand Down
6 changes: 3 additions & 3 deletions google/resource_container_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1256,7 +1256,7 @@ func TestAccContainerCluster_withMasterAuthorizedNetworksDisabled(t *testing.T)
{
Config: testAccContainerCluster_withMasterAuthorizedNetworksDisabled(containerNetName, clusterName),
Check: resource.ComposeTestCheckFunc(
testAccContainerCluster_masterAuthorizedNetworksDisabled("google_container_cluster.with_private_cluster"),
testAccContainerCluster_masterAuthorizedNetworksDisabled(t, "google_container_cluster.with_private_cluster"),
),
},
{
Expand Down Expand Up @@ -1291,14 +1291,14 @@ func TestAccContainerCluster_withEnableKubernetesAlpha(t *testing.T) {
}, testAccCheckContainerClusterDestroyProducer)
}

func testAccContainerCluster_masterAuthorizedNetworksDisabled(resource_name string) resource.TestCheckFunc {
func testAccContainerCluster_masterAuthorizedNetworksDisabled(t *testing.T, resource_name string) resource.TestCheckFunc {
return func(s *terraform.State) error {
rs, ok := s.RootModule().Resources[resource_name]
if !ok {
return fmt.Errorf("can't find %s in state", resource_name)
}

config := testAccProvider.Meta().(*Config)
config := getTestAccProviders(t.Name())["google"].(*schema.Provider).Meta().(*Config)
attributes := rs.Primary.Attributes

cluster, err := config.clientContainer.Projects.Zones.Clusters.Get(
Expand Down

0 comments on commit 44999c4

Please sign in to comment.