-
Notifications
You must be signed in to change notification settings - Fork 178
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
feat: Updates migration tests to run separately and use last released version of provider for plan checks #1565
Conversation
unit-test step failing due to issue with |
@@ -88,7 +88,7 @@ jobs: | |||
- uses: actions/checkout@v4 | |||
- name: Run ShellCheck | |||
uses: bewuethr/shellcheck-action@v2 | |||
call-accettance-tests-workflow: | |||
call-acceptance-tests-workflow: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
finally, thanks! :-)
|
||
project: | ||
needs: [ change-detection ] | ||
if: ${{ needs.change-detection.outputs.project == 'true' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' || github.event.label.name == 'run-testacc-migration' || github.event.label.name == 'run-testacc-project-migration' || inputs.parent-event-name == 'release' }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i know we have this in other gh actions but I wonder if we could make this easier or have some functions or something
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps we could start fixing this file and then a follow-up to change the others?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lantoli I couldn't find a way to make this reusable or use a function, is there any example or reference you could share?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about the best way, but for instance what about creating a variable in the workflow and use the variable? something like:
on: ...
env:
hasToTrigger: ${{ needs.change-detection.outputs.config == 'true' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' || github.event.label.name == 'run-testacc-migration' || github.event.label.name == 'run-testacc-config-migration' || inputs.parent-event-name == 'release' }}
job...
and use:
if: ${{ env.hasToTrigger }}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or use it for the common part and then:
if: ${{ env.hasToTrigger }} || specific conditions here...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since this doesn't hold a static value, rather holds a condition, i don't believe this is possible to do via a variable as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i suppose it's possible while you use variables that are know before starting execution
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed, see comment #1565 (comment)
|
||
config: | ||
needs: [ change-detection ] | ||
if: ${{ needs.change-detection.outputs.config == 'true' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' || github.event.label.name == 'run-testacc-migration' || github.event.label.name == 'run-testacc-config-migration' || inputs.parent-event-name == 'release' }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
orgID = os.Getenv("MONGODB_ATLAS_ORG_ID") | ||
projectName = acctest.RandomWithPrefix("test-acc") | ||
clusterName = acctest.RandomWithPrefix("test-acc-cluster") | ||
lastVersionConstraint = os.Getenv("MONGODB_ATLAS_LAST_VERSION") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to check that this env var exists?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice catch, will update
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor comments, but LGTM!
|
||
project: | ||
needs: [ change-detection ] | ||
if: ${{ needs.change-detection.outputs.project == 'true' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' || github.event.label.name == 'run-testacc-migration' || github.event.label.name == 'run-testacc-project-migration' || inputs.parent-event-name == 'release' }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps we could start fixing this file and then a follow-up to change the others?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great idea having the version update automatically, gives proper value to the migration tests
types: [ labeled ] | ||
|
||
jobs: | ||
set-output: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lantoli tried with another step: https://github.com/mongodb/terraform-provider-mongodbatlas/pull/1565/files#diff-9e63d3ed50a83cef3c77bb7447f2858374bc51e6dd94ac7f65b3420205c70ea6
This is an example PR running this workflow: maastha#1
Let me know if this approach makes sense, not sure if this is possible with a variable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's great, thanks!
I just realised something now: why do we call them |
@marcosuma I think it's Hashicorp naming |
Description
This PR adds a new Github action workflow 'Migration Tests' and separates out existing migration acceptance tests into this workflow only i.e. migration tests will no longer run as part of existing Acceptance tests workflows in PRs.
What are 'Migration tests'?
Migration tests are similar to Terraform acceptance tests but focus on ensuring that empty plans are generated when upgrading from a previous released version to the current version of the Terraform provider. See documentation.
Releases: This workflow will run during release and use the last released version of our provider to run migration tests to ensure no unexpected plans are generated when our users upgrade.
Manual: This workflow can be manually run if required, using labels or via UI.
We can eventually disable these tests to run for every PR as migration tests usually cover scenarios already covered by acceptance tests, and require to only run these during releases or manually.
NOTE: This workflow was not tested for a run during release.
NOTE: This PR also introduces convention to use prefix
TestAccMigration*
for all migration tests.Link to any related issue(s):
Type of change:
Required Checklist:
Further comments