From 161879b98a62414b4efdb95f7be6368fa63f94f6 Mon Sep 17 00:00:00 2001 From: Adrien Delorme Date: Thu, 27 Aug 2020 11:55:57 +0200 Subject: [PATCH] test unknown variables and locals --- command/inspect_test.go | 27 +++++++++++++++++++ .../test-fixtures/var-arg/fruit_builder.json | 2 +- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/command/inspect_test.go b/command/inspect_test.go index 2e8f09908..52c00009d 100644 --- a/command/inspect_test.go +++ b/command/inspect_test.go @@ -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: "" + +> local-variables: + +local.fruit: "" + +> builds: + + > : + + sources: + + null.builder + + provisioners: + + shell-local + + post-processors: + + + +`}, {[]string{"inspect", "-var=fruit=banana", filepath.Join(testFixture("var-arg"), "fruit_builder.pkr.hcl")}, nil, `Packer Inspect: HCL2 mode > input-variables: diff --git a/command/test-fixtures/var-arg/fruit_builder.json b/command/test-fixtures/var-arg/fruit_builder.json index abda09077..9d6831c8b 100644 --- a/command/test-fixtures/var-arg/fruit_builder.json +++ b/command/test-fixtures/var-arg/fruit_builder.json @@ -1,6 +1,6 @@ { "variables": { - "fruit": "" + "fruit": null }, "builders": [ {