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

internal/plugintest: Migrate from github.com/hashicorp/terraform-exec/tfinstall to github.com/hashicorp/hc-install #825

Merged
merged 2 commits into from
Dec 6, 2021

Conversation

bflad
Copy link
Contributor

@bflad bflad commented Nov 30, 2021

Closes #823

Verification script (ran in terraform-provider-null):

#!/bin/bash

export TF_ACC=1
export TF_LOG=TRACE
export TF_ACC_LOG_PATH=/tmp/tfacctest.log
ORIGINAL_PATH="${PATH}"

function runtest() {
  # Absolute paths for PATH removal testing
  /bin/rm -f "${TF_ACC_LOG_PATH}"
  /usr/local/bin/go test -count=1 ./internal/provider
  /usr/bin/grep -E '(Terraform version|CLI args)' "${TF_ACC_LOG_PATH}" | /usr/bin/head -2
  echo ""
}

echo ""
echo "==> github.com/hashicorp/terraform-plugin-sdk/[email protected] <=="
echo ""

echo "Default (no environment variables, terraform on PATH)"
runtest

echo "TF_ACC_TERRAFORM_PATH=/usr/local/bin/terraform0.12.31"
export TF_ACC_TERRAFORM_PATH=/usr/local/bin/terraform0.12.31
runtest
unset TF_ACC_TERRAFORM_PATH

echo "TF_ACC_TERRAFORM_VERSION=0.15.5"
export TF_ACC_TERRAFORM_VERSION=0.15.5
runtest
unset TF_ACC_TERRAFORM_VERSION

echo "PATH=\"\" (terraform not in PATH)"
export PATH=""
runtest
export PATH="${ORIGINAL_PATH}"

echo ""
echo "==> github.com/hashicorp/terraform-plugin-sdk/v2@bflad-hc-install <=="
echo ""

go get github.com/hashicorp/terraform-plugin-sdk/v2@bflad-hc-install
go mod tidy
echo ""

echo "Default (no environment variables, terraform on PATH)"
runtest

echo "TF_ACC_TERRAFORM_PATH=/usr/local/bin/terraform0.12.31"
export TF_ACC_TERRAFORM_PATH=/usr/local/bin/terraform0.12.31
runtest
unset TF_ACC_TERRAFORM_PATH

echo "TF_ACC_TERRAFORM_VERSION=0.15.5"
export TF_ACC_TERRAFORM_VERSION=0.15.5
runtest
unset TF_ACC_TERRAFORM_VERSION

echo "PATH=\"\" (terraform not in PATH)"
export PATH=""
runtest
export PATH="${ORIGINAL_PATH}"

git reset --hard HEAD

Script output:


==> github.com/hashicorp/terraform-plugin-sdk/[email protected] <==

Default (no environment variables, terraform on PATH)
ok      github.com/terraform-providers/terraform-provider-null/internal/provider        5.260s
2021-11-30T16:56:35.170-0500 [INFO]  Terraform version: 1.0.11
2021-11-30T16:56:35.170-0500 [INFO]  CLI args: []string{"/usr/local/bin/terraform", "init", "-no-color", "-force-copy", "-input=false", "-backend=true", "-get=true", "-upgrade=false"}

TF_ACC_TERRAFORM_PATH=/usr/local/bin/terraform0.12.31
ok      github.com/terraform-providers/terraform-provider-null/internal/provider        4.764s
2021/11/30 16:56:42 [INFO] Terraform version: 0.12.31  
2021/11/30 16:56:42 [INFO] CLI args: []string{"/usr/local/bin/terraform0.12.31", "init", "-no-color", "-force-copy", "-input=false", "-lock-timeout=0s", "-backend=true", "-get=true", "-upgrade=false", "-lock=true", "-get-plugins=true", "-verify-plugins=true"}

TF_ACC_TERRAFORM_VERSION=0.15.5
ok      github.com/terraform-providers/terraform-provider-null/internal/provider        17.079s
2021-11-30T16:56:52.680-0500 [INFO]  Terraform version: 0.15.5
2021-11-30T16:56:52.680-0500 [INFO]  CLI args: []string{"/var/folders/w8/05f3x02n27x72g0mc2jy6_180000gp/T/plugintest-terraform2965094913/terraform", "init", "-no-color", "-force-copy", "-input=false", "-backend=true", "-get=true", "-upgrade=false"}

