add tests for unknown values

This commit is contained in:
Adrien Delorme 2020-09-01 13:07:45 +02:00
parent 161879b98a
commit a25f057984
3 changed files with 37 additions and 1 deletions

View File

@ -69,11 +69,13 @@ local.fruit: "banana"
<no post-processor>
`},
{[]string{"inspect", "-var=fruit=peach", filepath.Join(testFixture("hcl"), "inspect", "fruit_string.pkr.hcl")}, nil, `Packer Inspect: HCL2 mode
{[]string{"inspect", "-var=fruit=peach", "-var=unknown_string=also_peach", `-var=unknown_unknown="peach_too"`, filepath.Join(testFixture("hcl"), "inspect", "fruit_string.pkr.hcl")}, nil, `Packer Inspect: HCL2 mode
> input-variables:
var.fruit: "peach"
var.unknown_string: "also_peach"
var.unknown_unknown: "peach_too"
> local-variables:
@ -86,6 +88,8 @@ var.fruit: "peach"
> input-variables:
var.fruit: "peach"
var.unknown_string: "<unknown>"
var.unknown_unknown: "<unknown>"
> local-variables:
@ -121,6 +125,26 @@ Use it at will.
manifest
shell-local
`},
{[]string{"inspect", filepath.Join(testFixture("inspect"), "unset_var.json")}, nil, `Packer Inspect: JSON mode
Required variables:
something
Optional variables and their defaults:
Builders:
<No builders>
Provisioners:
<No provisioners>
Note: If your build names contain user variables or template
functions such as 'timestamp', these are processed at build time,
and therefore only show in their raw form here.
`},
}

View File

@ -3,3 +3,10 @@ variable "fruit" {
type = string
default = "banana"
}
variable "unknown_string" {
type = string
}
variable "unknown_unknown" {
}

View File

@ -0,0 +1,5 @@
{
"variables": {
"something": null
}
}