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

Acceptance Test Overhaul: Manage resources for tests in Terraform and run them on pushes to main #346

Merged
merged 7 commits into from
Nov 16, 2023

Conversation

JenGoldstrich
Copy link
Contributor

@JenGoldstrich JenGoldstrich commented Oct 26, 2023

This PR makes several changes to enable the acceptance tests for the plugin to run on pushes to main in CI.

  • Config located in ./terraform which manage the creation of several Azure resources the tests need to pass
  • Tests refactored with shared environment variable checking logic
  • Usage of variable resource group name/storage account consistently
  • Workflow added that creates SSH private key for linux ancestry, terraform applies, runs test, and destroys after the test runs, on failures it uploads log files to debug with
  • Remove AZURE_CLI_AUTH variable from ARM tests, instead the test just executes az account show to make sure Azure CLI auth is set up.
  • Temporarily remove OIDC auth workflow, this will be re-enabled after some migration inside test resources in a follow up PR.

Potential follow up work will be to add support for variable files to the packer-plugin-sdk acceptance test module, so that we can better manage resource group name and storage account, and start managing dtl lab name, and gallery name, so that these tests can be run by multiple sessions in the same Subscription

@JenGoldstrich JenGoldstrich force-pushed the acceptance-tests-terraform branch 4 times, most recently from 594d113 to 2e9a019 Compare November 11, 2023 05:26
@JenGoldstrich JenGoldstrich changed the title WIP: Manage resources required for acceptance testing in Terraform WIP: Run Acceptance Tests on pushes to main Nov 14, 2023
@JenGoldstrich JenGoldstrich force-pushed the acceptance-tests-terraform branch from 0879444 to 0ff2d25 Compare November 14, 2023 20:06
WIP

Forgot DTL resources

Update Terraform

Commit workflow for testing

Forgot to add service principal flag

Set variable for azure cli auth, auto approve terraform destroy

Use always instead of continue-on-error, and upload logs

Update acceptance-tests.yaml

Update acceptance-tests.yaml

Use variables thruout to control resource group and storage account names

Fix failing json conversions, refactor env variable checking to shared file
… OIDC Test as it no longer works in new subscription, update comments
@JenGoldstrich JenGoldstrich force-pushed the acceptance-tests-terraform branch from 0ff2d25 to 329b601 Compare November 14, 2023 21:05
@JenGoldstrich JenGoldstrich changed the title WIP: Run Acceptance Tests on pushes to main Acceptance Test Overhaul: Manage resources for tests in Terraform and run them on pushes to main Nov 14, 2023
@JenGoldstrich JenGoldstrich marked this pull request as ready for review November 14, 2023 21:10
@JenGoldstrich JenGoldstrich requested a review from a team as a code owner November 14, 2023 21:10
Copy link
Contributor

@lbajolet-hashicorp lbajolet-hashicorp left a comment

Choose a reason for hiding this comment

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

Good job here @JenGoldstrich, this looks cool, I like that we're simplifying running those tests.

I left some suggestions on some changes, feel free to accept or reject those.

LGTM!

builder/azure/arm/builder_acc_test.go Outdated Show resolved Hide resolved
builder/azure/common/acceptance_helper.go Outdated Show resolved Hide resolved
builder/azure/common/acceptance_helper.go Outdated Show resolved Hide resolved
terraform/README.md Outdated Show resolved Hide resolved
terraform/README.md Outdated Show resolved Hide resolved
terraform/README.md Outdated Show resolved Hide resolved
builder/azure/dtl/builder_acc_test.go Show resolved Hide resolved
JenGoldstrich and others added 4 commits November 15, 2023 16:31
Co-authored-by: Lucas Bajolet <105649352+lbajolet-hashicorp@users.noreply.github.com>
Co-authored-by: Lucas Bajolet <105649352+lbajolet-hashicorp@users.noreply.github.com>
@JenGoldstrich JenGoldstrich merged commit bcc0154 into main Nov 16, 2023
11 checks passed
@JenGoldstrich JenGoldstrich deleted the acceptance-tests-terraform branch November 16, 2023 02:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants