From 40c2b2a15340cc0c2496537debc130b25310fe8d Mon Sep 17 00:00:00 2001 From: Adrien Delorme Date: Thu, 11 Feb 2021 16:45:04 +0100 Subject: [PATCH] add manually-installed-single-component-plugin-old-api-fails --- command/init_test.go | 79 ++++++++++++++++++++++++++++---------------- 1 file changed, 50 insertions(+), 29 deletions(-) diff --git a/command/init_test.go b/command/init_test.go index 3d8296b4b..b68460e3a 100644 --- a/command/init_test.go +++ b/command/init_test.go @@ -197,32 +197,6 @@ func TestInitCommand_Run(t *testing.T) { "h1:47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=", nil, }, - { - "release-with-no-binary", - []func(t *testing.T, tc testCaseInit){ - skipInitTestUnlessEnVar(acctest.TestEnvVar).fn, - }, - testMetaFile(t), - nil, - "h1:47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=", - map[string]string{ - `cfg.pkr.hcl`: ` - packer { - required_plugins { - comment = { - source = "github.com/sylviamoss/comment" - version = "v0.2.20" - } - } - }`, - }, - cfg.dir("4_pkr_config"), - cfg.dir("4_pkr_user_folder"), - 1, - nil, - "h1:47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=", - nil, - }, { "manually-installed-single-component-plugin-works", []func(t *testing.T, tc testCaseInit){ @@ -230,7 +204,7 @@ func TestInitCommand_Run(t *testing.T) { initTestGoGetPlugin{ Src: "https://github.com/azr/packer-provisioner-comment/releases/download/v1.0.0/" + "packer-provisioner-comment_v1.0.0_" + runtime.GOOS + "_" + runtime.GOARCH + ".zip", - Dst: filepath.Join(cfg.dir("5_pkr_config"), defaultConfigDir, "plugins"), + Dst: filepath.Join(cfg.dir("4_pkr_config"), defaultConfigDir, "plugins"), }.fn, }, testMetaFile(t), @@ -257,8 +231,8 @@ func TestInitCommand_Run(t *testing.T) { } `, }, - cfg.dir("5_pkr_config"), - cfg.dir("5_pkr_user_folder"), + cfg.dir("4_pkr_config"), + cfg.dir("4_pkr_user_folder"), 0, nil, map[string]string{ @@ -270,6 +244,53 @@ func TestInitCommand_Run(t *testing.T) { testBuild{want: 0}.fn, }, }, + { + "manually-installed-single-component-plugin-old-api-fails", + []func(t *testing.T, tc testCaseInit){ + skipInitTestUnlessEnVar(acctest.TestEnvVar).fn, + initTestGoGetPlugin{ + Src: "https://github.com/azr/packer-provisioner-comment/releases/download/v0.0.0/" + + "packer-provisioner-comment_v0.0.0_" + runtime.GOOS + "_" + runtime.GOARCH + ".zip", + Dst: filepath.Join(cfg.dir("5_pkr_config"), defaultConfigDir, "plugins"), + }.fn, + }, + testMetaFile(t), + nil, + map[string]string{ + "darwin": "h1:gW4gzpDXeu3cDrXgHJj9iWAN7Pyak626Gq8Bu2LG1kY=", + "linux": "h1:wQ2H5+J7VXwQzqR9DgpWtjhw9OVEFbcKQL6dgm/+zwo=", + "windows": "h1:BqRdW3c5H1PZ2Q4DOaKWja21v3nDlY5Nn8kqahhHGSw=", + }[runtime.GOOS], + map[string]string{ + `source.pkr.hcl`: ` + source "null" "test" { + communicator = "none" + } + `, + `build.pkr.hcl`: ` + build { + sources = ["source.null.test"] + provisioner "comment" { + comment = "Begin ยก" + ui = true + bubble_text = true + } + } + `, + }, + cfg.dir("5_pkr_config"), + cfg.dir("5_pkr_user_folder"), + 0, + nil, + map[string]string{ + "darwin": "h1:gW4gzpDXeu3cDrXgHJj9iWAN7Pyak626Gq8Bu2LG1kY=", + "linux": "h1:wQ2H5+J7VXwQzqR9DgpWtjhw9OVEFbcKQL6dgm/+zwo=", + "windows": "h1:BqRdW3c5H1PZ2Q4DOaKWja21v3nDlY5Nn8kqahhHGSw=", + }[runtime.GOOS], + []func(*testing.T, testCaseInit){ + testBuild{want: 1}.fn, + }, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) {