Skip to content

Commit 6a1e5dc

Browse files
slevenickanoopkverma-google
authored andcommitted
Add test for flex pool no zone (GoogleCloudPlatform#12867)
1 parent 9625889 commit 6a1e5dc

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

mmv1/products/netapp/StoragePool.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ properties:
160160
Specifies the active zone for regional Flex pools. `zone` and `replica_zone` values can be swapped to initiate a
161161
[zone switch](https://cloud.google.com/netapp/volumes/docs/configure-and-use/storage-pools/edit-or-delete-storage-pool#switch_active_and_replica_zones).
162162
If you want to create a zonal Flex pool, specify a zone name for `location` and omit `zone`.
163+
default_from_api: true
163164
- name: 'replicaZone'
164165
type: String
165166
description: |

mmv1/third_party/terraform/services/netapp/resource_netapp_storage_pool_test.go.tmpl

+48
Original file line numberDiff line numberDiff line change
@@ -316,3 +316,51 @@ data "google_compute_network" "default" {
316316
}
317317
`, context)
318318
}
319+
320+
func TestAccNetappStoragePool_FlexRegionalStoragePoolNoZone(t *testing.T) {
321+
context := map[string]interface{}{
322+
"network_name": acctest.BootstrapSharedServiceNetworkingConnection(t, "gcnv-network-config-1", acctest.ServiceNetworkWithParentService("netapp.servicenetworking.goog")),
323+
"random_suffix": acctest.RandString(t, 10),
324+
}
325+
326+
acctest.VcrTest(t, resource.TestCase{
327+
PreCheck: func() { acctest.AccTestPreCheck(t) },
328+
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
329+
CheckDestroy: testAccCheckNetappStoragePoolDestroyProducer(t),
330+
ExternalProviders: map[string]resource.ExternalProvider{
331+
"time": {},
332+
},
333+
Steps: []resource.TestStep{
334+
{
335+
Config: testAccNetappStoragePool_FlexRegionalStoragePoolNoZone(context),
336+
},
337+
{
338+
ResourceName: "google_netapp_storage_pool.test_pool",
339+
ImportState: true,
340+
ImportStateVerify: true,
341+
ImportStateVerifyIgnore: []string{"location", "name", "labels", "terraform_labels"},
342+
},
343+
},
344+
})
345+
}
346+
347+
func testAccNetappStoragePool_FlexRegionalStoragePoolNoZone(context map[string]interface{}) string {
348+
return acctest.Nprintf(`
349+
resource "google_netapp_storage_pool" "test_pool" {
350+
name = "tf-test-pool%{random_suffix}"
351+
location = "europe-west3-a"
352+
service_level = "FLEX"
353+
capacity_gib = "2048"
354+
network = data.google_compute_network.default.id
355+
}
356+
357+
resource "time_sleep" "wait_5_minutes" {
358+
depends_on = [google_netapp_storage_pool.test_pool]
359+
destroy_duration = "5m"
360+
}
361+
362+
data "google_compute_network" "default" {
363+
name = "%{network_name}"
364+
}
365+
`, context)
366+
}

0 commit comments

Comments
 (0)