Add test case for non-github hostname
Tests results on current branch; install succeeded which was not expected ``` 2021/02/16 14:02:24 ui: Installed plugin example.com/sylviamoss/comment v0.2.19 in "/tmp/pkr-test-cfg-dir-6_pkr_config458005728/example.com/sylviamoss/comment/packer-plugin-comment_v0.2.19_x5.0_linux_amd64" init_test.go:361: InitCommand.Run() = 0, want 1 init_test.go:381: unexpected dir hash after init: string( - "h1:47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=", + "h1:iVtzkl/nVm2KiLvlz8rH56ME8QEqRxq8+XT2Lo6bzGU=", ) --- FAIL: TestInitCommand_Run (6.39s) --- PASS: TestInitCommand_Run/already-installed-no-op (0.01s) --- PASS: TestInitCommand_Run/already-installed-no-op/-subtest-0 (0.00s) --- PASS: TestInitCommand_Run/already-installed-upgrade (2.30s) --- PASS: TestInitCommand_Run/already-installed-upgrade/-subtest-0 (0.06s) --- PASS: TestInitCommand_Run/release-with-no-binary (0.17s) --- PASS: TestInitCommand_Run/manually-installed-single-component-plugin-works (1.32s) --- PASS: TestInitCommand_Run/manually-installed-single-component-plugin-works/-subtest-0 (0.01s) --- PASS: TestInitCommand_Run/manually-installed-single-component-plugin-old-api-fails (1.42s) --- PASS: TestInitCommand_Run/manually-installed-single-component-plugin-old-api-fails/-subtest-0 (0.01s) --- FAIL: TestInitCommand_Run/unsupported-non-github-source-address (1.18s) ``` Tests results after change with change in this branch ``` 2021/02/16 14:03:14 [TRACE] getting available versions for the example.com/sylviamoss/comment plugin 2021/02/16 14:03:14 [TRACE] &{%!q(*github.Client=<nil>) "packer-getter-github-1.7.0-dev"} getter could not get release: example.com/sylviamoss/comment doesn't appear to be a valid github.com source address; check source and try again. 2021/02/16 14:03:14 [DEBUG] will try to install: [] 2021/02/16 14:03:14 ui error: no release version found for the example.com/sylviamoss/comment plugin matching the constraint(s): "v0.2.19" --- PASS: TestInitCommand_Run (5.38s) --- PASS: TestInitCommand_Run/already-installed-no-op (0.01s) --- PASS: TestInitCommand_Run/already-installed-no-op/-subtest-0 (0.00s) --- PASS: TestInitCommand_Run/already-installed-upgrade (2.08s) --- PASS: TestInitCommand_Run/already-installed-upgrade/-subtest-0 (0.07s) --- PASS: TestInitCommand_Run/release-with-no-binary (0.21s) --- PASS: TestInitCommand_Run/manually-installed-single-component-plugin-works (1.20s) --- PASS: TestInitCommand_Run/manually-installed-single-component-plugin-works/-subtest-0 (0.01s) --- PASS: TestInitCommand_Run/manually-installed-single-component-plugin-old-api-fails (1.88s) --- PASS: TestInitCommand_Run/manually-installed-single-component-plugin-old-api-fails/-subtest-0 (0.01s) --- PASS: TestInitCommand_Run/unsupported-non-github-source-address (0.00s) ```
This commit is contained in:
parent
f48583c57e
commit
728c5a217d
|
@ -291,6 +291,32 @@ func TestInitCommand_Run(t *testing.T) {
|
|||
testBuild{want: 1}.fn,
|
||||
},
|
||||
},
|
||||
{
|
||||
"unsupported-non-github-source-address",
|
||||
[]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 = "example.com/sylviamoss/comment"
|
||||
version = "v0.2.19"
|
||||
}
|
||||
}
|
||||
}`,
|
||||
},
|
||||
cfg.dir("6_pkr_config"),
|
||||
cfg.dir("6_pkr_user_folder"),
|
||||
1,
|
||||
nil,
|
||||
"h1:47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=",
|
||||
nil,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
|
|
Loading…
Reference in New Issue