Skip to content

Commit

Permalink
git action
Browse files Browse the repository at this point in the history
  • Loading branch information
maastha committed Apr 10, 2024
1 parent e7ddaa6 commit 4f10761
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/acceptance-tests-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,8 @@ jobs:
terraform_wrapper: false
- name: Acceptance Tests
env:
AWS_ACCESS_KEY_ID: ${{ secrets.aws_access_key_id }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.aws_secret_access_key }}
ACCTEST_PACKAGES: |
./internal/service/serverlessinstance
./internal/service/privatelinkendpointserverless
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ func TestMigServerlessPrivateLinkEndpointService_noComment(t *testing.T) {
orgID = os.Getenv("MONGODB_ATLAS_ORG_ID")
projectName = acc.RandomProjectName()
instanceName = acc.RandomClusterName()
config = configAWSEndpoint(orgID, projectName, instanceName, true, "test comment")
awsAccessKey = os.Getenv("AWS_ACCESS_KEY_ID")
awsSecretKey = os.Getenv("AWS_SECRET_ACCESS_KEY")
config = configAWSEndpoint(orgID, projectName, instanceName, awsAccessKey, awsSecretKey, true, "test comment")
)

resource.ParallelTest(t, resource.TestCase{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ func TestAccServerlessPrivateLinkEndpointService_AWSEndpointCommentUpdate(t *tes
projectName = acc.RandomProjectName()
instanceName = acc.RandomClusterName()
commentUpdated = "this is updated comment for serverless private link endpoint"
awsAccessKey = os.Getenv("AWS_ACCESS_KEY_ID")
awsSecretKey = os.Getenv("AWS_SECRET_ACCESS_KEY")
)

resource.ParallelTest(t, resource.TestCase{
Expand All @@ -82,7 +84,7 @@ func TestAccServerlessPrivateLinkEndpointService_AWSEndpointCommentUpdate(t *tes
CheckDestroy: checkDestroy,
Steps: []resource.TestStep{
{
Config: configAWSEndpoint(orgID, projectName, instanceName, false, ""),
Config: configAWSEndpoint(orgID, projectName, instanceName, awsAccessKey, awsSecretKey, false, ""),
Check: resource.ComposeTestCheckFunc(
checkExists(resourceName),
resource.TestCheckResourceAttr(resourceName, "provider_name", "AWS"),
Expand All @@ -92,7 +94,7 @@ func TestAccServerlessPrivateLinkEndpointService_AWSEndpointCommentUpdate(t *tes
),
},
{
Config: configAWSEndpoint(orgID, projectName, instanceName, true, commentUpdated),
Config: configAWSEndpoint(orgID, projectName, instanceName, awsAccessKey, awsSecretKey, true, commentUpdated),
Check: resource.ComposeTestCheckFunc(
checkExists(resourceName),
resource.TestCheckResourceAttr(resourceName, "provider_name", "AWS"),
Expand All @@ -103,7 +105,7 @@ func TestAccServerlessPrivateLinkEndpointService_AWSEndpointCommentUpdate(t *tes
),
},
{
Config: configAWSEndpoint(orgID, projectName, instanceName, true, commentUpdated),
Config: configAWSEndpoint(orgID, projectName, instanceName, awsAccessKey, awsSecretKey, true, commentUpdated),
ResourceName: resourceName,
ImportStateIdFunc: importStateIDFunc(resourceName),
ImportState: true,
Expand Down Expand Up @@ -241,7 +243,7 @@ resource "aws_security_group" "primary_default" {
}`
}

func configAWSEndpoint(orgID, projectName, instanceName string, updateComment bool, comment string) string {
func configAWSEndpoint(orgID, projectName, instanceName, awsAccessKey, awsSecretKey string, updateComment bool, comment string) string {
peServiceServerless := `resource "mongodbatlas_privatelink_endpoint_service_serverless" "test" {
project_id = mongodbatlas_privatelink_endpoint_serverless.test.project_id
instance_name = mongodbatlas_serverless_instance.test.name
Expand All @@ -261,6 +263,11 @@ func configAWSEndpoint(orgID, projectName, instanceName string, updateComment bo
}

return fmt.Sprintf(`
provider "aws" {
region = "us-east-1"
access_key = "%[6]s"
secret_key = "%[7]s"
}
resource "mongodbatlas_project" "test" {
name = %[2]q
Expand Down Expand Up @@ -306,7 +313,7 @@ func configAWSEndpoint(orgID, projectName, instanceName string, updateComment bo
endpoint_id = mongodbatlas_privatelink_endpoint_service_serverless.test.endpoint_id
}
`, orgID, projectName, instanceName, configAWSVPCEndpoint(), peServiceServerless)
`, orgID, projectName, instanceName, configAWSVPCEndpoint(), peServiceServerless, awsAccessKey, awsSecretKey)
}

func checkExists(resourceName string) resource.TestCheckFunc {
Expand Down

0 comments on commit 4f10761

Please sign in to comment.