|
| 1 | +// Copyright © 2025, SAS Institute Inc., Cary, NC, USA. All Rights Reserved. |
| 2 | +// SPDX-License-Identifier: Apache-2.0 |
| 3 | + |
| 4 | +package nondefaultplan |
| 5 | + |
| 6 | +import ( |
| 7 | + "test/helpers" |
| 8 | + "testing" |
| 9 | + |
| 10 | + "github.com/stretchr/testify/assert" |
| 11 | +) |
| 12 | + |
| 13 | +// Test the default variables when using the sample-input-defaults.tfvars file |
| 14 | +// with storage_type set to "ha". This should engage the Azure NetApp Files module, |
| 15 | +// with the default values as tested herein. |
| 16 | +func TestPlanNetApp(t *testing.T) { |
| 17 | + t.Parallel() |
| 18 | + |
| 19 | + variables := helpers.GetDefaultPlanVars(t) |
| 20 | + variables["prefix"] = "net-app" |
| 21 | + variables["storage_type"] = "ha" |
| 22 | + variables["storage_type_backend"] = "netapp" |
| 23 | + |
| 24 | + tests := map[string]helpers.TestCase{ |
| 25 | + "poolExists": { |
| 26 | + Expected: `nil`, |
| 27 | + ResourceMapName: "module.google_netapp[0].google_netapp_storage_pool.netapp-tf-pool", |
| 28 | + AttributeJsonPath: "{$}", |
| 29 | + AssertFunction: assert.NotEqual, |
| 30 | + }, |
| 31 | + "poolServiceLevel": { |
| 32 | + Expected: `PREMIUM`, |
| 33 | + ResourceMapName: "module.google_netapp[0].google_netapp_storage_pool.netapp-tf-pool", |
| 34 | + AttributeJsonPath: "{$.service_level}", |
| 35 | + }, |
| 36 | + "capactityGib": { |
| 37 | + Expected: `2048`, |
| 38 | + ResourceMapName: "module.google_netapp[0].google_netapp_storage_pool.netapp-tf-pool", |
| 39 | + AttributeJsonPath: "{$.capacity_gib}", |
| 40 | + }, |
| 41 | + "volumeExists": { |
| 42 | + Expected: `nil`, |
| 43 | + ResourceMapName: "module.google_netapp[0].google_netapp_volume.netapp-nfs-volume", |
| 44 | + AttributeJsonPath: "{$}", |
| 45 | + AssertFunction: assert.NotEqual, |
| 46 | + }, |
| 47 | + "volumeProtocols": { |
| 48 | + Expected: `["NFSV3"]`, |
| 49 | + ResourceMapName: "module.google_netapp[0].google_netapp_volume.netapp-nfs-volume", |
| 50 | + AttributeJsonPath: "{$.protocols}", |
| 51 | + AssertFunction: assert.Contains, |
| 52 | + }, |
| 53 | + "shareName": { |
| 54 | + Expected: `net-app-export`, |
| 55 | + ResourceMapName: "module.google_netapp[0].google_netapp_volume.netapp-nfs-volume", |
| 56 | + AttributeJsonPath: "{$.share_name}", |
| 57 | + }, |
| 58 | + "communityNetappPrivateIpAllocEnabled": { |
| 59 | + Expected: `nil`, |
| 60 | + ResourceMapName: "module.google_netapp[0].google_compute_global_address.private_ip_alloc[0]", |
| 61 | + AttributeJsonPath: "{$}", |
| 62 | + AssertFunction: assert.NotEqual, |
| 63 | + }, |
| 64 | + "communityNetappRouteUpdatesEnabled": { |
| 65 | + Expected: `nil`, |
| 66 | + ResourceMapName: "module.google_netapp[0].google_compute_network_peering_routes_config.route_updates[0]", |
| 67 | + AttributeJsonPath: "{$}", |
| 68 | + AssertFunction: assert.NotEqual, |
| 69 | + }, |
| 70 | + "communityNetappServiceNetworkingConnectionEnabled": { |
| 71 | + Expected: `nil`, |
| 72 | + ResourceMapName: "module.google_netapp[0].google_service_networking_connection.default[0]", |
| 73 | + AttributeJsonPath: "{$}", |
| 74 | + AssertFunction: assert.NotEqual, |
| 75 | + }, |
| 76 | + } |
| 77 | + |
| 78 | + plan := helpers.GetPlan(t, variables) |
| 79 | + helpers.RunTests(t, tests, plan) |
| 80 | +} |
0 commit comments