-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: reuse test case for migration test
- Loading branch information
1 parent
e398e2a
commit a1db931
Showing
1 changed file
with
3 additions
and
54 deletions.
There are no files selected for viewing
57 changes: 3 additions & 54 deletions
57
...ervice/privatelinkendpointservice/resource_privatelink_endpoint_service_migration_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
} |