From 6d3df0f251612c3e800b197bcd7d2fc3b9962e1c Mon Sep 17 00:00:00 2001 From: beevital Date: Mon, 15 Jan 2024 15:32:23 +0100 Subject: [PATCH] Test check --- fivetran/common/config_field.go | 6 ++-- fivetran/framework/provider.go | 9 +++-- fivetran/resource_connector_test.go | 55 +++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 7 deletions(-) diff --git a/fivetran/common/config_field.go b/fivetran/common/config_field.go index 567eebd6..c9f56956 100644 --- a/fivetran/common/config_field.go +++ b/fivetran/common/config_field.go @@ -68,7 +68,8 @@ func GetDestinationSchemaFields() map[string]map[string]bool { func GetAuthFieldsMap() map[string]ConfigField { if len(configFields) == 0 { - panic("Fields for auth are not loaded") + //panic("Fields for auth are not loaded") + LoadAuthFieldsMap() } return authFields } @@ -89,7 +90,8 @@ func LoadConfigFieldsMap() { func GetConfigFieldsMap() map[string]ConfigField { if len(configFields) == 0 { - panic("Fields for config are not loaded") + //panic("Fields for config are not loaded") + LoadConfigFieldsMap() } return configFields } diff --git a/fivetran/framework/provider.go b/fivetran/framework/provider.go index d7e2ccf9..78c40402 100644 --- a/fivetran/framework/provider.go +++ b/fivetran/framework/provider.go @@ -7,7 +7,6 @@ import ( "github.com/fivetran/go-fivetran" httputils "github.com/fivetran/go-fivetran/http_utils" - "github.com/fivetran/terraform-provider-fivetran/fivetran/common" "github.com/fivetran/terraform-provider-fivetran/fivetran/framework/datasources" "github.com/fivetran/terraform-provider-fivetran/fivetran/framework/resources" "github.com/hashicorp/terraform-plugin-framework/datasource" @@ -30,15 +29,15 @@ type fivetranProviderModel struct { } func FivetranProvider() provider.Provider { - common.LoadConfigFieldsMap() - common.LoadAuthFieldsMap() + //common.LoadConfigFieldsMap() + //common.LoadAuthFieldsMap() return &fivetranProvider{mockClient: nil} } // For mocked tests func FivetranProviderMock(client httputils.HttpClient) provider.Provider { - common.LoadConfigFieldsMap() - common.LoadAuthFieldsMap() + //common.LoadConfigFieldsMap() + //common.LoadAuthFieldsMap() return &fivetranProvider{mockClient: client} } diff --git a/fivetran/resource_connector_test.go b/fivetran/resource_connector_test.go index 0648d5b9..85cadd3c 100644 --- a/fivetran/resource_connector_test.go +++ b/fivetran/resource_connector_test.go @@ -10,6 +10,61 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) +func TestResourceConnectorMultithreadingE2E(t *testing.T) { + resource.Test(t, resource.TestCase{ + PreCheck: func() {}, + ProtoV6ProviderFactories: ProtoV6ProviderFactories, + CheckDestroy: testFivetranConnectorResourceDestroy, + Steps: []resource.TestStep{ + { + Config: ` + resource "fivetran_group" "test_group" { + provider = fivetran-provider + name = "test_group_name" + } + + resource "fivetran_connector" "test_connector" { + provider = fivetran-provider + group_id = fivetran_group.test_group.id + service = "fivetran_log" + destination_schema { + name = "fivetran_log_schema" + } + + trust_certificates = false + trust_fingerprints = false + run_setup_tests = false + + config { + group_name = fivetran_group.test_group.name + } + } + + resource "fivetran_connector" "test_connector_2" { + provider = fivetran-provider + group_id = fivetran_group.test_group.id + service = "fivetran_log" + + destination_schema { + name = "fivetran_log_schema_2" + } + + trust_certificates = false + trust_fingerprints = false + run_setup_tests = false + + config { + group_name = fivetran_group.test_group.name + } + } + + `, + Check: resource.ComposeAggregateTestCheckFunc(), + }, + }, + }) +} + func TestResourceConnectorE2E(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() {},