Skip to content

Commit

Permalink
Test check
Browse files Browse the repository at this point in the history
  • Loading branch information
beevital committed Jan 15, 2024
1 parent fa27574 commit 6d3df0f
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 7 deletions.
6 changes: 4 additions & 2 deletions fivetran/common/config_field.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
}
Expand Down
9 changes: 4 additions & 5 deletions fivetran/framework/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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}
}

Expand Down
55 changes: 55 additions & 0 deletions fivetran/resource_connector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {},
Expand Down

0 comments on commit 6d3df0f

Please sign in to comment.