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: Single Github Action for migration and acceptance tests #2156

Merged
merged 5 commits into from
Apr 17, 2024

Conversation

lantoli
Copy link
Member

@lantoli lantoli commented Apr 16, 2024

Description

Single Github Action for migration and acceptance tests.

Fixes network and project test groups so acc and mig tests can run together.

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

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 defined an isolated PR with a relevant title as it will be used in the auto-generated changelog.
  • 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

@lantoli lantoli marked this pull request as ready for review April 17, 2024 07:18
@lantoli lantoli requested a review from a team as a code owner April 17, 2024 07:18
@@ -103,13 +107,30 @@ env:
TF_ACC: 1
TF_LOG: ${{ vars.LOG_LEVEL }}
ACCTEST_TIMEOUT: ${{ vars.ACCTEST_TIMEOUT }}
ACCTEST_REGEX_RUN: "^TestAcc"
# Only Migration tests are run when testing a specific previous provider version instead of the latest one
ACCTEST_REGEX_RUN: ${{ inputs.provider_version == '' && '^Test(Acc|Mig)' || '^TestMig' }}
Copy link
Member Author

Choose a reason for hiding this comment

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

@EspenAlbert thanks for your suggestion!

@@ -57,13 +59,14 @@ func TestMigNetworkContainer_basicAzure(t *testing.T) {

func TestMigNetworkContainer_basicGCP(t *testing.T) {
var (
projectID = acc.ProjectIDExecution(t) // No mig.ProjectIDGlobal because network container
Copy link
Member

Choose a reason for hiding this comment

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

[q] Now that migration and acceptance test run in the same package execution, is there value in preserving mig.ProjectIDGlobal? My understanding is that ProjectIDExecution could be used if the resource package is already using it for acceptance tests.

Copy link
Member Author

Choose a reason for hiding this comment

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

you read my mind :-) i was planning a follow-up PR to delete mig.ProjectIDGlobal

Comment on lines 62 to 66
uses: ./.github/workflows/acceptance-tests.yml
with:
terraform_version: ${{ matrix.terraform_version }}
provider_version: ${{ matrix.provider_version }}
atlas_cloud_env: ${{ inputs.atlas_cloud_env }}
Copy link
Member

Choose a reason for hiding this comment

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

[q] If the test suite is executed with a list of provider versions (for migration tests), acceptance tests would only be run if the value "" is also included right?

Copy link
Member Author

Choose a reason for hiding this comment

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

correct

@lantoli lantoli requested a review from AgustinBettati April 17, 2024 08:38
Copy link
Collaborator

@EspenAlbert EspenAlbert left a comment

Choose a reason for hiding this comment

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

Nice 👍
🤔 would there be a way of sorting the jobs.change-detection.steps.filter in acceptance-tests-runner.yml?
Did a little smoke test to see if any paths are lost between the migration-tests.yml and acceptance-tests-runner.yml and it looked good, did you double check?

@lantoli
Copy link
Member Author

lantoli commented Apr 17, 2024

@EspenAlbert I double-checked but I agree. I also wanted to do a follow-up PR doing that and also trying to simplify, so for instance we don't need to define twice things like:

          generic:
            - 'internal/service/backupcompliancepolicy/*.go'
            - 'internal/service/auditing/*.go'
            - 'internal/service/x509authenticationdatabaseuser/*.go'

          ACCTEST_PACKAGES: |
            ./internal/service/backupcompliancepolicy
            ./internal/service/auditing
            ./internal/service/x509authenticationdatabaseuser

@lantoli lantoli merged commit 4580a37 into master Apr 17, 2024
45 checks passed
@lantoli lantoli deleted the CLOUDP-241162_acc branch April 17, 2024 10:11
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.

3 participants