From 1bf3e86ee1b435334d791c83c878db1288c9e41f Mon Sep 17 00:00:00 2001 From: Lucas Bajolet Date: Wed, 17 Apr 2024 16:44:47 -0400 Subject: [PATCH] hcl2template: fix invalid_inexplicit_source_2 test The invalid_inexplicit_source_2 subtest for parse used to fail in previous versions of Packer, but with the latest changes to plugin source management, it won't, at least at parsing time, instead it fails later when the Github getter (the only available for now) cannot get the plugin binary from the source, as the source is not a valid Github URI. --- hcl2template/types.packer_config_test.go | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/hcl2template/types.packer_config_test.go b/hcl2template/types.packer_config_test.go index 391899e92..eec35860e 100644 --- a/hcl2template/types.packer_config_test.go +++ b/hcl2template/types.packer_config_test.go @@ -644,13 +644,26 @@ func TestParser_no_init(t *testing.T) { }{ VersionConstraints: nil, RequiredPlugins: []*RequiredPlugins{ - {}, + { + RequiredPlugins: map[string]*RequiredPlugin{ + "amazon": { + Name: "amazon", + Source: "hashicorp/amazon", + Type: &addrs.Plugin{ + Source: "hashicorp/amazon", + }, + Requirement: VersionConstraint{ + Required: mustVersionConstraints(version.NewConstraint(">= v0")), + }, + }, + }, + }, }, }, CorePackerVersionString: lockedVersion, Basedir: filepath.Clean("testdata/init"), }, - true, true, + false, false, []packersdk.Build{}, false, },