From bedc500707affd4645813586cdd5fff825d94824 Mon Sep 17 00:00:00 2001 From: Mickael Stanislas Date: Fri, 20 Oct 2023 19:36:05 +0200 Subject: [PATCH] fix: multi testsacc error --- .golangci.yml | 2 +- internal/helpers/testsacc/testsacc.go | 68 ++++-- internal/testsacc/acctest.go | 32 +-- internal/testsacc/backup_datasource_test.go | 4 +- internal/testsacc/backup_resource_test.go | 212 +++++++++--------- .../testsacc/catalog_acl_datasource_test.go | 4 +- .../testsacc/catalog_acl_resource_test.go | 6 +- internal/testsacc/catalog_resource_test.go | 2 +- .../edgegw_edgegateway_datasource_test.go | 4 +- .../edgegw_edgegateway_resource_test.go | 6 +- .../testsacc/network_routed_resource_test.go | 4 +- ...cket_cors_configuration_datasource_test.go | 4 +- ...bucket_cors_configuration_resource_test.go | 4 +- .../testsacc/s3_bucket_datasource_test.go | 4 +- internal/testsacc/s3_bucket_resource_test.go | 2 +- ...ersioning_configuration_datasource_test.go | 4 +- ..._versioning_configuration_resource_test.go | 4 +- .../testsacc/tier0_vrf_datasource_test.go | 2 +- .../vapp_org_network_resource_test.go | 6 +- internal/testsacc/vapp_resource_test.go | 4 +- internal/testsacc/vdc_datasource_test.go | 4 +- .../testsacc/vdc_group_datasource_test.go | 4 +- internal/testsacc/vdc_group_resource_test.go | 6 +- internal/testsacc/vdc_resource_test.go | 2 +- 24 files changed, 213 insertions(+), 181 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 34b03b91..0d98c9a0 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -18,7 +18,6 @@ linters: - exportloopref # checks for pointers to enclosing loop variables [fast: false, auto-fix: false] - forbidigo # Forbids identifiers [fast: true, auto-fix: false] - gci # Gci controls golang package import order and makes it always deterministic. [fast: true, auto-fix: false] - - goconst # Finds repeated strings that could be replaced by a constant [fast: true, auto-fix: false] - gocritic # Provides diagnostics that check for bugs, performance and style issues. [fast: false, auto-fix: false] - gocyclo # Computes and checks the cyclomatic complexity of functions [fast: true, auto-fix: false] - gofmt # Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification [fast: true, auto-fix: true] @@ -62,6 +61,7 @@ linters: - bodyclose # checks whether HTTP response body is closed successfully disable: + - goconst # Finds repeated strings that could be replaced by a constant [fast: true, auto-fix: false] - dupl # Tool for code clone detection [fast: true, auto-fix: false] - varcheck # Finds unused global variables and constants [fast: false, auto-fix: false] - deadcode # Finds unused code [fast: false, auto-fix: false] diff --git a/internal/helpers/testsacc/testsacc.go b/internal/helpers/testsacc/testsacc.go index f5ddc42e..07c6b18c 100644 --- a/internal/helpers/testsacc/testsacc.go +++ b/internal/helpers/testsacc/testsacc.go @@ -12,20 +12,19 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) -var listOfDeps = make(ListOfDependencies, 0) - type ( - ResourceName string - TFData string - TestName string - ListOfDependencies []ResourceName + ResourceName string + TFData string + TestName string + ListOfDependencies []ResourceName + DependenciesConfigResponse []func() TFData TestACC interface { // GetResourceName returns the name of the resource under test. GetResourceName() string // DependenciesConfig returns the Terraform configuration used to create any dependencies of the resource under test. - DependenciesConfig() TFData + DependenciesConfig() DependenciesConfigResponse // Tests returns the acceptance tests to run for the resource under test. // resourceName is a concatenation of the resource name and the example name. For example, "cloudavenue_catalog.example". @@ -47,8 +46,11 @@ type ( // Import returns the Terraform configurations to use for the import test. Imports []TFImport - // cacheDependenciesConfig is used to cache the dependencies config. - cacheDependenciesConfig TFData + // CacheDependenciesConfig is used to cache the dependencies config. + CacheDependenciesConfig TFData + + // listOfDeps is a list of dependencies. + listOfDeps ListOfDependencies } TFConfig struct { @@ -148,6 +150,12 @@ type ( } ) +// * DependenciesConfigResponse +// Append appends the given dependencies config to the current one. +func (d *DependenciesConfigResponse) Append(tf func() TFData) { + *d = append(*d, tf) +} + // * TFAdvanced // IsEmpty returns true if the TFAdvanced is empty. @@ -219,10 +227,7 @@ func (t TFData) String() string { // Append appends the given Terraform configuration to the current one. func (t *TFData) Append(tf TFData) { - if !tf.IsEmpty() && !listOfDeps.Exists(ResourceName(tf.extractResourceName())) { - t.append(tf) - listOfDeps.Append(ResourceName(tf.extractResourceName())) - } + t.append(tf) } // AppendWithoutResourceName appends the given Terraform configuration to the current one. @@ -248,7 +253,11 @@ func (t *TFData) append(tf TFData) { // extractResourceName extracts the resource name and config name from the Terraform configuration. // example: "resource "cloudavenue_catalog" "example" {}" => "cloudavenue_catalog.example" func (t *TFData) extractResourceName() string { - x := strings.Split(t.String(), " ") + // find the first occurrence of "resource" or "data" + re := regexp.MustCompile(`(resource|data) \"(.*)\" \"(.*)\"`) + line := re.FindString(t.String()) + + x := strings.Split(line, " ") // for each word remove the double quotes for i, v := range x { x[i] = strings.ReplaceAll(v, "\"", "") @@ -268,6 +277,26 @@ func (t TFConfig) Generate(_ context.Context, dependencies TFData) string { // *Test +// initListOfDeps initializes the list of dependencies. +func (t *Test) initListOfDeps() { + if t.listOfDeps == nil { + t.listOfDeps = make(ListOfDependencies, 0) + } +} + +// Compute Dependencies config. +func (t *Test) ComputeDependenciesConfig(testACC TestACC) { + t.initListOfDeps() + for _, v := range testACC.DependenciesConfig() { + // tf contains terraform configuration for a dependency + tf := v() + if !tf.IsEmpty() && !t.listOfDeps.Exists(ResourceName(tf.extractResourceName())) { + t.CacheDependenciesConfig.append(tf) + t.listOfDeps.Append(ResourceName(tf.extractResourceName())) + } + } +} + // GenerateSteps generates the structure of the acceptance tests. func (t Test) GenerateSteps(ctx context.Context, testName TestName, testACC TestACC) (steps []resource.TestStep) { // Init Slice @@ -277,13 +306,12 @@ func (t Test) GenerateSteps(ctx context.Context, testName TestName, testACC Test listOfChecks := t.CommonChecks listOfChecks = append(listOfChecks, t.Create.Checks...) - if t.cacheDependenciesConfig == "" { - t.cacheDependenciesConfig = testACC.DependenciesConfig() - } + // * Compute dependencies config + t.ComputeDependenciesConfig(testACC) // * Create step createTestStep := resource.TestStep{ - Config: t.Create.Generate(ctx, t.cacheDependenciesConfig), + Config: t.Create.Generate(ctx, t.CacheDependenciesConfig), Check: resource.ComposeAggregateTestCheckFunc( listOfChecks..., ), @@ -309,7 +337,7 @@ func (t Test) GenerateSteps(ctx context.Context, testName TestName, testACC Test listOfChecks = append(listOfChecks, update.Checks...) updateTestStep := resource.TestStep{ - Config: update.Generate(ctx, t.cacheDependenciesConfig), + Config: update.Generate(ctx, t.CacheDependenciesConfig), Check: resource.ComposeAggregateTestCheckFunc( listOfChecks..., ), @@ -376,7 +404,7 @@ func GenerateTests(tacc TestACC) []resource.TestStep { // resourceName is a concatenation of the resource name and the example name. For example, "cloudavenue_catalog.example". resourceName := testName.ComputeResourceName(tacc.GetResourceName()) - steps = step(ctx, resourceName).GenerateSteps(ctx, testName, tacc) + steps = append(steps, step(ctx, resourceName).GenerateSteps(ctx, testName, tacc)...) } return steps diff --git a/internal/testsacc/acctest.go b/internal/testsacc/acctest.go index f9ef71a4..76e4b873 100644 --- a/internal/testsacc/acctest.go +++ b/internal/testsacc/acctest.go @@ -80,27 +80,29 @@ type resourceConfig struct { // GetDefaultConfig returns the create configuration for the test named "example". func (r resourceConfig) GetDefaultConfig() testsacc.TFData { - return r.GetSpecificConfig("example") + return r.GetSpecificConfig("example")() } // GetSpecificConfig returns the create configuration for the test named "example". -func (r resourceConfig) GetSpecificConfig(testName string) testsacc.TFData { - var x testsacc.TFData - - if test, ok := localCacheResource[r.GetResourceName()+"."+testName]; ok { - x = test.Create.TFConfig - } else { - t := r.Tests(context.Background())[testsacc.TestName(testName)]( +func (r resourceConfig) GetSpecificConfig(testName string) func() testsacc.TFData { + // Load from cache + t, ok := localCacheResource[r.GetResourceName()+"."+testName] + // If not found, compute it + if !ok { + t = r.Tests(context.Background())[testsacc.TestName(testName)]( context.Background(), r.GetResourceName()+"."+testName, ) - x = t.Create.TFConfig - + t.ComputeDependenciesConfig(r.TestACC) localCacheResource[r.GetResourceName()+"."+testName] = t } - x.AppendWithoutResourceName(r.DependenciesConfig()) - return x + x := t.Create.TFConfig + x.Append(t.CacheDependenciesConfig) + + return func() testsacc.TFData { + return x + } } // GetDefaultChecks returns the checks for the test named "example". @@ -128,8 +130,10 @@ func (r resourceConfig) GetSpecificChecks(testName string) []resource.TestCheckF } // AddConstantConfig returns the create configuration from constant. -func AddConstantConfig(config string) testsacc.TFData { - return testsacc.TFData(config) +func AddConstantConfig(config string) func() testsacc.TFData { + return func() testsacc.TFData { + return testsacc.TFData(config) + } } func NewResourceConfig(data testsacc.TestACC) func() resourceConfig { diff --git a/internal/testsacc/backup_datasource_test.go b/internal/testsacc/backup_datasource_test.go index 2a8422f3..cf9919b7 100644 --- a/internal/testsacc/backup_datasource_test.go +++ b/internal/testsacc/backup_datasource_test.go @@ -26,9 +26,9 @@ func (r *BackupDataSource) GetResourceName() string { return BackupDataSourceName.String() } -func (r *BackupDataSource) DependenciesConfig() (configs testsacc.TFData) { +func (r *BackupDataSource) DependenciesConfig() (resp testsacc.DependenciesConfigResponse) { // Add dependencies config to the resource - configs.Append(GetResourceConfig()[BackupResourceName]().GetDefaultConfig()) + resp.Append(GetResourceConfig()[BackupResourceName]().GetDefaultConfig) return } diff --git a/internal/testsacc/backup_resource_test.go b/internal/testsacc/backup_resource_test.go index e1a5eb6f..1a6e45c2 100644 --- a/internal/testsacc/backup_resource_test.go +++ b/internal/testsacc/backup_resource_test.go @@ -50,9 +50,9 @@ func (r *BackupResource) GetResourceName() string { return BackupResourceName.String() } -func (r *BackupResource) DependenciesConfig() (configs testsacc.TFData) { - configs.Append(GetResourceConfig()[VAppResourceName]().GetDefaultConfig()) - configs.Append(AddConstantConfig(TestAccVMResourceConfig)) +func (r *BackupResource) DependenciesConfig() (resp testsacc.DependenciesConfigResponse) { + resp.Append(GetResourceConfig()[VAppResourceName]().GetDefaultConfig) + resp.Append(AddConstantConfig(TestAccVMResourceConfig)) return } @@ -112,110 +112,110 @@ func (r *BackupResource) Tests(ctx context.Context) map[testsacc.TestName]func(c } }, // // * Second Test For a VAPP Backup named "example" - // "example_2": func(_ context.Context, resourceName string) testsacc.Test { - // return testsacc.Test{ - // CommonChecks: []resource.TestCheckFunc{ - // resource.TestCheckResourceAttrSet(resourceName, "id"), - // resource.TestCheckResourceAttrSet(resourceName, "target_id"), - // }, - // // ! Create testing - // Create: testsacc.TFConfig{ - // TFConfig: ` - // resource "cloudavenue_backup" "example_2" { - // type = "vapp" - // target_id = cloudavenue_vapp.example.id - // policies = [{ - // policy_name = "D6" - // }] - // }`, - // Checks: []resource.TestCheckFunc{ - // resource.TestCheckResourceAttr(resourceName, "type", "vapp"), - // resource.TestCheckResourceAttr(resourceName, "policies.0.policy_name", "D6"), - // }, - // }, - // // ! Updates testing - // Updates: []testsacc.TFConfig{ - // { - // TFConfig: ` - // resource "cloudavenue_backup" "example_2" { - // type = "vapp" - // target_id = cloudavenue_vapp.example.id - // policies = [{ - // policy_name = "D6" - // }, - // { - // policy_name = "D30" - // }] - // }`, - // Checks: []resource.TestCheckFunc{ - // resource.TestCheckResourceAttr(resourceName, "policies.0.policy_name", "D6"), - // resource.TestCheckResourceAttr(resourceName, "policies.1.policy_name", "D30"), - // }, - // }, - // }, - // // ! Imports testing - // Imports: []testsacc.TFImport{ - // { - // ImportStateIDBuilder: []string{"type", "target_name"}, - // ImportState: true, - // ImportStateVerify: true, - // ImportStateVerifyIgnore: []string{"target_id"}, - // }, - // }, - // } - // }, + "example_vapp": func(_ context.Context, resourceName string) testsacc.Test { + return testsacc.Test{ + CommonChecks: []resource.TestCheckFunc{ + resource.TestCheckResourceAttrSet(resourceName, "id"), + resource.TestCheckResourceAttrSet(resourceName, "target_id"), + }, + // ! Create testing + Create: testsacc.TFConfig{ + TFConfig: ` + resource "cloudavenue_backup" "example_vapp" { + type = "vapp" + target_id = cloudavenue_vapp.example.id + policies = [{ + policy_name = "D6" + }] + }`, + Checks: []resource.TestCheckFunc{ + resource.TestCheckResourceAttr(resourceName, "type", "vapp"), + resource.TestCheckResourceAttr(resourceName, "policies.0.policy_name", "D6"), + }, + }, + // ! Updates testing + Updates: []testsacc.TFConfig{ + { + TFConfig: ` + resource "cloudavenue_backup" "example_vapp" { + type = "vapp" + target_id = cloudavenue_vapp.example.id + policies = [{ + policy_name = "D6" + }, + { + policy_name = "D30" + }] + }`, + Checks: []resource.TestCheckFunc{ + resource.TestCheckResourceAttr(resourceName, "policies.0.policy_name", "D6"), + resource.TestCheckResourceAttr(resourceName, "policies.1.policy_name", "D30"), + }, + }, + }, + // ! Imports testing + Imports: []testsacc.TFImport{ + { + ImportStateIDBuilder: []string{"type", "target_name"}, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"target_id"}, + }, + }, + } + }, // * Second Test For a VM Backup named "example" - // "example_3": func(_ context.Context, resourceName string) testsacc.Test { - // return testsacc.Test{ - // CommonChecks: []resource.TestCheckFunc{ - // resource.TestCheckResourceAttrSet(resourceName, "id"), - // resource.TestCheckResourceAttrSet(resourceName, "target_name"), - // }, - // // ! Create testing - // Create: testsacc.TFConfig{ - // TFConfig: ` - // resource "cloudavenue_backup" "example_3" { - // type = "vm" - // target_name = cloudavenue_vm.example.name - // policies = [{ - // policy_name = "D6" - // }] - // }`, - // Checks: []resource.TestCheckFunc{ - // resource.TestCheckResourceAttr(resourceName, "type", "vm"), - // resource.TestCheckResourceAttr(resourceName, "policies.0.policy_name", "D6"), - // }, - // }, - // // ! Updates testing - // Updates: []testsacc.TFConfig{ - // { - // TFConfig: ` - // resource "cloudavenue_backup" "example_3" { - // type = "vm" - // target_name = cloudavenue_vm.example.name - // policies = [{ - // policy_name = "D6" - // },{ - // policy_name = "D30" - // }] - // }`, - // Checks: []resource.TestCheckFunc{ - // resource.TestCheckResourceAttr(resourceName, "policies.0.policy_name", "D6"), - // resource.TestCheckResourceAttr(resourceName, "policies.1.policy_name", "D30"), - // }, - // }, - // }, - // // ! Imports testing - // Imports: []testsacc.TFImport{ - // { - // ImportStateIDBuilder: []string{"type", "target_name"}, - // ImportState: true, - // ImportStateVerify: true, - // ImportStateVerifyIgnore: []string{"target_id"}, - // }, - // }, - // } - // }, + "example_vm": func(_ context.Context, resourceName string) testsacc.Test { + return testsacc.Test{ + CommonChecks: []resource.TestCheckFunc{ + resource.TestCheckResourceAttrSet(resourceName, "id"), + resource.TestCheckResourceAttrSet(resourceName, "target_name"), + }, + // ! Create testing + Create: testsacc.TFConfig{ + TFConfig: ` + resource "cloudavenue_backup" "example_vm" { + type = "vm" + target_name = cloudavenue_vm.example.name + policies = [{ + policy_name = "D6" + }] + }`, + Checks: []resource.TestCheckFunc{ + resource.TestCheckResourceAttr(resourceName, "type", "vm"), + resource.TestCheckResourceAttr(resourceName, "policies.0.policy_name", "D6"), + }, + }, + // ! Updates testing + Updates: []testsacc.TFConfig{ + { + TFConfig: ` + resource "cloudavenue_backup" "example_vm" { + type = "vm" + target_name = cloudavenue_vm.example.name + policies = [{ + policy_name = "D6" + },{ + policy_name = "D30" + }] + }`, + Checks: []resource.TestCheckFunc{ + resource.TestCheckResourceAttr(resourceName, "policies.0.policy_name", "D6"), + resource.TestCheckResourceAttr(resourceName, "policies.1.policy_name", "D30"), + }, + }, + }, + // ! Imports testing + Imports: []testsacc.TFImport{ + { + ImportStateIDBuilder: []string{"type", "target_name"}, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"target_id"}, + }, + }, + } + }, } } diff --git a/internal/testsacc/catalog_acl_datasource_test.go b/internal/testsacc/catalog_acl_datasource_test.go index 48552465..9ab2d36e 100644 --- a/internal/testsacc/catalog_acl_datasource_test.go +++ b/internal/testsacc/catalog_acl_datasource_test.go @@ -26,8 +26,8 @@ func (r *CatalogACLDataSource) GetResourceName() string { return CatalogACLDataSourceName.String() } -func (r *CatalogACLDataSource) DependenciesConfig() (configs testsacc.TFData) { - configs.Append(GetResourceConfig()[CatalogACLResourceName]().GetDefaultConfig()) +func (r *CatalogACLDataSource) DependenciesConfig() (resp testsacc.DependenciesConfigResponse) { + resp.Append(GetResourceConfig()[CatalogACLResourceName]().GetDefaultConfig) return } diff --git a/internal/testsacc/catalog_acl_resource_test.go b/internal/testsacc/catalog_acl_resource_test.go index 0ab1e166..042ed479 100644 --- a/internal/testsacc/catalog_acl_resource_test.go +++ b/internal/testsacc/catalog_acl_resource_test.go @@ -27,11 +27,11 @@ func (r *CatalogACLResource) GetResourceName() string { return CatalogACLResourceName.String() } -func (r *CatalogACLResource) DependenciesConfig() (configs testsacc.TFData) { - configs.Append(GetResourceConfig()[CatalogResourceName]().GetDefaultConfig()) +func (r *CatalogACLResource) DependenciesConfig() (resp testsacc.DependenciesConfigResponse) { + resp.Append(GetResourceConfig()[CatalogResourceName]().GetDefaultConfig) // TODO After the implementation of the user resource we can use new resourceConfig - configs.Append(AddConstantConfig(testAccOrgUserResourceConfigForCatalogACL)) + resp.Append(AddConstantConfig(testAccOrgUserResourceConfigForCatalogACL)) return } diff --git a/internal/testsacc/catalog_resource_test.go b/internal/testsacc/catalog_resource_test.go index 0471ed22..05a60931 100644 --- a/internal/testsacc/catalog_resource_test.go +++ b/internal/testsacc/catalog_resource_test.go @@ -28,7 +28,7 @@ func (r *CatalogResource) GetResourceName() string { return CatalogResourceName.String() } -func (r *CatalogResource) DependenciesConfig() (configs testsacc.TFData) { +func (r *CatalogResource) DependenciesConfig() (resp testsacc.DependenciesConfigResponse) { return } diff --git a/internal/testsacc/edgegw_edgegateway_datasource_test.go b/internal/testsacc/edgegw_edgegateway_datasource_test.go index 0768fa82..5cdd9184 100644 --- a/internal/testsacc/edgegw_edgegateway_datasource_test.go +++ b/internal/testsacc/edgegw_edgegateway_datasource_test.go @@ -27,8 +27,8 @@ func (r *EdgeGatewayDataSource) GetResourceName() string { return EdgeGatewayDataSourceName.String() } -func (r *EdgeGatewayDataSource) DependenciesConfig() (configs testsacc.TFData) { - configs.Append(GetResourceConfig()[EdgeGatewayResourceName]().GetDefaultConfig()) +func (r *EdgeGatewayDataSource) DependenciesConfig() (resp testsacc.DependenciesConfigResponse) { + resp.Append(GetResourceConfig()[EdgeGatewayResourceName]().GetDefaultConfig) return } diff --git a/internal/testsacc/edgegw_edgegateway_resource_test.go b/internal/testsacc/edgegw_edgegateway_resource_test.go index 908eed3c..57748247 100644 --- a/internal/testsacc/edgegw_edgegateway_resource_test.go +++ b/internal/testsacc/edgegw_edgegateway_resource_test.go @@ -53,9 +53,9 @@ func (r *EdgeGatewayResource) GetResourceName() string { return EdgeGatewayResourceName.String() } -func (r *EdgeGatewayResource) DependenciesConfig() (configs testsacc.TFData) { - configs.Append(GetResourceConfig()[VDCResourceName]().GetDefaultConfig()) - configs.Append(GetDataSourceConfig()[Tier0VRFDataSourceName]().GetDefaultConfig()) +func (r *EdgeGatewayResource) DependenciesConfig() (resp testsacc.DependenciesConfigResponse) { + resp.Append(GetResourceConfig()[VDCResourceName]().GetDefaultConfig) + resp.Append(GetDataSourceConfig()[Tier0VRFDataSourceName]().GetDefaultConfig) return } diff --git a/internal/testsacc/network_routed_resource_test.go b/internal/testsacc/network_routed_resource_test.go index 14640249..25d9e6e8 100644 --- a/internal/testsacc/network_routed_resource_test.go +++ b/internal/testsacc/network_routed_resource_test.go @@ -27,8 +27,8 @@ func (r *NetworkRoutedResource) GetResourceName() string { return NetworkRoutedResourceName.String() } -func (r *NetworkRoutedResource) DependenciesConfig() (configs testsacc.TFData) { - configs.Append(GetResourceConfig()[EdgeGatewayResourceName]().GetDefaultConfig()) +func (r *NetworkRoutedResource) DependenciesConfig() (resp testsacc.DependenciesConfigResponse) { + resp.Append(GetResourceConfig()[EdgeGatewayResourceName]().GetDefaultConfig) return } diff --git a/internal/testsacc/s3_bucket_cors_configuration_datasource_test.go b/internal/testsacc/s3_bucket_cors_configuration_datasource_test.go index d5b68ad0..b28a416d 100644 --- a/internal/testsacc/s3_bucket_cors_configuration_datasource_test.go +++ b/internal/testsacc/s3_bucket_cors_configuration_datasource_test.go @@ -26,9 +26,9 @@ func (r *S3BucketCorsConfigurationDataSource) GetResourceName() string { return S3BucketCorsConfigurationDataSourceName.String() } -func (r *S3BucketCorsConfigurationDataSource) DependenciesConfig() (configs testsacc.TFData) { +func (r *S3BucketCorsConfigurationDataSource) DependenciesConfig() (resp testsacc.DependenciesConfigResponse) { // Add dependencies config to the resource - configs.Append(GetResourceConfig()[S3BucketCorsConfigurationResourceName]().GetDefaultConfig()) + resp.Append(GetResourceConfig()[S3BucketCorsConfigurationResourceName]().GetDefaultConfig) return } diff --git a/internal/testsacc/s3_bucket_cors_configuration_resource_test.go b/internal/testsacc/s3_bucket_cors_configuration_resource_test.go index 5a9a5837..b97ebc1b 100644 --- a/internal/testsacc/s3_bucket_cors_configuration_resource_test.go +++ b/internal/testsacc/s3_bucket_cors_configuration_resource_test.go @@ -26,8 +26,8 @@ func (r *S3BucketCorsConfigurationResource) GetResourceName() string { return S3BucketCorsConfigurationResourceName.String() } -func (r *S3BucketCorsConfigurationResource) DependenciesConfig() (configs testsacc.TFData) { - configs.Append(GetResourceConfig()[S3BucketResourceName]().GetDefaultConfig()) +func (r *S3BucketCorsConfigurationResource) DependenciesConfig() (resp testsacc.DependenciesConfigResponse) { + resp.Append(GetResourceConfig()[S3BucketResourceName]().GetDefaultConfig) return } diff --git a/internal/testsacc/s3_bucket_datasource_test.go b/internal/testsacc/s3_bucket_datasource_test.go index 98a7a618..04770e27 100644 --- a/internal/testsacc/s3_bucket_datasource_test.go +++ b/internal/testsacc/s3_bucket_datasource_test.go @@ -26,8 +26,8 @@ func (r *S3BucketDatasource) GetResourceName() string { return S3BucketDatasourceName.String() } -func (r *S3BucketDatasource) DependenciesConfig() (configs testsacc.TFData) { - configs.Append(GetResourceConfig()[S3BucketResourceName]().GetDefaultConfig()) +func (r *S3BucketDatasource) DependenciesConfig() (resp testsacc.DependenciesConfigResponse) { + resp.Append(GetResourceConfig()[S3BucketResourceName]().GetDefaultConfig) return } diff --git a/internal/testsacc/s3_bucket_resource_test.go b/internal/testsacc/s3_bucket_resource_test.go index 6652c573..6c27b5ec 100644 --- a/internal/testsacc/s3_bucket_resource_test.go +++ b/internal/testsacc/s3_bucket_resource_test.go @@ -27,7 +27,7 @@ func (r *S3BucketResource) GetResourceName() string { return S3BucketResourceName.String() } -func (r *S3BucketResource) DependenciesConfig() (configs testsacc.TFData) { +func (r *S3BucketResource) DependenciesConfig() (resp testsacc.DependenciesConfigResponse) { return } diff --git a/internal/testsacc/s3_bucket_versioning_configuration_datasource_test.go b/internal/testsacc/s3_bucket_versioning_configuration_datasource_test.go index 25395c56..30e1a77e 100644 --- a/internal/testsacc/s3_bucket_versioning_configuration_datasource_test.go +++ b/internal/testsacc/s3_bucket_versioning_configuration_datasource_test.go @@ -26,9 +26,9 @@ func (r *S3BucketVersioningConfigurationDatasource) GetResourceName() string { return S3BucketVersioningConfigurationDatasourceName.String() } -func (r *S3BucketVersioningConfigurationDatasource) DependenciesConfig() (configs testsacc.TFData) { +func (r *S3BucketVersioningConfigurationDatasource) DependenciesConfig() (resp testsacc.DependenciesConfigResponse) { // Add dependencies config to the resource - configs.Append(GetResourceConfig()[S3BucketVersioningConfigurationResourceName]().GetDefaultConfig()) + resp.Append(GetResourceConfig()[S3BucketVersioningConfigurationResourceName]().GetDefaultConfig) return } diff --git a/internal/testsacc/s3_bucket_versioning_configuration_resource_test.go b/internal/testsacc/s3_bucket_versioning_configuration_resource_test.go index e8f6a464..1002b236 100644 --- a/internal/testsacc/s3_bucket_versioning_configuration_resource_test.go +++ b/internal/testsacc/s3_bucket_versioning_configuration_resource_test.go @@ -26,8 +26,8 @@ func (r *S3BucketVersioningConfigurationResource) GetResourceName() string { return S3BucketVersioningConfigurationResourceName.String() } -func (r *S3BucketVersioningConfigurationResource) DependenciesConfig() (configs testsacc.TFData) { - configs.Append(GetResourceConfig()[S3BucketResourceName]().GetDefaultConfig()) +func (r *S3BucketVersioningConfigurationResource) DependenciesConfig() (resp testsacc.DependenciesConfigResponse) { + resp.Append(GetResourceConfig()[S3BucketResourceName]().GetDefaultConfig) return } diff --git a/internal/testsacc/tier0_vrf_datasource_test.go b/internal/testsacc/tier0_vrf_datasource_test.go index 26646d8f..68a99e50 100644 --- a/internal/testsacc/tier0_vrf_datasource_test.go +++ b/internal/testsacc/tier0_vrf_datasource_test.go @@ -27,7 +27,7 @@ func (r *Tier0VRFDataSource) GetResourceName() string { return Tier0VRFDataSourceName.String() } -func (r *Tier0VRFDataSource) DependenciesConfig() (configs testsacc.TFData) { +func (r *Tier0VRFDataSource) DependenciesConfig() (resp testsacc.DependenciesConfigResponse) { return } diff --git a/internal/testsacc/vapp_org_network_resource_test.go b/internal/testsacc/vapp_org_network_resource_test.go index 3e43c58c..510bb59f 100644 --- a/internal/testsacc/vapp_org_network_resource_test.go +++ b/internal/testsacc/vapp_org_network_resource_test.go @@ -27,9 +27,9 @@ func (r *VAppOrgNetworkResource) GetResourceName() string { return VAppOrgNetworkResourceName.String() } -func (r *VAppOrgNetworkResource) DependenciesConfig() (configs testsacc.TFData) { - configs.Append(GetResourceConfig()[VAppResourceName]().GetDefaultConfig()) - configs.Append(GetResourceConfig()[NetworkRoutedResourceName]().GetDefaultConfig()) +func (r *VAppOrgNetworkResource) DependenciesConfig() (resp testsacc.DependenciesConfigResponse) { + resp.Append(GetResourceConfig()[VAppResourceName]().GetDefaultConfig) + resp.Append(GetResourceConfig()[NetworkRoutedResourceName]().GetDefaultConfig) return } diff --git a/internal/testsacc/vapp_resource_test.go b/internal/testsacc/vapp_resource_test.go index 48e08650..80e7a437 100644 --- a/internal/testsacc/vapp_resource_test.go +++ b/internal/testsacc/vapp_resource_test.go @@ -44,8 +44,8 @@ func (r *VAppResource) GetResourceName() string { return VAppResourceName.String() } -func (r *VAppResource) DependenciesConfig() (configs testsacc.TFData) { - configs.Append(GetResourceConfig()[VDCResourceName]().GetDefaultConfig()) +func (r *VAppResource) DependenciesConfig() (resp testsacc.DependenciesConfigResponse) { + resp.Append(GetResourceConfig()[VDCResourceName]().GetDefaultConfig) return } diff --git a/internal/testsacc/vdc_datasource_test.go b/internal/testsacc/vdc_datasource_test.go index dc202a24..ef24825f 100644 --- a/internal/testsacc/vdc_datasource_test.go +++ b/internal/testsacc/vdc_datasource_test.go @@ -27,8 +27,8 @@ func (r *VDCDataSource) GetResourceName() string { return VDCDataSourceName.String() } -func (r *VDCDataSource) DependenciesConfig() (configs testsacc.TFData) { - configs.Append(GetResourceConfig()[VDCResourceName]().GetDefaultConfig()) +func (r *VDCDataSource) DependenciesConfig() (resp testsacc.DependenciesConfigResponse) { + resp.Append(GetResourceConfig()[VDCResourceName]().GetDefaultConfig) return } diff --git a/internal/testsacc/vdc_group_datasource_test.go b/internal/testsacc/vdc_group_datasource_test.go index eaed5cf0..04ee8d0c 100644 --- a/internal/testsacc/vdc_group_datasource_test.go +++ b/internal/testsacc/vdc_group_datasource_test.go @@ -26,8 +26,8 @@ func (r *VDCGroupDataSource) GetResourceName() string { return VDCGroupDataSourceName.String() } -func (r *VDCGroupDataSource) DependenciesConfig() (configs testsacc.TFData) { - configs.Append(GetResourceConfig()[VDCGroupResourceName]().GetDefaultConfig()) +func (r *VDCGroupDataSource) DependenciesConfig() (resp testsacc.DependenciesConfigResponse) { + resp.Append(GetResourceConfig()[VDCGroupResourceName]().GetDefaultConfig) return } diff --git a/internal/testsacc/vdc_group_resource_test.go b/internal/testsacc/vdc_group_resource_test.go index 074d90ca..bfd467c5 100644 --- a/internal/testsacc/vdc_group_resource_test.go +++ b/internal/testsacc/vdc_group_resource_test.go @@ -27,9 +27,9 @@ func (r *VDCGroupResource) GetResourceName() string { return VDCGroupResourceName.String() } -func (r *VDCGroupResource) DependenciesConfig() (configs testsacc.TFData) { - configs.Append(GetResourceConfig()[VDCResourceName]().GetSpecificConfig("example")) - configs.Append(GetResourceConfig()[VDCResourceName]().GetSpecificConfig("example_2")) +func (r *VDCGroupResource) DependenciesConfig() (resp testsacc.DependenciesConfigResponse) { + resp.Append(GetResourceConfig()[VDCResourceName]().GetSpecificConfig("example")) + resp.Append(GetResourceConfig()[VDCResourceName]().GetSpecificConfig("example_2")) return } diff --git a/internal/testsacc/vdc_resource_test.go b/internal/testsacc/vdc_resource_test.go index 478eaa9a..338236b8 100644 --- a/internal/testsacc/vdc_resource_test.go +++ b/internal/testsacc/vdc_resource_test.go @@ -28,7 +28,7 @@ func (r *VDCResource) GetResourceName() string { return VDCResourceName.String() } -func (r *VDCResource) DependenciesConfig() (configs testsacc.TFData) { +func (r *VDCResource) DependenciesConfig() (resp testsacc.DependenciesConfigResponse) { return }