diff --git a/packer_test/install_test.go b/packer_test/install_test.go index abc017dd3..1f039b51e 100644 --- a/packer_test/install_test.go +++ b/packer_test/install_test.go @@ -77,10 +77,24 @@ func (ts *PackerTestSuite) TestRemoteInstallWithPluginsInstall() { SetArgs("plugins", "install", "github.com/hashicorp/hashicups"). Assert(MustSucceed()) }) +} + +func (ts *PackerTestSuite) TestRemoteInstallOfPreReleasePlugin() { + pluginPath, cleanup := ts.MakePluginDir() + defer cleanup() + + ts.Run("try to init with a pre-release constraint - should fail", func() { + ts.PackerCommand().UsePluginDir(pluginPath). + SetArgs("init", "templates/pre-release_constraint.pkr.hcl"). + Assert(MustFail(), + Grep("Invalid version constraint", grepStdout), + Grep("Unsupported prerelease for constraint", grepStdout)) + }) - ts.Run("install dev version of a remote plugin with packer plugins install - must fail", func() { + ts.Run("try to plugins install with a pre-release version - should fail", func() { ts.PackerCommand().UsePluginDir(pluginPath). - SetArgs("plugins", "install", "github.com/hashicorp/hashicups", "v1.0.2-dev"). - Assert(MustFail(), Grep("Remote installation of pre-release plugin versions is unsupported.", grepStdout)) + SetArgs("plugin", "install", "github.com/hashicorp/hashicups", "1.0.2-dev"). + Assert(MustFail(), + Grep("Unsupported prerelease for constraint", grepStdout)) }) } diff --git a/packer_test/templates/pre-release_constraint.pkr.hcl b/packer_test/templates/pre-release_constraint.pkr.hcl new file mode 100644 index 000000000..c1e56b583 --- /dev/null +++ b/packer_test/templates/pre-release_constraint.pkr.hcl @@ -0,0 +1,14 @@ +packer { + required_plugins { + tester = { + source = "github.com/hashicorp/hashicups" + version = "= 1.0.2-dev" + } + } +} + +source "tester-dynamic" "test" {} + +build { + sources = ["tester-dynamic.test"] +}