test unknown variables and locals

This commit is contained in:
Adrien Delorme 2020-08-27 11:55:57 +02:00
parent 652878059c
commit 161879b98a
2 changed files with 28 additions and 1 deletions

View File

@ -15,6 +15,33 @@ func Test_commands(t *testing.T) {
env []string
expected string
}{
{[]string{"inspect", filepath.Join(testFixture("var-arg"), "fruit_builder.pkr.hcl")}, nil, `Packer Inspect: HCL2 mode
> input-variables:
var.fruit: "<unknown>"
> local-variables:
local.fruit: "<unknown>"
> builds:
> <unnamed build 0>:
sources:
null.builder
provisioners:
shell-local
post-processors:
<no post-processor>
`},
{[]string{"inspect", "-var=fruit=banana", filepath.Join(testFixture("var-arg"), "fruit_builder.pkr.hcl")}, nil, `Packer Inspect: HCL2 mode
> input-variables:

View File

@ -1,6 +1,6 @@
{
"variables": {
"fruit": ""
"fruit": null
},
"builders": [
{