2024-06-12 15:38:21 -04:00
|
|
|
package plugin_tests
|
2024-05-01 15:36:39 -04:00
|
|
|
|
|
|
|
|
import (
|
2024-05-03 16:39:09 -04:00
|
|
|
"crypto/sha256"
|
|
|
|
|
"fmt"
|
2024-05-10 11:23:05 -04:00
|
|
|
"os"
|
2024-05-03 16:39:09 -04:00
|
|
|
"path/filepath"
|
2024-06-12 15:38:21 -04:00
|
|
|
|
2024-08-15 10:05:27 -04:00
|
|
|
"github.com/hashicorp/packer/packer_test/common"
|
|
|
|
|
"github.com/hashicorp/packer/packer_test/common/check"
|
2024-05-01 15:36:39 -04:00
|
|
|
)
|
|
|
|
|
|
2024-06-12 15:38:21 -04:00
|
|
|
func (ts *PackerPluginTestSuite) TestLoadingOrder() {
|
2024-08-15 14:09:33 -04:00
|
|
|
pluginDir := ts.MakePluginDir().InstallPluginVersions("1.0.9", "1.0.10")
|
|
|
|
|
defer pluginDir.Cleanup()
|
2024-05-01 15:36:39 -04:00
|
|
|
|
2024-05-03 11:06:16 -04:00
|
|
|
for _, command := range []string{"build", "validate"} {
|
|
|
|
|
tests := []struct {
|
|
|
|
|
name string
|
|
|
|
|
templatePath string
|
|
|
|
|
grepStr string
|
|
|
|
|
}{
|
|
|
|
|
{
|
|
|
|
|
"HCL2 " + command + " - With required_plugins, 1.0.10 is the most recent and should load",
|
|
|
|
|
"./templates/simple.pkr.hcl",
|
|
|
|
|
"packer-plugin-tester_v1\\.0\\.10[^\n]+ plugin:",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"JSON " + command + " - No required_plugins, 1.0.10 is the most recent and should load",
|
|
|
|
|
"./templates/simple.json",
|
|
|
|
|
"packer-plugin-tester_v1\\.0\\.10[^\n]+ plugin:",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"HCL2 " + command + " - With required_plugins, 1.0.9 is pinned, so 1.0.9 should be used",
|
|
|
|
|
"./templates/pin_1.0.9.pkr.hcl",
|
|
|
|
|
"packer-plugin-tester_v1\\.0\\.9[^\n]+ plugin:",
|
|
|
|
|
},
|
|
|
|
|
}
|
2024-05-01 15:36:39 -04:00
|
|
|
|
2024-05-03 11:06:16 -04:00
|
|
|
for _, tt := range tests {
|
2024-05-10 14:45:14 -04:00
|
|
|
ts.Run(tt.name, func() {
|
2024-05-03 11:06:16 -04:00
|
|
|
ts.PackerCommand().
|
|
|
|
|
SetArgs(command, tt.templatePath).
|
2024-05-03 15:23:30 -04:00
|
|
|
UsePluginDir(pluginDir).
|
2024-08-15 10:05:27 -04:00
|
|
|
Assert(check.MustSucceed(), check.Grep(tt.grepStr))
|
2024-05-03 11:06:16 -04:00
|
|
|
})
|
|
|
|
|
}
|
2024-05-01 15:36:39 -04:00
|
|
|
}
|
|
|
|
|
}
|
2024-05-03 16:39:09 -04:00
|
|
|
|
2024-06-12 15:38:21 -04:00
|
|
|
func (ts *PackerPluginTestSuite) TestLoadWithLegacyPluginName() {
|
2024-08-15 14:09:33 -04:00
|
|
|
pluginDir := ts.MakePluginDir()
|
|
|
|
|
defer pluginDir.Cleanup()
|
2024-05-03 16:39:09 -04:00
|
|
|
|
packer_test: split BuildPackerPlugin in build/get
The interface for building a plugin through the test suite was
confusing, as it would build the plugin and return its path, cache the
path for the version built, and return the path regardless if something
was built or not.
While in the current state this is harmless as builds are idempotent,
since the state of the plugin package/module does not change, this will
in the future as we introduce customisation techniques on the plugin's
directory and files, making this double-use potentially dangerous.
Furthermore, the current behaviour is unclear, as the function hides
that caching mechanism, which could come as a surprise for users
attempting to build a plugin for the duration of a test, while the built
plugin is linked to the test suite being run, and not the unit test
being evaluated.
Therefore this commit changes the sequence in which plugins are built
and used. Now the `CompilePlugin` function builds a plugin, and does not
return its path anymore, instead terminating the tests immediately if
they fail.
In normal test usage, a new `GetPluginPath` function is introduced,
which looks-up the path in the suite's cache, failing immediately if
invoked before the plugin is built.
With this change, it is heavily advised to build plugins when
initialising the suite, then in the tests, the GetPluginPath function
should be used to get a plugin's path for interacting with packer
commands.
2024-08-14 16:12:53 -04:00
|
|
|
plugin := ts.GetPluginPath(ts.T(), "1.0.10")
|
2024-05-03 16:39:09 -04:00
|
|
|
|
2024-08-15 14:09:33 -04:00
|
|
|
common.CopyFile(ts.T(), filepath.Join(pluginDir.Dir(), "packer-plugin-tester"), plugin)
|
2024-05-03 16:39:09 -04:00
|
|
|
|
2024-05-07 16:26:20 -04:00
|
|
|
ts.Run("only legacy plugins installed: expect build to fail", func() {
|
|
|
|
|
ts.Run("with required_plugins - expect prompt for packer init", func() {
|
|
|
|
|
ts.PackerCommand().UsePluginDir(pluginDir).
|
|
|
|
|
SetArgs("build", "templates/simple.pkr.hcl").
|
2024-08-15 10:05:27 -04:00
|
|
|
Assert(check.MustFail(),
|
|
|
|
|
check.Grep("Did you run packer init for this project", check.GrepStdout),
|
|
|
|
|
check.Grep("following plugins are required", check.GrepStdout))
|
2024-05-07 16:26:20 -04:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
ts.Run("JSON template, without required_plugins: should say the component is unknown", func() {
|
|
|
|
|
ts.PackerCommand().UsePluginDir(pluginDir).
|
|
|
|
|
SetArgs("build", "templates/simple.json").
|
2024-08-15 10:05:27 -04:00
|
|
|
Assert(check.MustFail(),
|
|
|
|
|
check.Grep("The builder tester-dynamic is unknown by Packer", check.GrepStdout))
|
2024-05-07 16:26:20 -04:00
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
2024-08-15 14:09:33 -04:00
|
|
|
pluginDir = ts.MakePluginDir().InstallPluginVersions("1.0.0")
|
|
|
|
|
defer pluginDir.Cleanup()
|
2024-05-07 16:26:20 -04:00
|
|
|
|
2024-08-15 14:09:33 -04:00
|
|
|
common.CopyFile(ts.T(), filepath.Join(pluginDir.Dir(), "packer-plugin-tester"), plugin)
|
2024-05-07 16:26:20 -04:00
|
|
|
|
2024-05-03 16:39:09 -04:00
|
|
|
ts.Run("multiple plugins installed: one with no version in path, one with qualified name. Should pick-up the qualified one only.", func() {
|
|
|
|
|
ts.PackerCommand().UsePluginDir(pluginDir).
|
|
|
|
|
SetArgs("build", "templates/simple.pkr.hcl").
|
2024-08-15 10:05:27 -04:00
|
|
|
Assert(check.MustSucceed(), check.Grep("packer-plugin-tester_v1\\.0\\.0[^\\n]+ plugin:", check.GrepStderr))
|
2024-05-03 16:39:09 -04:00
|
|
|
})
|
2024-05-07 11:03:38 -04:00
|
|
|
|
2024-08-15 10:05:27 -04:00
|
|
|
wd, cleanup := common.TempWorkdir(ts.T(), "./templates/simple.pkr.hcl")
|
2024-05-07 11:03:38 -04:00
|
|
|
defer cleanup()
|
|
|
|
|
|
2024-08-15 10:05:27 -04:00
|
|
|
common.CopyFile(ts.T(), filepath.Join(wd, "packer-plugin-tester"), plugin)
|
2024-05-07 11:03:38 -04:00
|
|
|
|
|
|
|
|
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").
|
2024-08-15 10:05:27 -04:00
|
|
|
Assert(check.MustSucceed(), check.Grep("packer-plugin-tester_v1\\.0\\.0[^\\n]+ plugin:", check.GrepStderr))
|
2024-05-07 11:03:38 -04:00
|
|
|
})
|
2024-05-03 16:39:09 -04:00
|
|
|
}
|
|
|
|
|
|
2024-06-12 15:38:21 -04:00
|
|
|
func (ts *PackerPluginTestSuite) TestLoadWithSHAMismatches() {
|
packer_test: split BuildPackerPlugin in build/get
The interface for building a plugin through the test suite was
confusing, as it would build the plugin and return its path, cache the
path for the version built, and return the path regardless if something
was built or not.
While in the current state this is harmless as builds are idempotent,
since the state of the plugin package/module does not change, this will
in the future as we introduce customisation techniques on the plugin's
directory and files, making this double-use potentially dangerous.
Furthermore, the current behaviour is unclear, as the function hides
that caching mechanism, which could come as a surprise for users
attempting to build a plugin for the duration of a test, while the built
plugin is linked to the test suite being run, and not the unit test
being evaluated.
Therefore this commit changes the sequence in which plugins are built
and used. Now the `CompilePlugin` function builds a plugin, and does not
return its path anymore, instead terminating the tests immediately if
they fail.
In normal test usage, a new `GetPluginPath` function is introduced,
which looks-up the path in the suite's cache, failing immediately if
invoked before the plugin is built.
With this change, it is heavily advised to build plugins when
initialising the suite, then in the tests, the GetPluginPath function
should be used to get a plugin's path for interacting with packer
commands.
2024-08-14 16:12:53 -04:00
|
|
|
plugin := ts.GetPluginPath(ts.T(), "1.0.10")
|
2024-05-03 16:39:09 -04:00
|
|
|
|
|
|
|
|
ts.Run("move plugin with right name, but no SHA256SUM, should reject", func() {
|
2024-08-15 14:09:33 -04:00
|
|
|
pluginDir := ts.MakePluginDir().InstallPluginVersions("1.0.9")
|
|
|
|
|
defer pluginDir.Cleanup()
|
2024-05-03 16:39:09 -04:00
|
|
|
|
2024-08-15 10:05:27 -04:00
|
|
|
pluginDestName := common.ExpectedInstalledName("1.0.10")
|
2024-05-03 16:39:09 -04:00
|
|
|
|
2024-08-15 14:09:33 -04:00
|
|
|
common.CopyFile(ts.T(), filepath.Join(pluginDir.Dir(), "github.com", "hashicorp", "tester", pluginDestName), plugin)
|
2024-05-03 16:39:09 -04:00
|
|
|
|
|
|
|
|
ts.PackerCommand().UsePluginDir(pluginDir).
|
|
|
|
|
SetArgs("plugins", "installed").
|
2024-08-15 10:05:27 -04:00
|
|
|
Assert(check.MustSucceed(),
|
|
|
|
|
check.Grep("packer-plugin-tester_v1\\.0\\.9[^\\n]+", check.GrepStdout),
|
|
|
|
|
check.GrepInverted("packer-plugin-tester_v1.0.10", check.GrepStdout),
|
|
|
|
|
check.Grep("v1.0.10[^\\n]+ignoring possibly unsafe binary", check.GrepStderr))
|
2024-05-03 16:39:09 -04:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
ts.Run("move plugin with right name, invalid SHA256SUM, should reject", func() {
|
2024-08-15 14:09:33 -04:00
|
|
|
pluginDir := ts.MakePluginDir().InstallPluginVersions("1.0.9")
|
|
|
|
|
defer pluginDir.Cleanup()
|
2024-05-03 16:39:09 -04:00
|
|
|
|
2024-08-15 10:05:27 -04:00
|
|
|
pluginDestName := common.ExpectedInstalledName("1.0.10")
|
2024-08-15 14:09:33 -04:00
|
|
|
common.CopyFile(ts.T(), filepath.Join(pluginDir.Dir(), "github.com", "hashicorp", "tester", pluginDestName), plugin)
|
2025-05-27 04:38:41 -04:00
|
|
|
|
2024-08-15 10:05:27 -04:00
|
|
|
common.WriteFile(ts.T(),
|
2024-08-15 14:09:33 -04:00
|
|
|
filepath.Join(pluginDir.Dir(), "github.com", "hashicorp", "tester", fmt.Sprintf("%s_SHA256SUM", pluginDestName)),
|
2024-05-03 16:39:09 -04:00
|
|
|
fmt.Sprintf("%x", sha256.New().Sum([]byte("Not the plugin's contents for sure."))))
|
|
|
|
|
|
|
|
|
|
ts.PackerCommand().UsePluginDir(pluginDir).
|
|
|
|
|
SetArgs("plugins", "installed").
|
2024-08-15 10:05:27 -04:00
|
|
|
Assert(check.MustSucceed(),
|
|
|
|
|
check.Grep("packer-plugin-tester_v1\\.0\\.9[^\\n]+", check.GrepStdout),
|
|
|
|
|
check.GrepInverted("packer-plugin-tester_v1.0.10", check.GrepStdout),
|
|
|
|
|
check.Grep("v1.0.10[^\\n]+ignoring possibly unsafe binary", check.GrepStderr),
|
2025-05-27 04:38:41 -04:00
|
|
|
check.Grep(`Checksums \(\*sha256\.[dD]igest\) did not match.`, check.GrepStderr))
|
2024-05-03 16:39:09 -04:00
|
|
|
})
|
|
|
|
|
}
|
2024-05-10 11:23:05 -04:00
|
|
|
|
2024-06-12 15:38:21 -04:00
|
|
|
func (ts *PackerPluginTestSuite) TestPluginPathEnvvarWithMultiplePaths() {
|
2024-08-15 14:09:33 -04:00
|
|
|
pluginDirOne := ts.MakePluginDir().InstallPluginVersions("1.0.10")
|
|
|
|
|
defer pluginDirOne.Cleanup()
|
2024-05-10 11:23:05 -04:00
|
|
|
|
2024-08-15 14:09:33 -04:00
|
|
|
pluginDirTwo := ts.MakePluginDir().InstallPluginVersions("1.0.9")
|
|
|
|
|
defer pluginDirTwo.Cleanup()
|
2024-05-10 11:23:05 -04:00
|
|
|
|
2024-08-15 14:09:33 -04:00
|
|
|
pluginDirVal := fmt.Sprintf("%s%c%s", pluginDirOne.Dir(), os.PathListSeparator, pluginDirTwo.Dir())
|
2024-05-10 11:23:05 -04:00
|
|
|
ts.Run("load plugin with two dirs - not supported anymore, should error", func() {
|
2024-08-15 14:09:33 -04:00
|
|
|
ts.PackerCommand().UseRawPluginDir(pluginDirVal).
|
2024-05-10 11:23:05 -04:00
|
|
|
SetArgs("plugins", "installed").
|
2024-08-15 10:05:27 -04:00
|
|
|
Assert(check.MustFail(),
|
|
|
|
|
check.Grep("Multiple paths are no longer supported for PACKER_PLUGIN_PATH"),
|
|
|
|
|
check.MkPipeCheck("All envvars are suggested",
|
|
|
|
|
check.PipeGrep(`\* PACKER_PLUGIN_PATH=`),
|
|
|
|
|
check.LineCount()).
|
|
|
|
|
SetStream(check.OnlyStderr).
|
|
|
|
|
SetTester(check.IntCompare(check.Eq, 2)))
|
2024-05-10 11:23:05 -04:00
|
|
|
})
|
|
|
|
|
}
|
2024-05-15 16:23:02 -04:00
|
|
|
|
2024-06-12 15:38:21 -04:00
|
|
|
func (ts *PackerPluginTestSuite) TestInstallNonCanonicalPluginVersion() {
|
2024-08-15 14:09:33 -04:00
|
|
|
pluginPath := ts.MakePluginDir()
|
|
|
|
|
defer pluginPath.Cleanup()
|
2024-05-15 16:23:02 -04:00
|
|
|
|
2024-08-15 10:05:27 -04:00
|
|
|
common.ManualPluginInstall(ts.T(),
|
2024-08-15 14:09:33 -04:00
|
|
|
filepath.Join(pluginPath.Dir(), "github.com", "hashicorp", "tester"),
|
packer_test: split BuildPackerPlugin in build/get
The interface for building a plugin through the test suite was
confusing, as it would build the plugin and return its path, cache the
path for the version built, and return the path regardless if something
was built or not.
While in the current state this is harmless as builds are idempotent,
since the state of the plugin package/module does not change, this will
in the future as we introduce customisation techniques on the plugin's
directory and files, making this double-use potentially dangerous.
Furthermore, the current behaviour is unclear, as the function hides
that caching mechanism, which could come as a surprise for users
attempting to build a plugin for the duration of a test, while the built
plugin is linked to the test suite being run, and not the unit test
being evaluated.
Therefore this commit changes the sequence in which plugins are built
and used. Now the `CompilePlugin` function builds a plugin, and does not
return its path anymore, instead terminating the tests immediately if
they fail.
In normal test usage, a new `GetPluginPath` function is introduced,
which looks-up the path in the suite's cache, failing immediately if
invoked before the plugin is built.
With this change, it is heavily advised to build plugins when
initialising the suite, then in the tests, the GetPluginPath function
should be used to get a plugin's path for interacting with packer
commands.
2024-08-14 16:12:53 -04:00
|
|
|
ts.GetPluginPath(ts.T(), "1.0.10"),
|
2024-05-15 16:23:02 -04:00
|
|
|
"001.00.010")
|
|
|
|
|
|
|
|
|
|
ts.Run("try listing plugins with non-canonical version installed - report none", func() {
|
|
|
|
|
ts.PackerCommand().UsePluginDir(pluginPath).
|
|
|
|
|
SetArgs("plugins", "installed").
|
2024-08-15 10:05:27 -04:00
|
|
|
Assert(check.MustSucceed(),
|
|
|
|
|
check.Grep(`version .* in path is non canonical`, check.GrepStderr),
|
|
|
|
|
check.MkPipeCheck("no output in stdout").SetTester(check.ExpectEmptyInput()).SetStream(check.OnlyStdout))
|
2024-05-15 16:23:02 -04:00
|
|
|
})
|
|
|
|
|
}
|
2024-05-15 16:40:15 -04:00
|
|
|
|
2024-06-12 15:38:21 -04:00
|
|
|
func (ts *PackerPluginTestSuite) TestLoadPluginWithMetadataInName() {
|
2024-08-15 14:09:33 -04:00
|
|
|
pluginPath := ts.MakePluginDir()
|
|
|
|
|
defer pluginPath.Cleanup()
|
2024-05-15 16:40:15 -04:00
|
|
|
|
2024-08-15 10:05:27 -04:00
|
|
|
common.ManualPluginInstall(ts.T(),
|
2024-08-15 14:09:33 -04:00
|
|
|
filepath.Join(pluginPath.Dir(), "github.com", "hashicorp", "tester"),
|
packer_test: split BuildPackerPlugin in build/get
The interface for building a plugin through the test suite was
confusing, as it would build the plugin and return its path, cache the
path for the version built, and return the path regardless if something
was built or not.
While in the current state this is harmless as builds are idempotent,
since the state of the plugin package/module does not change, this will
in the future as we introduce customisation techniques on the plugin's
directory and files, making this double-use potentially dangerous.
Furthermore, the current behaviour is unclear, as the function hides
that caching mechanism, which could come as a surprise for users
attempting to build a plugin for the duration of a test, while the built
plugin is linked to the test suite being run, and not the unit test
being evaluated.
Therefore this commit changes the sequence in which plugins are built
and used. Now the `CompilePlugin` function builds a plugin, and does not
return its path anymore, instead terminating the tests immediately if
they fail.
In normal test usage, a new `GetPluginPath` function is introduced,
which looks-up the path in the suite's cache, failing immediately if
invoked before the plugin is built.
With this change, it is heavily advised to build plugins when
initialising the suite, then in the tests, the GetPluginPath function
should be used to get a plugin's path for interacting with packer
commands.
2024-08-14 16:12:53 -04:00
|
|
|
ts.GetPluginPath(ts.T(), "1.0.10+metadata"),
|
2024-05-15 16:40:15 -04:00
|
|
|
"1.0.10+metadata")
|
|
|
|
|
|
|
|
|
|
ts.Run("try listing plugins with metadata in name - report none", func() {
|
|
|
|
|
ts.PackerCommand().UsePluginDir(pluginPath).
|
|
|
|
|
SetArgs("plugins", "installed").
|
2024-08-15 10:05:27 -04:00
|
|
|
Assert(check.MustSucceed(),
|
|
|
|
|
check.Grep("found version .* with metadata in the name", check.GrepStderr),
|
|
|
|
|
check.MkPipeCheck("no output in stdout").SetTester(check.ExpectEmptyInput()).SetStream(check.OnlyStdout))
|
2024-05-15 16:40:15 -04:00
|
|
|
})
|
|
|
|
|
}
|
2024-05-15 16:52:24 -04:00
|
|
|
|
2024-06-12 15:38:21 -04:00
|
|
|
func (ts *PackerPluginTestSuite) TestLoadWithOnlyReleaseFlag() {
|
2024-08-15 14:09:33 -04:00
|
|
|
pluginPath := ts.MakePluginDir().InstallPluginVersions("1.0.0", "1.0.1-dev")
|
|
|
|
|
defer pluginPath.Cleanup()
|
2024-05-15 16:52:24 -04:00
|
|
|
|
|
|
|
|
for _, cmd := range []string{"validate", "build"} {
|
|
|
|
|
ts.Run(fmt.Sprintf("run %s without --ignore-prerelease flag - pick 1.0.1-dev by default", cmd), func() {
|
|
|
|
|
ts.PackerCommand().UsePluginDir(pluginPath).
|
|
|
|
|
SetArgs(cmd, "./templates/simple.pkr.hcl").
|
2024-08-15 10:05:27 -04:00
|
|
|
Assert(check.MustSucceed(),
|
|
|
|
|
check.Grep("packer-plugin-tester_v1.0.1-dev.*: plugin process exited", check.GrepStderr))
|
2024-05-15 16:52:24 -04:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
ts.Run(fmt.Sprintf("run %s with --ignore-prerelease flag - pick 1.0.0", cmd), func() {
|
|
|
|
|
ts.PackerCommand().UsePluginDir(pluginPath).
|
|
|
|
|
SetArgs(cmd, "--ignore-prerelease-plugins", "./templates/simple.pkr.hcl").
|
2024-08-15 10:05:27 -04:00
|
|
|
Assert(check.MustSucceed(),
|
|
|
|
|
check.Grep("packer-plugin-tester_v1.0.0.*: plugin process exited", check.GrepStderr))
|
2024-05-15 16:52:24 -04:00
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-05-29 10:52:24 -04:00
|
|
|
|
2024-06-12 15:38:21 -04:00
|
|
|
func (ts *PackerPluginTestSuite) TestWithLegacyConfigAndComponents() {
|
2024-08-15 14:09:33 -04:00
|
|
|
pluginDir := ts.MakePluginDir().InstallPluginVersions("1.0.0")
|
|
|
|
|
defer pluginDir.Cleanup()
|
2024-05-29 10:52:24 -04:00
|
|
|
|
2024-08-15 10:05:27 -04:00
|
|
|
workdir, cleanup := common.TempWorkdir(ts.T(), "./sample_config.json", "./templates/simple.json", "./templates/simple.pkr.hcl")
|
2024-05-29 10:52:24 -04:00
|
|
|
defer cleanup()
|
|
|
|
|
|
|
|
|
|
for _, cmd := range []string{"validate", "build"} {
|
|
|
|
|
ts.Run(fmt.Sprintf("%s simple JSON template with config.json and components defined", cmd), func() {
|
|
|
|
|
ts.PackerCommand().UsePluginDir(pluginDir).SetWD(workdir).
|
|
|
|
|
SetArgs(cmd, "simple.json").
|
|
|
|
|
AddEnv("PACKER_CONFIG", filepath.Join(workdir, "sample_config.json")).
|
2024-08-15 10:05:27 -04:00
|
|
|
Assert(check.MustFail(),
|
|
|
|
|
check.Grep("Your configuration file describes some legacy components", check.GrepStderr),
|
|
|
|
|
check.Grep("packer-provisioner-super-shell", check.GrepStderr))
|
2024-05-29 10:52:24 -04:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
ts.Run(fmt.Sprintf("%s simple HCL2 template with config.json and components defined", cmd), func() {
|
|
|
|
|
ts.PackerCommand().UsePluginDir(pluginDir).SetWD(workdir).
|
|
|
|
|
SetArgs(cmd, "simple.pkr.hcl").
|
|
|
|
|
AddEnv("PACKER_CONFIG", filepath.Join(workdir, "sample_config.json")).
|
2024-08-15 10:05:27 -04:00
|
|
|
Assert(check.MustFail(),
|
|
|
|
|
check.Grep("Your configuration file describes some legacy components", check.GrepStderr),
|
|
|
|
|
check.Grep("packer-provisioner-super-shell", check.GrepStderr))
|
2024-05-29 10:52:24 -04:00
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|