mirror of
https://github.com/hashicorp/packer.git
synced 2026-06-09 08:42:33 -04:00
test: error on plugin loading if not compiled
When building the temporary plugin directory for a test, we didn't check that the LoadPluginVersion call succeeded and returned a path, which may cause errors down the line when attempting to install the plugin. To avoid this problem, we do the check at that time, and immediately fail if a plugin isn't found.
This commit is contained in:
parent
3d437ede99
commit
fe564c579b
1 changed files with 4 additions and 1 deletions
|
|
@ -170,7 +170,10 @@ func (ts *PackerTestSuite) MakePluginDir(pluginVersions ...string) (pluginTempDi
|
|||
}
|
||||
|
||||
for _, pluginVersion := range pluginVersions {
|
||||
path, _ := LoadPluginVersion(pluginVersion)
|
||||
path, ok := LoadPluginVersion(pluginVersion)
|
||||
if !ok {
|
||||
err = fmt.Errorf("failed to get path to version %q, was it compiled?", pluginVersion)
|
||||
}
|
||||
cmd := ts.PackerCommand().SetArgs("plugins", "install", "--path", path, "github.com/hashicorp/tester").AddEnv("PACKER_PLUGIN_PATH", pluginTempDir)
|
||||
cmd.Assert(t, MustSucceed{})
|
||||
out, stderr, cmdErr := cmd.Run()
|
||||
|
|
|
|||
Loading…
Reference in a new issue