Lucas Bajolet
c0e594738b
init: warn if no requirements specified
...
When users call `packer init' on a template that does not specify a
`required_plugin' block, the command succeeds but does nothing, which is
not helpful for users that may expect their plugins to install.
To remedy that problem, we now output a message like what `packer
plugins required' does on templates without such a block, so that users
have an idea of what to change in order to get the command to work.
2023-09-27 14:47:00 -04:00
hashicorp-copywrite[bot]
19055df3ec
[COMPLIANCE] License changes ( #12568 )
...
* Updating the license from MPL to Business Source License
Going forward, this project will be licensed under the Business Source License v1.1. Please see our blog post for more details at https://hashi.co/bsl-blog , FAQ at https://hashi.co/license-faq , and details of the license at www.hashicorp.com/bsl.
* Update copyright file headers to BUSL-1.1
---------
Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
2023-08-10 15:53:29 -07:00
Wilken Rivera
99c79ecbd6
Add build tags to skip amd64 tests on darwin/arm64 ( #12549 )
2023-08-02 15:34:06 -04:00
hashicorp-copywrite[bot]
b7df3ca36f
[COMPLIANCE] Add Copyright and License Headers ( #12254 )
...
Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
2023-03-02 15:37:05 -05:00
Eng Zer Jun
f5ec0f1c57
test: use T.Setenv to set env vars in tests
...
This commit replaces `os.Setenv` with `t.Setenv` in tests. The
environment variable is automatically restored to its original value
when the test and all its subtests complete.
Reference: https://pkg.go.dev/testing#T.Setenv
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-09-20 14:54:20 -04:00
Adrien Delorme
3278c1a817
Packer SVC acc tests ( #11274 )
2021-12-01 15:58:33 +01:00
Wilken Rivera
728c5a217d
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)
```
2021-02-16 14:03:29 -05:00
Adrien Delorme
7089e0854a
rename setup func to avoid name conflict
2021-02-11 18:00:18 +01:00
Adrien Delorme
40c2b2a153
add manually-installed-single-component-plugin-old-api-fails
2021-02-11 16:55:30 +01:00
Adrien Delorme
3677069010
test: manually-installed-single-component-plugin-works
2021-02-11 16:35:08 +01:00
Adrien Delorme
b321c64c1e
Update init_test.go
2021-02-11 15:26:33 +01:00
Adrien Delorme
ad0ce49cec
fix tmpdir creation
2021-02-11 15:17:05 +01:00
Adrien Delorme
021044e963
put name first
2021-02-11 14:56:42 +01:00
Adrien Delorme
3052e3c5d5
tests
2021-02-11 14:46:53 +01:00
Adrien Delorme
ffbb110167
Test running plugins with fake and fresh plugins ( #10595 )
...
* show error as to why plugin discovery failed
* allow to run more manual tests after a plugin installation
* test that a freshly installed external plugin can run
2021-02-09 17:07:59 +01:00
Adrien Delorme
692433721d
Add some acceptance testing for Packer init commands ( #10566 )
2021-02-05 14:06:28 +01:00