From 6f93eec99ba558eab37c2f2ef68b5aa6c4eeaf5a Mon Sep 17 00:00:00 2001 From: Lucas Bajolet Date: Tue, 7 May 2024 11:03:38 -0400 Subject: [PATCH] test: add test for loading plugins with wd plugin Add one more test to ensure we don't load plugins with the old naming convention in the workdir for a packer run. --- test/loading_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/loading_test.go b/test/loading_test.go index a5715317c..20ff7071d 100644 --- a/test/loading_test.go +++ b/test/loading_test.go @@ -62,6 +62,17 @@ func (ts *PackerTestSuite) TestLoadWithLegacyPluginName() { SetArgs("build", "templates/simple.pkr.hcl"). Assert(ts.T(), MustSucceed(), Grep("packer-plugin-tester_v1\\.0\\.0[^\\n]+ plugin:", grepStderr)) }) + + wd, cleanup := TempWorkdir(ts.T(), "./templates/simple.pkr.hcl") + defer cleanup() + + CopyFile(ts.T(), filepath.Join(wd, "packer-plugin-tester"), plugin) + + ts.Run("multiple plugins installed: 1.0.0 in plugin dir with sum, one in workdir (no version). Should load 1.0.0", func() { + ts.PackerCommand().UsePluginDir(pluginDir).SetWD(wd). + SetArgs("build", "simple.pkr.hcl"). + Assert(ts.T(), MustSucceed(), Grep("packer-plugin-tester_v1\\.0\\.0[^\\n]+ plugin:", grepStderr)) + }) } func (ts *PackerTestSuite) TestLoadWithSHAMismatches() {