From a1db931f80eef64a1236de10f755527fe10b6f85 Mon Sep 17 00:00:00 2001 From: EspenAlbert Date: Thu, 2 May 2024 10:26:17 +0100 Subject: [PATCH] test: reuse test case for migration test --- ...atelink_endpoint_service_migration_test.go | 57 +------------------ 1 file changed, 3 insertions(+), 54 deletions(-) diff --git a/internal/service/privatelinkendpointservice/resource_privatelink_endpoint_service_migration_test.go b/internal/service/privatelinkendpointservice/resource_privatelink_endpoint_service_migration_test.go index 1befe9340d..1d7cf7ef72 100644 --- a/internal/service/privatelinkendpointservice/resource_privatelink_endpoint_service_migration_test.go +++ b/internal/service/privatelinkendpointservice/resource_privatelink_endpoint_service_migration_test.go @@ -1,63 +1,12 @@ package privatelinkendpointservice_test import ( - "fmt" - "os" "testing" - "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "github.com/hashicorp/terraform-plugin-testing/plancheck" - "github.com/mongodb/terraform-provider-mongodbatlas/internal/testutil/acc" "github.com/mongodb/terraform-provider-mongodbatlas/internal/testutil/mig" ) -func TestMigNetworkRSPrivateLinkEndpointService_Complete(t *testing.T) { - acc.SkipTestForCI(t) // needs AWS configuration - - var ( - resourceSuffix = "test" - resourceName = fmt.Sprintf("mongodbatlas_privatelink_endpoint_service.%s", resourceSuffix) - - awsAccessKey = os.Getenv("AWS_ACCESS_KEY_ID") - awsSecretKey = os.Getenv("AWS_SECRET_ACCESS_KEY") - - providerName = "AWS" - projectID = os.Getenv("MONGODB_ATLAS_PROJECT_ID") - region = os.Getenv("AWS_REGION") - vpcID = os.Getenv("AWS_VPC_ID") - subnetID = os.Getenv("AWS_SUBNET_ID") - securityGroupID = os.Getenv("AWS_SECURITY_GROUP_ID") - ) - - resource.Test(t, resource.TestCase{ - PreCheck: func() { acc.PreCheck(t); acc.PreCheckAwsEnvPrivateLinkEndpointService(t) }, - CheckDestroy: checkDestroy, - Steps: []resource.TestStep{ - { - ExternalProviders: mig.ExternalProvidersWithAWS(), - Config: configCompleteAWS( - awsAccessKey, awsSecretKey, projectID, providerName, region, vpcID, subnetID, securityGroupID, resourceSuffix, - ), - Check: resource.ComposeTestCheckFunc( - checkExists(resourceName), - resource.TestCheckResourceAttrSet(resourceName, "project_id"), - resource.TestCheckResourceAttrSet(resourceName, "private_link_id"), - resource.TestCheckResourceAttrSet(resourceName, "endpoint_service_id"), - ), - }, - { - ExternalProviders: acc.ExternalProvidersOnlyAWS(), - ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, - Config: configCompleteAWS( - awsAccessKey, awsSecretKey, projectID, providerName, region, vpcID, subnetID, securityGroupID, resourceSuffix, - ), - ConfigPlanChecks: resource.ConfigPlanChecks{ - PreApply: []plancheck.PlanCheck{ - acc.DebugPlan(), - plancheck.ExpectEmptyPlan(), - }, - }, - }, - }, - }) +func TestMigNetworkNetworkPeering_basicAWS(t *testing.T) { + // can only be one privatelinkendpointservice per project + mig.CreateTestAndRunUseExternalProviderNonParallel(t, basicAWSTestCase(t), mig.ExternalProvidersWithAWS(), nil) }