Skip to content

Commit

Permalink
lint corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickcping committed Mar 22, 2024
1 parent e529a39 commit 7284c66
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 177 deletions.
3 changes: 1 addition & 2 deletions internal/acctest/acctest.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ import (
"context"
"fmt"
"net/http"
"strings"

"os"
"strings"
"testing"

"github.com/hashicorp/terraform-plugin-go/tfprotov6"
Expand Down
66 changes: 0 additions & 66 deletions internal/acctest/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
32 changes: 0 additions & 32 deletions internal/acctest/testdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
1 change: 0 additions & 1 deletion internal/sdk/retry.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"fmt"
"net/http"
"net/url"

"time"

"github.com/hashicorp/terraform-plugin-log/tflog"
Expand Down
2 changes: 0 additions & 2 deletions internal/service/davinci/data_source_connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 0 additions & 2 deletions internal/service/davinci/data_source_connection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package davinci_test
import (
"fmt"
"regexp"

// "os"
"testing"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading

0 comments on commit 7284c66

Please sign in to comment.