Skip to content

Commit

Permalink
dms: Fix import cycle
Browse files Browse the repository at this point in the history
  • Loading branch information
YakDriver committed May 14, 2024
1 parent 955eb8f commit 86eb0c2
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 11 deletions.
13 changes: 13 additions & 0 deletions internal/service/dms/exports_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package dms

// Exports for use in tests only.
var (
TaskSettingsEqual = taskSettingsEqual
ValidEndpointID = validEndpointID
ValidReplicationInstanceID = validReplicationInstanceID
ValidReplicationSubnetGroupID = validReplicationSubnetGroupID
ValidReplicationTaskID = validReplicationTaskID
)
5 changes: 3 additions & 2 deletions internal/service/dms/task_settings_json_test.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package dms
package dms_test

import (
"testing"

"github.com/hashicorp/terraform-provider-aws/internal/acctest"
tfdms "github.com/hashicorp/terraform-provider-aws/internal/service/dms"
"github.com/hashicorp/terraform-provider-aws/names"
)

Expand Down Expand Up @@ -162,7 +163,7 @@ func TestTaskSettingsEqual(t *testing.T) {
t.Run(name, func(t *testing.T) {
t.Parallel()

if taskSettingsEqual(test.a, test.b) != test.expected {
if tfdms.TaskSettingsEqual(test.a, test.b) != test.expected {
t.Fatalf("expected %v, got %v", test.expected, !test.expected)
}
})
Expand Down
20 changes: 11 additions & 9 deletions internal/service/dms/validate_test.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package dms
package dms_test

import (
"testing"

tfdms "github.com/hashicorp/terraform-provider-aws/internal/service/dms"
)

func TestValidEndpointID(t *testing.T) {
Expand All @@ -16,7 +18,7 @@ func TestValidEndpointID(t *testing.T) {
}

for _, s := range validIds {
_, errors := validEndpointID(s, "endpoint_id")
_, errors := tfdms.ValidEndpointID(s, "endpoint_id")
if len(errors) > 0 {
t.Fatalf("%q should be a valid endpoint id: %v", s, errors)
}
Expand All @@ -33,7 +35,7 @@ func TestValidEndpointID(t *testing.T) {
}

for _, s := range invalidIds {
_, errors := validEndpointID(s, "endpoint_id")
_, errors := tfdms.ValidEndpointID(s, "endpoint_id")
if len(errors) == 0 {
t.Fatalf("%q should not be a valid endpoint id: %v", s, errors)
}
Expand All @@ -49,7 +51,7 @@ func TestValidReplicationInstanceID(t *testing.T) {
}

for _, s := range validIds {
_, errors := validReplicationInstanceID(s, "replicaiton_instance_id")
_, errors := tfdms.ValidReplicationInstanceID(s, "replicaiton_instance_id")
if len(errors) > 0 {
t.Fatalf("%q should be a valid replication instance id: %v", s, errors)
}
Expand All @@ -66,7 +68,7 @@ func TestValidReplicationInstanceID(t *testing.T) {
}

for _, s := range invalidIds {
_, errors := validReplicationInstanceID(s, "replication_instance_id")
_, errors := tfdms.ValidReplicationInstanceID(s, "replication_instance_id")
if len(errors) == 0 {
t.Fatalf("%q should not be a valid replication instance id: %v", s, errors)
}
Expand All @@ -85,7 +87,7 @@ func TestValidReplicationSubnetGroupID(t *testing.T) {
}

for _, s := range validIds {
_, errors := validReplicationSubnetGroupID(s, "replication_subnet_group_id")
_, errors := tfdms.ValidReplicationSubnetGroupID(s, "replication_subnet_group_id")
if len(errors) > 0 {
t.Fatalf("%q should be a valid replication subnet group id: %v", s, errors)
}
Expand All @@ -98,7 +100,7 @@ func TestValidReplicationSubnetGroupID(t *testing.T) {
}

for _, s := range invalidIds {
_, errors := validReplicationSubnetGroupID(s, "replication_subnet_group_id")
_, errors := tfdms.ValidReplicationSubnetGroupID(s, "replication_subnet_group_id")
if len(errors) == 0 {
t.Fatalf("%q should not be a valid replication subnet group id: %v", s, errors)
}
Expand All @@ -114,7 +116,7 @@ func TestValidReplicationTaskID(t *testing.T) {
}

for _, s := range validIds {
_, errors := validReplicationTaskID(s, "replication_task_id")
_, errors := tfdms.ValidReplicationTaskID(s, "replication_task_id")
if len(errors) > 0 {
t.Fatalf("%q should be a valid replication task id: %v", s, errors)
}
Expand All @@ -131,7 +133,7 @@ func TestValidReplicationTaskID(t *testing.T) {
}

for _, s := range invalidIds {
_, errors := validReplicationTaskID(s, "replication_task_id")
_, errors := tfdms.ValidReplicationTaskID(s, "replication_task_id")
if len(errors) == 0 {
t.Fatalf("%q should not be a valid replication task id: %v", s, errors)
}
Expand Down

0 comments on commit 86eb0c2

Please sign in to comment.