Skip to content

Commit

Permalink
improve replace-provider's unit tests
Browse files Browse the repository at this point in the history
This seeks to add additional unit tests surrounding scenarios where...

* `terraform version` succeeds, but returns an unsupported version
* `terraform version` exits nonzero
  • Loading branch information
mdb committed Aug 24, 2023
1 parent d522a4b commit 5b6b03d
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tfexec/terraform_state_replace_provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,23 @@ func TestTerraformCLIStateReplaceProvider(t *testing.T) {
argsRe: regexp.MustCompile(`^terraform version$`),
runFunc: versionRunFunc,
stdout: "Terraform v0.12.99\n",
exitCode: 0,
},
},
state: nil,
source: "registry.terraform.io/-/null",
destination: "registry.terraform.io/hashicorp/null",
updatedState: nil,
ok: false,
},
{
desc: "when version check fails",
mockCommands: []*mockCommand{
{
args: []string{"terraform", "version"},
argsRe: regexp.MustCompile(`^terraform version$`),
runFunc: versionRunFunc,
stdout: "Terraform v1.4.7\n",
exitCode: 1,
},
},
Expand Down

0 comments on commit 5b6b03d

Please sign in to comment.