add manually-installed-single-component-plugin-old-api-fails

This commit is contained in:
Adrien Delorme 2021-02-11 16:45:04 +01:00
parent 3677069010
commit 40c2b2a153
1 changed files with 50 additions and 29 deletions

View File

@ -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) {