diff --git a/internal/acctest/acctest.go b/internal/acctest/acctest.go index 94660e11..14457208 100644 --- a/internal/acctest/acctest.go +++ b/internal/acctest/acctest.go @@ -4,9 +4,8 @@ import ( "context" "fmt" "net/http" - "strings" - "os" + "strings" "testing" "github.com/hashicorp/terraform-plugin-go/tfprotov6" diff --git a/internal/acctest/models.go b/internal/acctest/models.go index 17ca579d..d10902e6 100644 --- a/internal/acctest/models.go +++ b/internal/acctest/models.go @@ -7,72 +7,6 @@ import ( dv "github.com/samir-gandhi/davinci-client-go/davinci" ) -type flowResource struct { - Name string - FlowJson string - Subflows []string - // slice of connectorIds one word lowercased without word "connector". Ex: "httpConnector" -> "http" - Connections []string -} - -type TestFlowsJson struct { - Simple string - SimpleSettingDrift string - SimpleInputSchemaDrift string - SimpleOutputSchemaDrift string - Drifted string - Mainflow string - MainflowDrifted string - Subflow string - AnotherMainflow string - AnotherSubflow string - WithVariableConnector string - BrokenFlow string - PingOneSessionMainFlow string - PingOneSessionMainFlowUpdate string - PingOneSessionSubFlow string - FlowContextVarFlow string -} - -type TestFlowsHcl struct { - // A simple flow with minimal external dependencies - Simple FlowHcl - SimpleSettingDrift FlowHcl - SimpleInputSchemaDrift FlowHcl - SimpleOutputSchemaDrift FlowHcl - Drifted FlowHcl - //Depends on Subflow and AnotherSubflow - Mainflow FlowHcl - MainflowDrifted FlowHcl - Subflow FlowHcl - AnotherMainflow FlowHcl - AnotherSubflow FlowHcl - WithVariableConnector FlowHcl - BrokenFlow FlowHcl - PingOneSessionMainFlow FlowHcl - PingOneSessionMainFlowUpdate FlowHcl - PingOneSessionSubFlow FlowHcl - FlowContextVarFlow FlowHcl -} - -type FlowHcl struct { - Name string - Hcl string -} - -// Simple connection name/id pair to be converted in TestFlowsHcl. -type flowConnection struct { - ConnectorId string - Name string - Id string -} - -type TestConnections struct { - Http string - CrowdStrike string - Flow string -} - type TestConnection struct { ResourcePrefix string Name string diff --git a/internal/acctest/testdata.go b/internal/acctest/testdata.go index fc2c1f9d..9c7453a2 100644 --- a/internal/acctest/testdata.go +++ b/internal/acctest/testdata.go @@ -49,35 +49,3 @@ func ReadFlowJsonFile(path string) (string, error) { return string(mainFlowJsonBytes), nil } - -func makeSubflowsHcl(resourceName string, subflows []string) (subflowsHcl string) { - for _, subflowName := range subflows { - subflowsHcl += fmt.Sprintf(` - subflow_link { - id = davinci_flow.%[1]s-%[2]s.id - name = davinci_flow.%[1]s-%[2]s.name - } - -`, resourceName, subflowName) - } - return subflowsHcl -} - -func makeFlowConnectionsHcl(resourceName string, connections []string) (connectionsHcl string) { - for _, connName := range connections { - rName := fmt.Sprintf("davinci_connection.%s-%s", resourceName, connName) - // if _, ok := bsConnections[connName]; ok { - // rName = "data." + rName - // } - - connectionsHcl += fmt.Sprintf(` - connection_link { - id = %[1]s.id - name = %[1]s.name - } - -`, - rName) - } - return connectionsHcl -} diff --git a/internal/sdk/retry.go b/internal/sdk/retry.go index 5e2d7a77..5b145987 100644 --- a/internal/sdk/retry.go +++ b/internal/sdk/retry.go @@ -5,7 +5,6 @@ import ( "fmt" "net/http" "net/url" - "time" "github.com/hashicorp/terraform-plugin-log/tflog" diff --git a/internal/service/davinci/data_source_connection.go b/internal/service/davinci/data_source_connection.go index 1df91d71..2b4ab772 100644 --- a/internal/service/davinci/data_source_connection.go +++ b/internal/service/davinci/data_source_connection.go @@ -6,8 +6,6 @@ import ( "net/http" "time" - // "log" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" diff --git a/internal/service/davinci/data_source_connection_test.go b/internal/service/davinci/data_source_connection_test.go index 820f3ba6..ed1f8626 100644 --- a/internal/service/davinci/data_source_connection_test.go +++ b/internal/service/davinci/data_source_connection_test.go @@ -3,8 +3,6 @@ package davinci_test import ( "fmt" "regexp" - - // "os" "testing" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" diff --git a/internal/service/davinci/resource_application_flow_policy_test.go b/internal/service/davinci/resource_application_flow_policy_test.go index fa3b02b7..f693c4fe 100644 --- a/internal/service/davinci/resource_application_flow_policy_test.go +++ b/internal/service/davinci/resource_application_flow_policy_test.go @@ -584,9 +584,9 @@ resource "davinci_flow" "%[1]s-%[2]d" { EOT connection_link { - id = davinci_connection.%[1]s.id - name = davinci_connection.%[1]s.name - replace_import_connection_id = "867ed4363b2bc21c860085ad2baa817d" + id = davinci_connection.%[1]s.id + name = davinci_connection.%[1]s.name + replace_import_connection_id = "867ed4363b2bc21c860085ad2baa817d" } } `, resourceName, i, mainFlowJson) diff --git a/internal/service/davinci/resource_flow_test.go b/internal/service/davinci/resource_flow_test.go index 2dcc1e69..8b67163e 100644 --- a/internal/service/davinci/resource_flow_test.go +++ b/internal/service/davinci/resource_flow_test.go @@ -922,7 +922,7 @@ func testAccResourceFlow_Full_WithMappingIDs_HCL(resourceName, name string, with resource "davinci_flow" "%[3]s" { environment_id = pingone_environment.%[3]s.id - name = "my awesome flow" + name = "my awesome flow" description = "my awesome flow description" flow_json = <