From 6c6039798c06a9bc3546b8baa78623185ddd017a Mon Sep 17 00:00:00 2001 From: Adrienne Cohea Date: Sun, 17 May 2020 23:27:06 -0700 Subject: [PATCH] Add test. --- hcl2template/testdata/build/named.pkr.hcl | 8 ++++++++ hcl2template/types.build_test.go | 22 ++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 hcl2template/testdata/build/named.pkr.hcl diff --git a/hcl2template/testdata/build/named.pkr.hcl b/hcl2template/testdata/build/named.pkr.hcl new file mode 100644 index 000000000..ae6dca9b8 --- /dev/null +++ b/hcl2template/testdata/build/named.pkr.hcl @@ -0,0 +1,8 @@ +build { + name = "somebuild" + + sources = [ + "source.amazon-ebs.ubuntu-1604", + "source.virtualbox-iso.ubuntu-1204", + ] +} diff --git a/hcl2template/types.build_test.go b/hcl2template/types.build_test.go index 7d45d022d..9b3c71161 100644 --- a/hcl2template/types.build_test.go +++ b/hcl2template/types.build_test.go @@ -100,6 +100,28 @@ func TestParse_build(t *testing.T) { []packer.Build{}, false, }, + {"named build", + defaultParser, + parseTestArgs{"testdata/build/named.pkr.hcl", nil, nil}, + &PackerConfig{ + Basedir: filepath.Join("testdata", "build"), + Builds: Builds{ + &BuildBlock{ + Name: "somebuild", + Sources: []SourceRef{ + { + Type: "amazon-ebs", + Name: "ubuntu-1604", + }, + refVBIsoUbuntu1204, + }, + }, + }, + }, + false, false, + []packer.Build{}, + true, + }, } testParse(t, tests) }