diff --git a/test/commands_test.go b/test/commands_test.go index 003d26a23..d35dcafc0 100644 --- a/test/commands_test.go +++ b/test/commands_test.go @@ -33,6 +33,11 @@ func (ts *PackerTestSuite) PackerCommand() *packerCommand { } } +// UsePluginDir sets the plugin directory in the environment to `dir` +func (pc *packerCommand) UsePluginDir(dir string) *packerCommand { + return pc.AddEnv("PACKER_PLUGIN_PATH", dir) +} + func (pc *packerCommand) SetArgs(args ...string) *packerCommand { pc.args = args return pc diff --git a/test/loading_test.go b/test/loading_test.go index e31decb2c..19381e7bc 100644 --- a/test/loading_test.go +++ b/test/loading_test.go @@ -37,7 +37,7 @@ func (ts *PackerTestSuite) TestLoadingOrder() { t.Run(tt.name, func(t *testing.T) { ts.PackerCommand(). SetArgs(command, tt.templatePath). - AddEnv("PACKER_PLUGIN_PATH", pluginDir). + UsePluginDir(pluginDir). Assert(t, MustSucceed{}, Grep{ streams: BothStreams, expect: tt.grepStr,