Skip to content

Commit

Permalink
ci: Concurrent Provider Acceptance Tests against Different Terraform …
Browse files Browse the repository at this point in the history
…Versions (#124)

## What

* Concurrent provider acceptance tests against different terraform
versions
* Install Terraform beforehand, do not delegate Terraform SDK v2 to do
download and install Terraform

## Why

* There is an issue caused when parallel Terraform Provider acceptance
tests install Terraform at the same time. Explained fairly well in
hashicorp/terraform-provider-kubernetes#2256
* Better testing by using different versions of the Terraform binary (3
latest stable minor versions — their latest stable patch version
resolved by
[terraform-switcher](https://github.com/warrensbox/terraform-switcher)
aka `tfswitch`)

## Notes

* Will probably need to test against OpenTofu in the future

## Checklist

* [x] _I have read
[CONTRIBUTING.md](https://github.com/codefresh-io/terraform-provider-codefresh/blob/master/CONTRIBUTING.md)._
* [x] _I have [allowed changes to my fork to be
made](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork)._
* [x] _I have added tests, assuming new tests are warranted_.
* [x] _I understand that the `/test` comment will be ignored by the CI
trigger [unless it is made by a repo admin or
collaborator](https://codefresh.io/docs/docs/pipelines/triggers/git-triggers/#support-for-building-pull-requests-from-forks)._
  • Loading branch information
korenyoni authored Oct 3, 2023
1 parent 887901f commit e9e9559
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion codefresh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,24 @@ steps:
go_test:
title: "Run tests"
stage: test
image: goreleaser/goreleaser:v1.17.0
image: golang:1.18.10-alpine3.17
environment:
- TF_ACC="test"
- CGO_ENABLED=0
commands:
- go install github.com/warrensbox/[email protected]
- terraform-switcher --latest-stable ${TF_VERSION}
- go test -v ./...
retry:
maxAttempts: 3
delay: 5
exponentialFactor: 2
matrix:
# The following will resolve to their latest patch version
environment:
- TF_VERSION=1.3.0
- TF_VERSION=1.4.0
- TF_VERSION=1.5.0

prepare_env_vars:
title: "Preparing environment variables..."
Expand Down

0 comments on commit e9e9559

Please sign in to comment.