Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Enables AWS encryption_at_rest acceptance tests to run in CI #3000

Open
wants to merge 20 commits into
base: CLOUDP-262752-ear-aws-kms-dev
Choose a base branch
from

Conversation

maastha
Copy link
Collaborator

@maastha maastha commented Jan 23, 2025

Description

Enables AWS encryption_at_rest acceptance tests to run in CI

Link to any related issue(s): CLOUDP-293831

Type of change:

  • Bug fix (non-breaking change which fixes an issue). Please, add the "bug" label to the PR.
  • New feature (non-breaking change which adds functionality). Please, add the "enhancement" label to the PR. A migration guide must be created or updated if the new feature will go in a major version.
  • Breaking change (fix or feature that would cause existing functionality to not work as expected). Please, add the "breaking change" label to the PR. A migration guide must be created or updated.
  • This change requires a documentation update
  • Documentation fix/enhancement

Required Checklist:

  • I have signed the MongoDB CLA
  • I have read the contributing guides
  • I have checked that this change does not generate any credentials and that they are NOT accidentally logged anywhere.
  • I have added tests that prove my fix is effective or that my feature works per HashiCorp requirements
  • I have added any necessary documentation (if appropriate)
  • I have run make fmt and formatted my code
  • If changes include deprecations or removals I have added appropriate changelog entries.
  • If changes include removal or addition of 3rd party GitHub actions, I updated our internal document. Reach out to the APIx Integration slack channel to get access to the internal document.

Further comments

Base automatically changed from CLOUDP-295878-ear-pe to CLOUDP-262752-ear-aws-kms-dev January 24, 2025 11:32
@maastha maastha changed the title ci: Enables AWS encryption_at_rest acceptance tests to run in CI chore: Enables AWS encryption_at_rest acceptance tests to run in CI Jan 24, 2025
@maastha maastha marked this pull request as ready for review January 24, 2025 16:24
@maastha maastha requested a review from a team as a code owner January 24, 2025 16:24
@@ -625,6 +633,8 @@ jobs:

encryption:
needs: [ change-detection, get-provider-version ]
concurrency:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each test run for encryption takes about ~8min to complete. Since the tests use shared resources, I want to prevent multiple simultaneous runs.
I'm thinking as a follow-up I can separate out AWS and Azure tests in separate jobs using ACCTEST_REGEX_RUN to reduce the test run time more.
Will wait to see if any other suggestions.

Copy link
Member

@lantoli lantoli Jan 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see tests are using resource.Test instead of resource.ParallelTest, so I understand it's in case this is running in multiple PRs / test suites.

The main issue I see, as cancel-in-progress=false, is that there can be some pile-up of jobs, and for example some PR checks are blocked until older ones finish, if some gets stucks, it can be a long time until they time out. This could also block Test Suite.

but we can go ahead and see if this happens

AWS_SECRET_ACCESS_KEY: ${{ secrets.aws_secret_access_key }}
AWS_ACCESS_KEY_ID: ${{ secrets.aws_access_key_id }}
AWS_CUSTOMER_MASTER_KEY_ID: ${{ secrets.aws_customer_master_key_id }}
MONGODB_ATLAS_PROJECT_EAR_PE_AWS_ID: ${{ inputs.mongodb_atlas_project_ear_pe_aws_id }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

n00b question: what does PE stand for?

if os.Getenv("AWS_ACCESS_KEY_ID") == "" ||
os.Getenv("AWS_SECRET_ACCESS_KEY") == "" ||
os.Getenv("AWS_CUSTOMER_MASTER_KEY_ID") == "" ||
os.Getenv("MONGODB_ATLAS_PROJECT_EAR_PE_AWS_ID") == "" ||
os.Getenv("AWS_PRIVATE_ENDPOINT_REGION") == "" {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just checking is this change correct? what is the diff between the two EV?

ExternalProviders: acc.ExternalProvidersOnlyAWS(),
ProtoV6ProviderFactories: acc.TestAccProviderV6Factories,
CheckDestroy: acc.EARDestroy,
Steps: []resource.TestStep{
{
Config: testAccMongoDBAtlasEncryptionAtRestConfigAwsKmsWithRole(projectID, awsIAMRoleName, awsIAMRolePolicyName, awsKeyName, &awsKms),
Check: resource.ComposeAggregateTestCheckFunc(
acc.CheckEARExists(resourceName),
resource.TestCheckResourceAttr(resourceName, "project_id", projectID),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

being a TPF resource, consider checking only computed values

@@ -625,6 +633,8 @@ jobs:

encryption:
needs: [ change-detection, get-provider-version ]
concurrency:
group: ${{ github.repository }}-global-ear-concurrency
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why the ${{ github.repository}}?

@@ -27,14 +25,14 @@ func TestMigEncryptionAtRest_basicAWS(t *testing.T) {
Enabled: conversion.Pointer(true),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as earlier PR 😅
Why we cannot refactor out the test case?

acc.CheckEARExists(resourceName),
resource.TestCheckResourceAttr(resourceName, "project_id", projectID),
resource.TestCheckResourceAttr(resourceName, "aws_kms_config.0.customer_master_key_id", awsKms.GetCustomerMasterKeyID()),
resource.TestCheckResourceAttr(resourceName, "aws_kms_config.0.egion", awsKms.GetRegion()),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: egion

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure the tests are running in CI?

}
}

func PreCheckEncryptionAtRestEnvAWS(tb testing.TB) {
tb.Helper()
PreCheckBasic(tb) // temp
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// temp ?

@EspenAlbert
Copy link
Collaborator

Any reason why TestMigEncryptionAtRest_withRole_basicAWS is still skipped?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants