diff --git a/packer_test/core_tests/local_eval_test.go b/packer_test/core_tests/local_eval_test.go index dd450d750..4a74785c3 100644 --- a/packer_test/core_tests/local_eval_test.go +++ b/packer_test/core_tests/local_eval_test.go @@ -17,7 +17,7 @@ func (ts *PackerCoreTestSuite) TestEvalLocalsOrder() { Stdin("local.test_local\n"). SetArgs("console", "./templates/locals_no_order.pkr.hcl"). Assert(lib.MustSucceed(), - lib.Grep("\\[\\]", lib.GrepStdout, lib.GrepInvert)) + lib.GrepInverted("\\[\\]", lib.GrepStdout)) } func (ts *PackerCoreTestSuite) TestLocalDuplicates() { diff --git a/packer_test/lib/gadgets.go b/packer_test/lib/gadgets.go index d1b16d254..5fae9d97d 100644 --- a/packer_test/lib/gadgets.go +++ b/packer_test/lib/gadgets.go @@ -125,6 +125,10 @@ func Grep(expression string, opts ...GrepOpts) Checker { return pc } +func GrepInverted(expression string, opts ...GrepOpts) Checker { + return Grep(expression, append(opts, GrepInvert)...) +} + type PluginVersionTuple struct { Source string Version *version.Version diff --git a/packer_test/plugin_tests/install_test.go b/packer_test/plugin_tests/install_test.go index a80369d36..b32d6223e 100644 --- a/packer_test/plugin_tests/install_test.go +++ b/packer_test/plugin_tests/install_test.go @@ -52,7 +52,7 @@ func (ts *PackerPluginTestSuite) TestInstallPluginWithPath() { SetArgs("plugins", "installed"). Assert(lib.MustSucceed(), lib.Grep("plugin-tester_v1.0.0-dev[^+]", lib.GrepStdout), - lib.Grep("plugin-tester_v1.0.0-dev\\+", lib.GrepStdout, lib.GrepInvert), + lib.GrepInverted("plugin-tester_v1.0.0-dev\\+", lib.GrepStdout), lib.LineCountCheck(1)) }) } diff --git a/packer_test/plugin_tests/loading_test.go b/packer_test/plugin_tests/loading_test.go index 4b14ba806..b98f3e5cf 100644 --- a/packer_test/plugin_tests/loading_test.go +++ b/packer_test/plugin_tests/loading_test.go @@ -110,7 +110,7 @@ func (ts *PackerPluginTestSuite) TestLoadWithSHAMismatches() { SetArgs("plugins", "installed"). Assert(lib.MustSucceed(), lib.Grep("packer-plugin-tester_v1\\.0\\.9[^\\n]+", lib.GrepStdout), - lib.Grep("packer-plugin-tester_v1.0.10", lib.GrepStdout, lib.GrepInvert), + lib.GrepInverted("packer-plugin-tester_v1.0.10", lib.GrepStdout), lib.Grep("v1.0.10[^\\n]+ignoring possibly unsafe binary", lib.GrepStderr)) }) @@ -128,7 +128,7 @@ func (ts *PackerPluginTestSuite) TestLoadWithSHAMismatches() { SetArgs("plugins", "installed"). Assert(lib.MustSucceed(), lib.Grep("packer-plugin-tester_v1\\.0\\.9[^\\n]+", lib.GrepStdout), - lib.Grep("packer-plugin-tester_v1.0.10", lib.GrepInvert, lib.GrepStdout), + lib.GrepInverted("packer-plugin-tester_v1.0.10", lib.GrepStdout), lib.Grep("v1.0.10[^\\n]+ignoring possibly unsafe binary", lib.GrepStderr), lib.Grep(`Checksums \(\*sha256\.digest\) did not match.`, lib.GrepStderr)) }) diff --git a/packer_test/plugin_tests/plugins_remove_test.go b/packer_test/plugin_tests/plugins_remove_test.go index 3bdfed379..c5f859677 100644 --- a/packer_test/plugin_tests/plugins_remove_test.go +++ b/packer_test/plugin_tests/plugins_remove_test.go @@ -72,7 +72,7 @@ func (ts *PackerPluginTestSuite) TestPluginsRemoveWithSourceAddressAndVersion() lib.MustSucceed(), lib.Grep("packer-plugin-tester_v1.0.9", lib.GrepStdout), lib.Grep("packer-plugin-tester_v1.0.10", lib.GrepStdout), - lib.Grep("packer-plugin-tester_v2.0.0", lib.GrepInvert, lib.GrepStdout), + lib.GrepInverted("packer-plugin-tester_v2.0.0", lib.GrepStdout), ) }) @@ -98,7 +98,7 @@ func (ts *PackerPluginTestSuite) TestPluginsRemoveWithLocalPath() { Assert( lib.MustSucceed(), lib.Grep("packer-plugin-tester_v1.0.9", lib.GrepStdout), - lib.Grep("packer-plugin-tester_v1.0.10", lib.GrepInvert, lib.GrepStdout), + lib.GrepInverted("packer-plugin-tester_v1.0.10", lib.GrepStdout), ) }) ts.Run("plugins installed after calling plugins remove outputs remaining installed plugins", func() { @@ -107,7 +107,7 @@ func (ts *PackerPluginTestSuite) TestPluginsRemoveWithLocalPath() { Assert( lib.MustSucceed(), lib.Grep("packer-plugin-tester_v1.0.10", lib.GrepStdout), - lib.Grep("packer-plugin-tester_v1.0.9", lib.GrepInvert, lib.GrepStdout), + lib.GrepInverted("packer-plugin-tester_v1.0.9", lib.GrepStdout), ) })