packer_test: test non-canonical plugin loading

If a plugin is installed with a non-canonical version in its name (e.g.
01.01.01), Packer rejects it with a message to that effect in stderr, so
we add a test for this use-case.
pull/13032/head
Lucas Bajolet 2 years ago committed by Lucas Bajolet
parent 707e40e2e6
commit a49da98350

@ -159,3 +159,21 @@ func (ts *PackerTestSuite) TestPluginPathEnvvarWithMultiplePaths() {
SetTester(IntCompare(eq, 2)))
})
}
func (ts *PackerTestSuite) TestInstallNonCanonicalPluginVersion() {
pluginPath, cleanup := ts.MakePluginDir()
defer cleanup()
ManualPluginInstall(ts.T(),
filepath.Join(pluginPath, "github.com", "hashicorp", "tester"),
BuildSimplePlugin("1.0.10", ts.T()),
"001.00.010")
ts.Run("try listing plugins with non-canonical version installed - report none", func() {
ts.PackerCommand().UsePluginDir(pluginPath).
SetArgs("plugins", "installed").
Assert(MustSucceed(),
Grep(`version .* in path is non canonical`, grepStderr),
MkPipeCheck("no output in stdout").SetTester(ExpectEmptyInput()).SetStream(OnlyStdout))
})
}

Loading…
Cancel
Save