PATH="" (terraform not in PATH)
ok      github.com/terraform-providers/terraform-provider-null/internal/provider        13.358s
2021-11-30T16:57:09.854-0500 [INFO]  Terraform version: 1.0.11
2021-11-30T16:57:09.854-0500 [INFO]  CLI args: []string{"/var/folders/w8/05f3x02n27x72g0mc2jy6_180000gp/T/plugintest-terraform4025070953/terraform", "init", "-no-color", "-force-copy", "-input=false", "-backend=true", "-get=true", "-upgrade=false"}


==> github.com/hashicorp/terraform-plugin-sdk/v2@bflad-hc-install <==

go get: upgraded github.com/hashicorp/terraform-plugin-sdk/v2 v2.9.0 => v2.9.1-0.20211130200049-d9c4024dfd00

Default (no environment variables, terraform on PATH)
ok      github.com/terraform-providers/terraform-provider-null/internal/provider        4.993s
2021-11-30T16:57:22.506-0500 [INFO]  Terraform version: 1.0.11
2021-11-30T16:57:22.506-0500 [INFO]  CLI args: []string{"/usr/local/bin/terraform", "init", "-no-color", "-force-copy", "-input=false", "-backend=true", "-get=true", "-upgrade=false"}

TF_ACC_TERRAFORM_PATH=/usr/local/bin/terraform0.12.31
ok      github.com/terraform-providers/terraform-provider-null/internal/provider        4.091s
2021/11/30 16:57:28 [INFO] Terraform version: 0.12.31  
2021/11/30 16:57:28 [INFO] CLI args: []string{"/usr/local/bin/terraform0.12.31", "init", "-no-color", "-force-copy", "-input=false", "-lock-timeout=0s", "-backend=true", "-get=true", "-upgrade=false", "-lock=true", "-get-plugins=true", "-verify-plugins=true"}

TF_ACC_TERRAFORM_VERSION=0.15.5
ok      github.com/terraform-providers/terraform-provider-null/internal/provider        16.217s
2021-11-30T16:57:38.128-0500 [INFO]  Terraform version: 0.15.5
2021-11-30T16:57:38.128-0500 [INFO]  CLI args: []string{"/var/folders/w8/05f3x02n27x72g0mc2jy6_180000gp/T/plugintest-terraform389392671/terraform", "init", "-no-color", "-force-copy", "-input=false", "-backend=true", "-get=true", "-upgrade=false"}

PATH="" (terraform not in PATH)
ok      github.com/terraform-providers/terraform-provider-null/internal/provider        13.420s
2021-11-30T16:57:55.273-0500 [INFO]  Terraform version: 1.0.11
2021-11-30T16:57:55.273-0500 [INFO]  CLI args: []string{"/var/folders/w8/05f3x02n27x72g0mc2jy6_180000gp/T/plugintest-terraform3974429769/terraform", "init", "-no-color", "-force-copy", "-input=false", "-backend=true", "-get=true", "-upgrade=false"}

HEAD is now at 84617a8 Bump github.com/hashicorp/terraform-plugin-sdk/v2 from 2.8.0 to 2.9.0

…/tfinstall to github.com/hashicorp/hc-install

Reference: #823
@bflad bflad added technical-debt subsystem/tests Issues and feature requests related to the testing framework. labels Nov 30, 2021
@bflad bflad self-assigned this Nov 30, 2021
@bflad bflad marked this pull request as ready for review November 30, 2021 22:00
@bflad bflad removed their assignment Nov 30, 2021
@bflad bflad requested a review from a team November 30, 2021 22:01
Updated via:

```
go get github.com/hashicorp/[email protected]
go mod tidy
```
@bflad bflad added this to the v2.10.0 milestone Dec 6, 2021
@bflad bflad merged commit 6b1ff72 into main Dec 6, 2021
@bflad bflad deleted the bflad-hc-install branch December 6, 2021 14:38
@github-actions
Copy link

github-actions bot commented Jan 6, 2022

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
subsystem/tests Issues and feature requests related to the testing framework. technical-debt
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate to github.com/hashicorp/hc-install for Acceptance Testing Installation
2 participants