tests/provisioner/powershell: Add acceptance test to reproduce issue 4916

This commit is contained in:
Wilken Rivera 2020-04-09 05:03:56 -04:00
parent 6ad67f6800
commit 13e0c1a097
2 changed files with 14 additions and 0 deletions

View File

@ -39,6 +39,15 @@ func TestAccPowershellProvisioner_Script(t *testing.T) {
acc.TestProvisionersAgainstBuilders(&testProvisioner, t)
}
func TestPowershellProvisioner_Invalid(t *testing.T) {
acc.TestProvisionersPreCheck(TestProvisionerName, t)
// This test should fail with a non-zero exit code. To assert the failure the fixture
// uses the valid_exit_codes option to confirm a non-zero exit code
testProvisioner := PowershellProvisionerAccTest{"powershell-provisioner-invalid.txt"}
acc.TestProvisionersAgainstBuilders(&testProvisioner, t)
}
type PowershellProvisionerAccTest struct {
ConfigName string
}

View File

@ -0,0 +1,5 @@
{
"type": "powershell",
"inline": "this is not a valid powershell command",
"valid_exit_codes": ["1"]
}