Skip to content

Commit

Permalink
chore(goimports): goimports -w -local github.com/equinix/terraform-pr…
Browse files Browse the repository at this point in the history
…ovider-equinix on networkedge files

Signed-off-by: Marques Johansson <[email protected]>
  • Loading branch information
displague committed Sep 25, 2024
1 parent 6a72bf7 commit 8709181
Show file tree
Hide file tree
Showing 14 changed files with 27 additions and 77 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import (
"fmt"
"testing"

"github.com/equinix/terraform-provider-equinix/internal/acceptance"
"github.com/equinix/terraform-provider-equinix/internal/nprintf"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-testing/helper/resource"

"github.com/equinix/terraform-provider-equinix/internal/acceptance"
"github.com/equinix/terraform-provider-equinix/internal/nprintf"
)

const (
Expand Down
3 changes: 2 additions & 1 deletion internal/resources/networkedge/acl_template/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import (
"testing"

"github.com/equinix/ne-go"
"github.com/equinix/terraform-provider-equinix/internal/converters"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/stretchr/testify/assert"

"github.com/equinix/terraform-provider-equinix/internal/converters"
)

func TestNetworkACLTemplate_createFromResourceData(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion internal/resources/networkedge/acl_template/sweeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import (
"log"

"github.com/equinix/ne-go"
"github.com/equinix/terraform-provider-equinix/internal/sweep"
"github.com/hashicorp/terraform-plugin-testing/helper/resource"

"github.com/equinix/terraform-provider-equinix/internal/sweep"
)

func AddTestSweeper() {
Expand Down
3 changes: 2 additions & 1 deletion internal/resources/networkedge/device/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ import (
"time"

"github.com/equinix/ne-go"
"github.com/equinix/terraform-provider-equinix/internal/converters"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/stretchr/testify/assert"

"github.com/equinix/terraform-provider-equinix/internal/converters"
)

func TestNetworkDevice_createFromResourceData(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion internal/resources/networkedge/device/sweeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import (
"log"

"github.com/equinix/ne-go"
"github.com/equinix/terraform-provider-equinix/internal/sweep"
"github.com/hashicorp/terraform-plugin-testing/helper/resource"

"github.com/equinix/terraform-provider-equinix/internal/sweep"
)

func AddTestSweeper() {
Expand Down
3 changes: 2 additions & 1 deletion internal/resources/networkedge/device_link/sweeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import (
"log"

"github.com/equinix/ne-go"
"github.com/equinix/terraform-provider-equinix/internal/sweep"
"github.com/hashicorp/terraform-plugin-testing/helper/resource"

"github.com/equinix/terraform-provider-equinix/internal/sweep"
)

func AddTestSweeper() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import (
"fmt"
"testing"

"github.com/hashicorp/terraform-plugin-testing/helper/resource"

"github.com/equinix/terraform-provider-equinix/internal/acceptance"
"github.com/equinix/terraform-provider-equinix/internal/nprintf"
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
)

func TestAccDataSourceNetworkDeviceSoftware_versionRegex(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import (
"fmt"
"testing"

"github.com/equinix/terraform-provider-equinix/internal/acceptance"
"github.com/equinix/terraform-provider-equinix/internal/nprintf"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-testing/helper/resource"

"github.com/equinix/terraform-provider-equinix/internal/acceptance"
"github.com/equinix/terraform-provider-equinix/internal/nprintf"
)

const networkDeviceMetroEnvVar = "TF_ACC_NETWORK_DEVICE_METRO"
Expand Down
1 change: 1 addition & 0 deletions internal/resources/networkedge/file/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

"github.com/equinix/ne-go"
"github.com/equinix/rest-go"

"github.com/equinix/terraform-provider-equinix/internal/config"
equinix_validation "github.com/equinix/terraform-provider-equinix/internal/validation"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import (
"fmt"
"testing"

"github.com/hashicorp/terraform-plugin-testing/helper/resource"

"github.com/equinix/terraform-provider-equinix/internal/acceptance"
"github.com/equinix/terraform-provider-equinix/internal/nprintf"
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
)

func TestAccDataSourceNetworkDevicePlatform_basic(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion internal/resources/networkedge/ssh_key/sweeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import (
"log"

"github.com/equinix/ne-go"
"github.com/equinix/terraform-provider-equinix/internal/sweep"
"github.com/hashicorp/terraform-plugin-testing/helper/resource"

"github.com/equinix/terraform-provider-equinix/internal/sweep"
)

func AddTestSweeper() {
Expand Down
63 changes: 0 additions & 63 deletions internal/resources/networkedge/ssh_user/resource_acc_test.go
Original file line number Diff line number Diff line change
@@ -1,67 +1,4 @@
package ssh_user

import (
"fmt"

"github.com/equinix/terraform-provider-equinix/internal/acceptance"
"github.com/equinix/terraform-provider-equinix/internal/comparisons"
"github.com/equinix/terraform-provider-equinix/internal/config"

"github.com/equinix/ne-go"
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
"github.com/hashicorp/terraform-plugin-testing/terraform"
)

// SSH User acc tests are in Device acc test tests
// reason: SSH User requires device to be provisioned and that is time consuming operation

type testAccConfig struct {
ctx map[string]interface{}
config string
}

func newTestAccConfig(ctx map[string]interface{}) *testAccConfig {
return &testAccConfig{
ctx: ctx,
config: "",
}
}

func (t *testAccConfig) build() string {
return t.config
}

func testAccNeSSHUserExists(resourceName string, user *ne.SSHUser) resource.TestCheckFunc {
return func(s *terraform.State) error {
rs, ok := s.RootModule().Resources[resourceName]
if !ok {
return fmt.Errorf("resource not found: %s", resourceName)
}
if rs.Primary.ID == "" {
return fmt.Errorf("resource has no ID attribute set")
}
client := acceptance.TestAccProvider.Meta().(*config.Config).Ne
resp, err := client.GetSSHUser(rs.Primary.ID)
if err != nil {
return fmt.Errorf("error when fetching SSH user '%s': %s", rs.Primary.ID, err)
}
*user = *resp
return nil
}
}

func testAccNeSSHUserAttributes(user *ne.SSHUser, devices []*ne.Device, ctx map[string]interface{}) resource.TestCheckFunc {
return func(s *terraform.State) error {
if v, ok := ctx["username"]; ok && ne.StringValue(user.Username) != v.(string) {
return fmt.Errorf("name does not match %v - %v", ne.StringValue(user.Username), v)
}
deviceIDs := make([]string, len(devices))
for i := range devices {
deviceIDs[i] = ne.StringValue(devices[i].UUID)
}
if !comparisons.SlicesMatch(deviceIDs, user.DeviceUUIDs) {
return fmt.Errorf("device_ids does not match %v - %v", deviceIDs, user.DeviceUUIDs)
}
return nil
}
}
3 changes: 2 additions & 1 deletion internal/resources/networkedge/ssh_user/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import (
"testing"

"github.com/equinix/ne-go"
"github.com/equinix/terraform-provider-equinix/internal/converters"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/stretchr/testify/assert"

"github.com/equinix/terraform-provider-equinix/internal/converters"
)

func TestNetworkSSHUser_resourceFromResourceData(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion internal/resources/networkedge/ssh_user/sweeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import (
"log"

"github.com/equinix/ne-go"
"github.com/equinix/terraform-provider-equinix/internal/sweep"
"github.com/hashicorp/terraform-plugin-testing/helper/resource"

"github.com/equinix/terraform-provider-equinix/internal/sweep"
)

func AddTestSweeper() {
Expand Down

0 comments on commit 8709181

Please sign in to comment.