From 86eb0c233e6a41cece131bc4d4d285e08bbed111 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Tue, 14 May 2024 17:13:54 -0400 Subject: [PATCH] dms: Fix import cycle --- internal/service/dms/exports_test.go | 13 ++++++++++++ .../service/dms/task_settings_json_test.go | 5 +++-- internal/service/dms/validate_test.go | 20 ++++++++++--------- 3 files changed, 27 insertions(+), 11 deletions(-) create mode 100644 internal/service/dms/exports_test.go diff --git a/internal/service/dms/exports_test.go b/internal/service/dms/exports_test.go new file mode 100644 index 00000000000..89008c13954 --- /dev/null +++ b/internal/service/dms/exports_test.go @@ -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 +) diff --git a/internal/service/dms/task_settings_json_test.go b/internal/service/dms/task_settings_json_test.go index c73657bae94..8d5f46f1b0b 100644 --- a/internal/service/dms/task_settings_json_test.go +++ b/internal/service/dms/task_settings_json_test.go @@ -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" ) @@ -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) } }) diff --git a/internal/service/dms/validate_test.go b/internal/service/dms/validate_test.go index e16967deeaa..881385adcb3 100644 --- a/internal/service/dms/validate_test.go +++ b/internal/service/dms/validate_test.go @@ -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) { @@ -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) } @@ -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) } @@ -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) } @@ -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) } @@ -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) } @@ -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) } @@ -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) } @@ -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) }