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: Supports running cloud gov tests in CI #2302

Merged
merged 8 commits into from
May 27, 2024

Conversation

EspenAlbert
Copy link
Collaborator

@EspenAlbert EspenAlbert commented May 24, 2024

Description

Supports running cloud gov tests in CI.

Follow-up PR with a gov migration and acceptance test: #2291

Solution discussion

Uses a fully configured provider when using cloud-gov, why?

  1. Enables running gov tests in the same process as cloud-dev/cloud-qa tests
  2. Keeps the CI simple with a single acceptance-tests job and we can run the tests often

Alternatives considered:

  1. Modify env-vars for each cloud-gov test run (similar to t.Setenv("MONGODB_ATLAS_LAST_VERSION", "1.2.3") but with MONGODB_ATLAS_PRIVATE/PUBLIC_KEY/BASE_URL++
  • Does not allow running tests in parallel since env-vars would impact the "normal" acceptance tests
  1. Run a separate process/workflow
  • Would require different CI workflows, but config would be a bit shorter as the provider would read env-vars directly

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

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

@EspenAlbert EspenAlbert marked this pull request as ready for review May 24, 2024 15:31
@EspenAlbert EspenAlbert requested a review from a team as a code owner May 24, 2024 15:31
internal/testutil/acc/factory.go Outdated Show resolved Hide resolved
2. Use the [`acc.ConfigGovProvider`](https://github.com/mongodb/terraform-provider-mongodbatlas/blob/CLOUDP-250271_cloud_gov/internal/testutil/acc/provider.go#L61) together with your normal terraform config
3. Modify the `checkExist` and `CheckDestroy` to use `acc.ConnV2UsingGov`
4. Follow naming convention:
1. `TestAccGovProject_withProjectOwner`, note prefix: `TestAccGov`
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
1. `TestAccGovProject_withProjectOwner`, note prefix: `TestAccGov`
1. `TestAccProject_govWithProjectOwner`, note prefix: `TestAccGov`

not a strong opinion but like the idea of leaving the first part before the underscore only with the resource, and second part giving detail of the test case (as shown in tf docs)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think using it in the first part makes regex selection simpler.
Although with this approach it might not be necessary 🤔 WDYT?

Copy link
Member

Choose a reason for hiding this comment

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

I think using it in the first part makes regex selection simpler

Not sure if I understand this point given we wont need to identify gov tests from others

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good discussion. Added a bit more context in c888aff

internal/testutil/acc/provider.go Outdated Show resolved Hide resolved
@EspenAlbert EspenAlbert merged commit 7304d61 into master May 27, 2024
32 checks passed
@EspenAlbert EspenAlbert deleted the CLOUDP-250271_cloud_gov branch May 27, 2024 08:29
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