kitchen-vro 1.2.2 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/publish.yaml +2 -2
- data/.gitignore +2 -0
- data/.release-please-manifest.json +1 -1
- data/.rubocop.yml +2 -3
- data/.yamllint +6 -0
- data/.yardopts +11 -0
- data/CHANGELOG.md +43 -18
- data/CONTRIBUTING.md +87 -0
- data/Gemfile +10 -7
- data/README.md +187 -76
- data/Rakefile +20 -2
- data/kitchen-vro.gemspec +5 -5
- data/lib/kitchen/driver/version.rb +4 -1
- data/lib/kitchen/driver/vro.rb +96 -0
- data/spec/vro_spec.rb +92 -2
- metadata +14 -13
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4fc3cc482e4cfc62f76afb15b09ebb335f5264994f182ca23df1188633894fe1
|
|
4
|
+
data.tar.gz: 1ef0ecb0109e0c2f6aa97a2a231b859a4328bc757043119db1842b32d8fc469b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ba21a283e5a306d50aaba9623d7a3c8456ef949021465e97566c110a52435c8dfa4b8b0ea4fdb4f2fd56d16d0e5b743a1f0c84df67869b1d65b344cb666e3fca
|
|
7
|
+
data.tar.gz: 7e22ba6bcaff192cb73975f998326316001a919d3b13e56983e9f250e8d8511980a9dd80c8520cb38f81fbb7d2a1d429394be4774d6b3275e7e3a1947d00061a
|
|
@@ -9,13 +9,13 @@ jobs:
|
|
|
9
9
|
release-please:
|
|
10
10
|
runs-on: ubuntu-latest
|
|
11
11
|
steps:
|
|
12
|
-
- uses: googleapis/release-please-action@
|
|
12
|
+
- uses: googleapis/release-please-action@v5
|
|
13
13
|
id: release
|
|
14
14
|
with:
|
|
15
15
|
token: ${{ secrets.PORTER_GITHUB_TOKEN }}
|
|
16
16
|
|
|
17
17
|
- name: Checkout
|
|
18
|
-
uses: actions/checkout@
|
|
18
|
+
uses: actions/checkout@v7
|
|
19
19
|
if: ${{ steps.release.outputs.release_created }}
|
|
20
20
|
|
|
21
21
|
- name: Build and publish to GitHub Package
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/.yamllint
ADDED
data/.yardopts
ADDED
data/CHANGELOG.md
CHANGED
|
@@ -1,43 +1,68 @@
|
|
|
1
1
|
# VRO Changelog
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## Unreleased
|
|
4
4
|
|
|
5
|
+
* chore(deps): update googleapis/release-please-action action to v5 ([#31](https://github.com/test-kitchen/kitchen-vro/pull/31)) ([309dc1d](https://github.com/test-kitchen/kitchen-vro/commit/309dc1d))
|
|
6
|
+
* chore(deps): update actions/checkout action to v7 ([#32](https://github.com/test-kitchen/kitchen-vro/pull/32)) ([df90c2f](https://github.com/test-kitchen/kitchen-vro/commit/df90c2f))
|
|
7
|
+
* Require Ruby 3.1+ and modernize CI ([#33](https://github.com/test-kitchen/kitchen-vro/pull/33)) ([ba13a07](https://github.com/test-kitchen/kitchen-vro/commit/ba13a07))
|
|
8
|
+
* Remove chefstyle and add the gem version badge ([#34](https://github.com/test-kitchen/kitchen-vro/pull/34)) ([88348d7](https://github.com/test-kitchen/kitchen-vro/commit/88348d7))
|
|
9
|
+
* Let cookstyle decide which files to lint ([#35](https://github.com/test-kitchen/kitchen-vro/pull/35)) ([c252779](https://github.com/test-kitchen/kitchen-vro/commit/c252779))
|
|
10
|
+
* Docs: rewrite README for new users and split contributor docs ([#36](https://github.com/test-kitchen/kitchen-vro/pull/36)) ([c32f1a3](https://github.com/test-kitchen/kitchen-vro/commit/c32f1a3))
|
|
5
11
|
|
|
6
|
-
|
|
12
|
+
## [1.2.4](https://github.com/test-kitchen/kitchen-vro/compare/v1.2.3...v1.2.4) (2026-08-24)
|
|
7
13
|
|
|
8
|
-
* release please deprecation ([#25](https://github.com/test-kitchen/kitchen-vro/issues/25)) ([2fc4da5](https://github.com/test-kitchen/kitchen-vro/commit/2fc4da56e566b52d631f5ccbf661131f14609c13))
|
|
9
14
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
### Features
|
|
15
|
+
### Bug Fixes
|
|
14
16
|
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
+
* correct the doubled scheme in the gemspec homepage ([#41](https://github.com/test-kitchen/kitchen-vro/issues/41)) ([0dc7756](https://github.com/test-kitchen/kitchen-vro/commit/0dc7756b703c2cd758e842dee0725f2124682569))
|
|
18
|
+
* require cookstyle/chefstyle so style checks actually run ([#43](https://github.com/test-kitchen/kitchen-vro/issues/43)) ([8b8d6b4](https://github.com/test-kitchen/kitchen-vro/commit/8b8d6b45d96ad5f436d0a947a10a15a5fac7ec4d))
|
|
19
|
+
* require test-kitchen 3.0 or newer ([#39](https://github.com/test-kitchen/kitchen-vro/issues/39)) ([f54a6c9](https://github.com/test-kitchen/kitchen-vro/commit/f54a6c9dae6b681875a1ec9b5d9a0cc8efd0bd97))
|
|
17
20
|
|
|
21
|
+
## [1.2.3](https://github.com/test-kitchen/kitchen-vro/compare/v1.2.2...v1.2.3) (2026-01-22)
|
|
18
22
|
|
|
19
|
-
###
|
|
23
|
+
### Bug Fixes
|
|
20
24
|
|
|
21
|
-
* bump
|
|
22
|
-
* release 1.2.0 ([#18](https://github.com/test-kitchen/kitchen-vro/issues/18)) ([3356c6f](https://github.com/test-kitchen/kitchen-vro/commit/3356c6f22b91c02283ec4d31a7ac6179ecd27876))
|
|
25
|
+
* bump tk dep to allow tk 4 ([#29](https://github.com/test-kitchen/kitchen-vro/issues/29)) ([2a89105](https://github.com/test-kitchen/kitchen-vro/commit/2a89105a15a65c974d4f9793950c8c6ceab963c1))
|
|
23
26
|
|
|
24
|
-
|
|
27
|
+
### Other Changes
|
|
25
28
|
|
|
29
|
+
* chore(deps): update actions/checkout action to v6 ([#28](https://github.com/test-kitchen/kitchen-vro/pull/28)) ([008fa0e](https://github.com/test-kitchen/kitchen-vro/commit/008fa0e))
|
|
26
30
|
|
|
27
|
-
|
|
31
|
+
## [1.2.2](https://github.com/test-kitchen/kitchen-vro/compare/v1.2.1...v1.2.2) (2024-06-19)
|
|
28
32
|
|
|
29
|
-
|
|
33
|
+
### Bug Fixes
|
|
30
34
|
|
|
31
|
-
|
|
35
|
+
* release please deprecation ([#25](https://github.com/test-kitchen/kitchen-vro/issues/25)) ([2fc4da5](https://github.com/test-kitchen/kitchen-vro/commit/2fc4da56e566b52d631f5ccbf661131f14609c13))
|
|
32
36
|
|
|
37
|
+
## [1.2.1](https://github.com/test-kitchen/kitchen-vro/compare/v1.2.1...v1.2.1) (2024-06-09)
|
|
33
38
|
|
|
34
39
|
### Features
|
|
35
40
|
|
|
36
41
|
* update workflows ([#15](https://github.com/test-kitchen/kitchen-vro/issues/15)) ([277a0ab](https://github.com/test-kitchen/kitchen-vro/commit/277a0aba28a50b99272962973a589898dd144fad))
|
|
42
|
+
* Workflows ([#10](https://github.com/test-kitchen/kitchen-vro/issues/10)) ([3f51d13](https://github.com/test-kitchen/kitchen-vro/commit/3f51d13a5afc683f6f3c1c4816f37ec0c65c4d63))
|
|
37
43
|
|
|
38
|
-
## [1.1.0](https://github.com/test-kitchen/kitchen-vro/compare/v1.0.0...v1.1.0) (2023-11-27)
|
|
39
44
|
|
|
45
|
+
### Miscellaneous Chores
|
|
40
46
|
|
|
41
|
-
|
|
47
|
+
* bump verion to 1.2.1 ([#22](https://github.com/test-kitchen/kitchen-vro/issues/22)) ([498f90f](https://github.com/test-kitchen/kitchen-vro/commit/498f90ff6618b643795d29adbc120c5b4dc4fb26))
|
|
48
|
+
* release 1.2.0 ([#18](https://github.com/test-kitchen/kitchen-vro/issues/18)) ([3356c6f](https://github.com/test-kitchen/kitchen-vro/commit/3356c6f22b91c02283ec4d31a7ac6179ecd27876))
|
|
49
|
+
|
|
50
|
+
### Other Changes
|
|
42
51
|
|
|
43
52
|
* Workflows ([#10](https://github.com/test-kitchen/kitchen-vro/issues/10)) ([3f51d13](https://github.com/test-kitchen/kitchen-vro/commit/3f51d13a5afc683f6f3c1c4816f37ec0c65c4d63))
|
|
53
|
+
* adding to travis ([e197f8b](https://github.com/test-kitchen/kitchen-vro/commit/e197f8b))
|
|
54
|
+
* disabling ruby 2.0 in travis due to vcoworkflows bug ([7e40c92](https://github.com/test-kitchen/kitchen-vro/commit/7e40c92))
|
|
55
|
+
* adding slack notifications to travis ([d158e38](https://github.com/test-kitchen/kitchen-vro/commit/d158e38))
|
|
56
|
+
* disabling rvm 2.0.0 again ([6027c75](https://github.com/test-kitchen/kitchen-vro/commit/6027c75))
|
|
57
|
+
* fixing travis notifications ([#2](https://github.com/test-kitchen/kitchen-vro/pull/2)) ([c76470e](https://github.com/test-kitchen/kitchen-vro/commit/c76470e))
|
|
58
|
+
* Bump Rubocop to resolve CVE ([#6](https://github.com/test-kitchen/kitchen-vro/pull/6)) ([07665c6](https://github.com/test-kitchen/kitchen-vro/commit/07665c6))
|
|
59
|
+
* Update kitchen-vro.gemspec ([1b5439b](https://github.com/test-kitchen/kitchen-vro/commit/1b5439b))
|
|
60
|
+
|
|
61
|
+
* chore(deps): update dependency webmock to v3 ([#11](https://github.com/test-kitchen/kitchen-vro/pull/11)) ([8f3b368](https://github.com/test-kitchen/kitchen-vro/commit/8f3b368))
|
|
62
|
+
* Fix gemspec dependencies test-kitchen logic ([#14](https://github.com/test-kitchen/kitchen-vro/pull/14)) ([011d339](https://github.com/test-kitchen/kitchen-vro/commit/011d339))
|
|
63
|
+
* chore(deps): update google-github-actions/release-please-action action to v4 ([#13](https://github.com/test-kitchen/kitchen-vro/pull/13)) ([49aa642](https://github.com/test-kitchen/kitchen-vro/commit/49aa642))
|
|
64
|
+
|
|
65
|
+
## 1.0.0 (2015-08-25)
|
|
66
|
+
|
|
67
|
+
* empty repo ([604d029](https://github.com/test-kitchen/kitchen-vro/commit/604d029))
|
|
68
|
+
* Initial release of kitchen-vro ([#1](https://github.com/test-kitchen/kitchen-vro/pull/1)) ([45f2291](https://github.com/test-kitchen/kitchen-vro/commit/45f2291))
|
data/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Contributing to kitchen-vro
|
|
2
|
+
|
|
3
|
+
We'd love to hear from you if this driver doesn't perform the way you expect. Bug reports, feature requests, and pull requests are all welcome.
|
|
4
|
+
|
|
5
|
+
## Reporting issues
|
|
6
|
+
|
|
7
|
+
Report bugs and request features on the [issue tracker](https://github.com/test-kitchen/kitchen-vro/issues). For bugs, please include:
|
|
8
|
+
|
|
9
|
+
- the version of kitchen-vro and Test Kitchen you are using
|
|
10
|
+
- your vRO version
|
|
11
|
+
- your `kitchen.yml` with credentials and internal hostnames removed
|
|
12
|
+
- the input and output parameters of the workflows involved
|
|
13
|
+
- the output of the failing command, ideally with `-l debug`
|
|
14
|
+
|
|
15
|
+
## Development setup
|
|
16
|
+
|
|
17
|
+
Clone the repository and install the dependencies:
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
git clone https://github.com/test-kitchen/kitchen-vro.git
|
|
21
|
+
cd kitchen-vro
|
|
22
|
+
bundle install
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Running the tests
|
|
26
|
+
|
|
27
|
+
Run the unit tests and the style check together:
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
bundle exec rake
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Run them individually:
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
bundle exec rake test # RSpec unit tests
|
|
37
|
+
bundle exec rake style # Cookstyle / RuboCop
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
To run a single spec file:
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
bundle exec rspec spec/kitchen/driver/vro_spec.rb
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Many style offenses can be corrected automatically:
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
bundle exec cookstyle -a
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
The unit tests stub the vRO client, so they do not contact an appliance and do
|
|
53
|
+
not require credentials.
|
|
54
|
+
|
|
55
|
+
### Manual testing against vRO
|
|
56
|
+
|
|
57
|
+
Changes that touch workflow execution or parameter handling should also be
|
|
58
|
+
exercised against a real appliance, since the stubbed tests cannot catch
|
|
59
|
+
API-level regressions.
|
|
60
|
+
|
|
61
|
+
You will need a create workflow and a destroy workflow meeting the requirements
|
|
62
|
+
in the README's Workflow design section. Set the password in the environment
|
|
63
|
+
rather than in `kitchen.yml`, and confirm after `kitchen destroy` that the
|
|
64
|
+
destroy workflow actually removed the machine — a create that fails partway
|
|
65
|
+
through can leave one behind.
|
|
66
|
+
|
|
67
|
+
## Submitting changes
|
|
68
|
+
|
|
69
|
+
1. Fork the repository.
|
|
70
|
+
2. Create a feature branch off `main`.
|
|
71
|
+
3. Make your change, adding or updating tests to cover it.
|
|
72
|
+
4. Make sure `bundle exec rake` passes.
|
|
73
|
+
5. Push the branch to your fork and open a pull request.
|
|
74
|
+
|
|
75
|
+
Please keep pull requests focused on a single change — it makes review much
|
|
76
|
+
faster. Update the documentation in `README.md` when you add or change a
|
|
77
|
+
configuration option, and the Workflow design section when you change what the
|
|
78
|
+
driver expects of a workflow.
|
|
79
|
+
|
|
80
|
+
## Release process
|
|
81
|
+
|
|
82
|
+
Releases are handled by the maintainers.
|
|
83
|
+
|
|
84
|
+
1. Update `lib/kitchen/driver/version.rb` with the new version.
|
|
85
|
+
2. Update `CHANGELOG.md`.
|
|
86
|
+
3. Merge to `main`; the [publish workflow](.github/workflows/publish.yaml) builds
|
|
87
|
+
the gem and pushes it to RubyGems.
|
data/Gemfile
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
source
|
|
1
|
+
source "https://rubygems.org"
|
|
2
2
|
|
|
3
3
|
gemspec
|
|
4
4
|
|
|
5
5
|
group :test do
|
|
6
|
-
gem
|
|
7
|
-
gem
|
|
8
|
-
gem
|
|
9
|
-
gem 'webmock', '~> 3.0'
|
|
6
|
+
gem "rake"
|
|
7
|
+
gem "rspec", "~> 3.2"
|
|
8
|
+
gem "webmock", "~> 3.0"
|
|
10
9
|
end
|
|
11
10
|
|
|
12
|
-
group :
|
|
13
|
-
gem
|
|
11
|
+
group :docs do
|
|
12
|
+
gem "yard"
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
group :cookstyle do
|
|
16
|
+
gem "cookstyle"
|
|
14
17
|
end
|
data/README.md
CHANGED
|
@@ -1,78 +1,146 @@
|
|
|
1
1
|
# kitchen-vro
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
way of vRealize Orchestrator workflows.
|
|
3
|
+
[](https://badge.fury.io/rb/kitchen-vro)
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
to make some assumptions about the workflows you design in order to properly
|
|
8
|
-
provision and destroy resources. Therefore, please pay special attention to
|
|
9
|
-
the **Workflow Design** section below and ensure your workflows adhere to
|
|
10
|
-
these design requirements.
|
|
5
|
+
A [Test Kitchen](https://kitchen.ci/) driver that provisions and destroys VMware resources by running [vRealize Orchestrator](https://www.vmware.com/products/vrealize-orchestrator.html) (vRO) workflows, so you can test your cookbooks and infrastructure code against machines built by your own workflows.
|
|
11
6
|
|
|
12
|
-
|
|
7
|
+
Because a vRO workflow can do anything, this driver has to make some assumptions about the ones it calls. Read [Workflow design](#workflow-design) before you start — your create and destroy workflows must expose specific parameters for the driver to work.
|
|
13
8
|
|
|
14
|
-
|
|
9
|
+
> This documentation uses [Cinc Workstation](https://cinc.sh/) and the `cinc` commands throughout. Everything here works identically with Chef Workstation — see [Using with Chef](#using-with-chef).
|
|
15
10
|
|
|
16
|
-
|
|
17
|
-
gem 'kitchen-vro'
|
|
18
|
-
```
|
|
11
|
+
## Requirements
|
|
19
12
|
|
|
20
|
-
|
|
13
|
+
- Ruby 3.1 or later (already satisfied if you use Cinc Workstation)
|
|
14
|
+
- Access to a vRealize Orchestrator appliance
|
|
15
|
+
- A **create** workflow and a **destroy** workflow meeting the requirements in [Workflow design](#workflow-design)
|
|
16
|
+
- Permission to execute those workflows
|
|
21
17
|
|
|
22
|
-
|
|
23
|
-
bundle
|
|
24
|
-
```
|
|
18
|
+
## Installation
|
|
25
19
|
|
|
26
|
-
|
|
20
|
+
This driver ships as part of [Cinc Workstation](https://cinc.sh/start/workstation/). If you have Cinc Workstation installed, there is nothing else to install.
|
|
27
21
|
|
|
28
|
-
|
|
22
|
+
To install it into a standalone Ruby:
|
|
23
|
+
|
|
24
|
+
```sh
|
|
29
25
|
gem install kitchen-vro
|
|
30
26
|
```
|
|
31
27
|
|
|
32
|
-
Or
|
|
28
|
+
Or with Bundler, add it to your `Gemfile`:
|
|
33
29
|
|
|
34
|
-
```
|
|
35
|
-
|
|
30
|
+
```ruby
|
|
31
|
+
gem "kitchen-vro"
|
|
36
32
|
```
|
|
37
33
|
|
|
38
|
-
|
|
34
|
+
...then run `bundle install`.
|
|
39
35
|
|
|
40
|
-
|
|
36
|
+
## Quick Start
|
|
41
37
|
|
|
42
38
|
```yaml
|
|
39
|
+
---
|
|
43
40
|
driver:
|
|
44
41
|
name: vro
|
|
45
42
|
vro_username: user@domain.com
|
|
46
|
-
vro_password:
|
|
43
|
+
vro_password: <%= ENV['VRO_PASSWORD'] %>
|
|
47
44
|
vro_base_url: https://vra.corp.local:8281
|
|
45
|
+
create_workflow_name: Create TK Server
|
|
46
|
+
destroy_workflow_name: Destroy TK Server
|
|
47
|
+
|
|
48
|
+
provisioner:
|
|
49
|
+
name: cinc_infra
|
|
50
|
+
|
|
51
|
+
verifier:
|
|
52
|
+
name: cinc_auditor
|
|
53
|
+
|
|
54
|
+
platforms:
|
|
55
|
+
- name: centos-9
|
|
56
|
+
|
|
57
|
+
suites:
|
|
58
|
+
- name: default
|
|
59
|
+
run_list:
|
|
60
|
+
- recipe[my_cookbook::default]
|
|
48
61
|
```
|
|
49
62
|
|
|
50
|
-
|
|
63
|
+
Then run the full test cycle:
|
|
64
|
+
|
|
65
|
+
```sh
|
|
66
|
+
cinc kitchen test
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Or step through it:
|
|
70
|
+
|
|
71
|
+
```sh
|
|
72
|
+
cinc kitchen create # run the create workflow and wait for it
|
|
73
|
+
cinc kitchen converge # apply your cookbook
|
|
74
|
+
cinc kitchen verify # run your tests
|
|
75
|
+
cinc kitchen destroy # run the destroy workflow
|
|
76
|
+
```
|
|
51
77
|
|
|
52
|
-
|
|
53
|
-
* **destroy_workflow_name**: The name of the vRO workflow to execute to destroy a server.
|
|
78
|
+
Keep the password out of `kitchen.yml` by reading it from the environment, as above.
|
|
54
79
|
|
|
55
|
-
|
|
80
|
+
## Configuration
|
|
56
81
|
|
|
57
|
-
|
|
58
|
-
this parameter to specify the workflow unique ID.
|
|
59
|
-
* **destroy_workflow_id**: If your destroy workflow name is not unique within vRO, you can use
|
|
60
|
-
this parameter to specify the workflow unique ID.
|
|
61
|
-
* **create_workflow_parameters**: A hash of key-value pairs of parameters to pass to your
|
|
62
|
-
create workflow.
|
|
63
|
-
* **destroy_workflow_parameters**: A hash of key-value pairs of parameters to pass to your
|
|
64
|
-
destroy workflow.
|
|
65
|
-
* **request_timeout**: Number of seconds to wait for a vRO workflow to execute. Default: 300
|
|
66
|
-
* **vro_disable_ssl_verify**: Disable SSL validation. Default: false
|
|
82
|
+
All options below are set under the `driver:` key in `kitchen.yml`, or per platform under `platforms[].driver:`.
|
|
67
83
|
|
|
68
|
-
|
|
69
|
-
|
|
84
|
+
### Required
|
|
85
|
+
|
|
86
|
+
| Option | Default | Description |
|
|
87
|
+
| --- | --- | --- |
|
|
88
|
+
| `vro_base_url` | *none* | Base URL of the vRO appliance, e.g. `https://vra.corp.local:8281`. Required. |
|
|
89
|
+
| `vro_username` | *none* | Username to authenticate with, e.g. `user@domain.com`. Required. |
|
|
90
|
+
| `vro_password` | *none* | Password to authenticate with. Required. |
|
|
91
|
+
| `create_workflow_name` | *none* | Name of the vRO workflow that creates a server. Required. |
|
|
92
|
+
| `destroy_workflow_name` | *none* | Name of the vRO workflow that destroys a server. Required. |
|
|
93
|
+
|
|
94
|
+
### Workflow selection and parameters
|
|
95
|
+
|
|
96
|
+
| Option | Default | Description |
|
|
97
|
+
| --- | --- | --- |
|
|
98
|
+
| `create_workflow_id` | `nil` | Unique ID of the create workflow. Use this when the workflow name is not unique within vRO. |
|
|
99
|
+
| `destroy_workflow_id` | `nil` | Unique ID of the destroy workflow. Use this when the workflow name is not unique within vRO. |
|
|
100
|
+
| `create_workflow_parameters` | `{}` | Hash of key/value parameters passed to the create workflow. |
|
|
101
|
+
| `destroy_workflow_parameters` | `{}` | Hash of key/value parameters passed to the destroy workflow. |
|
|
102
|
+
|
|
103
|
+
### Connection
|
|
104
|
+
|
|
105
|
+
| Option | Default | Description |
|
|
106
|
+
| --- | --- | --- |
|
|
107
|
+
| `request_timeout` | `300` | Seconds to wait for a workflow to finish executing. |
|
|
108
|
+
| `vro_disable_ssl_verify` | `false` | Skip TLS certificate validation. Only use this against a lab appliance with a self-signed certificate. |
|
|
109
|
+
|
|
110
|
+
## Workflow design
|
|
111
|
+
|
|
112
|
+
There is no limit to what your vRO workflows can do, but they must meet the
|
|
113
|
+
following requirements for the driver to drive them.
|
|
114
|
+
|
|
115
|
+
### Create workflow
|
|
116
|
+
|
|
117
|
+
- Must have an output parameter called **`ip_address`**, which Test Kitchen
|
|
118
|
+
connects to in order to bootstrap and test the node.
|
|
119
|
+
- Must have an output parameter called **`server_id`**, a unique ID for the
|
|
120
|
+
server that was created. The driver passes this to the destroy workflow later.
|
|
121
|
+
- Must end with a raised exception if creation did not succeed. The workflow
|
|
122
|
+
status must not be `completed` when it has failed, or the driver will treat a
|
|
123
|
+
failed build as a success.
|
|
124
|
+
|
|
125
|
+
### Destroy workflow
|
|
126
|
+
|
|
127
|
+
- Must have an input parameter called **`server_id`**, which the driver
|
|
128
|
+
populates with the value returned by the create workflow.
|
|
129
|
+
- Must end with a raised exception if destruction did not succeed. The workflow
|
|
130
|
+
status must not be `completed` when it has failed.
|
|
131
|
+
|
|
132
|
+
## Examples
|
|
133
|
+
|
|
134
|
+
### Per-platform workflow parameters
|
|
135
|
+
|
|
136
|
+
Global settings live under `driver:`, and the parameters that differ per
|
|
137
|
+
operating system live under each platform:
|
|
70
138
|
|
|
71
139
|
```yaml
|
|
72
140
|
driver:
|
|
73
141
|
name: vro
|
|
74
142
|
vro_username: user@domain.com
|
|
75
|
-
vro_password:
|
|
143
|
+
vro_password: <%= ENV['VRO_PASSWORD'] %>
|
|
76
144
|
vro_base_url: https://vra.corp.local:8281
|
|
77
145
|
create_workflow_name: Create TK Server
|
|
78
146
|
destroy_workflow_name: Destroy TK Server
|
|
@@ -92,55 +160,98 @@ platforms:
|
|
|
92
160
|
memory: 4096
|
|
93
161
|
```
|
|
94
162
|
|
|
95
|
-
|
|
163
|
+
### Workflow names that are not unique
|
|
96
164
|
|
|
97
|
-
|
|
98
|
-
|
|
165
|
+
```yaml
|
|
166
|
+
driver:
|
|
167
|
+
name: vro
|
|
168
|
+
vro_base_url: https://vra.corp.local:8281
|
|
169
|
+
vro_username: user@domain.com
|
|
170
|
+
vro_password: <%= ENV['VRO_PASSWORD'] %>
|
|
171
|
+
create_workflow_name: Create TK Server
|
|
172
|
+
create_workflow_id: 9f4d4a7e-1234-4b8b-9c2f-77b6c9f0e111
|
|
173
|
+
destroy_workflow_name: Destroy TK Server
|
|
174
|
+
destroy_workflow_id: 3a1b2c3d-5678-4e9f-8a1b-22c4d6e8f0a1
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Passing parameters to the destroy workflow
|
|
178
|
+
|
|
179
|
+
```yaml
|
|
180
|
+
driver:
|
|
181
|
+
name: vro
|
|
182
|
+
vro_base_url: https://vra.corp.local:8281
|
|
183
|
+
vro_username: user@domain.com
|
|
184
|
+
vro_password: <%= ENV['VRO_PASSWORD'] %>
|
|
185
|
+
create_workflow_name: Create TK Server
|
|
186
|
+
destroy_workflow_name: Destroy TK Server
|
|
187
|
+
destroy_workflow_parameters:
|
|
188
|
+
force: true
|
|
189
|
+
reason: test-kitchen cleanup
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Slow workflows
|
|
193
|
+
|
|
194
|
+
```yaml
|
|
195
|
+
driver:
|
|
196
|
+
name: vro
|
|
197
|
+
vro_base_url: https://vra.corp.local:8281
|
|
198
|
+
vro_username: user@domain.com
|
|
199
|
+
vro_password: <%= ENV['VRO_PASSWORD'] %>
|
|
200
|
+
create_workflow_name: Create TK Server
|
|
201
|
+
destroy_workflow_name: Destroy TK Server
|
|
202
|
+
request_timeout: 1800
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### Lab appliance with a self-signed certificate
|
|
99
206
|
|
|
100
|
-
|
|
207
|
+
```yaml
|
|
208
|
+
driver:
|
|
209
|
+
name: vro
|
|
210
|
+
vro_base_url: https://vro.lab.local:8281
|
|
211
|
+
vro_username: user@lab.local
|
|
212
|
+
vro_password: <%= ENV['VRO_PASSWORD'] %>
|
|
213
|
+
create_workflow_name: Create TK Server
|
|
214
|
+
destroy_workflow_name: Destroy TK Server
|
|
215
|
+
vro_disable_ssl_verify: true
|
|
216
|
+
```
|
|
101
217
|
|
|
102
|
-
|
|
103
|
-
connect to in order to bootstrap and test your node.
|
|
104
|
-
* Must contain an output parameter called `server_id` that is a unique ID of
|
|
105
|
-
the server created. Test Kitchen will provide this value to the Destroy
|
|
106
|
-
Workflow in order to request the destruction of the server once testing is
|
|
107
|
-
complete.
|
|
108
|
-
* Must end the workflow with a raised exception if the creation did not
|
|
109
|
-
succeed. The workflow status must not be 'completed.'
|
|
218
|
+
## Troubleshooting
|
|
110
219
|
|
|
111
|
-
|
|
220
|
+
**Test Kitchen cannot connect after a successful create.** Check that the create
|
|
221
|
+
workflow really does return an `ip_address` output parameter, and that the
|
|
222
|
+
address is reachable from where you are running Test Kitchen.
|
|
112
223
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
succeed. The workflow status must not be 'completed.'
|
|
224
|
+
**A failed build is reported as successful.** The workflow finished with status
|
|
225
|
+
`completed` despite failing. Raise an exception in the workflow on failure, as
|
|
226
|
+
described in [Workflow design](#workflow-design).
|
|
117
227
|
|
|
118
|
-
|
|
228
|
+
**`kitchen destroy` does nothing, or destroys the wrong machine.** The destroy
|
|
229
|
+
workflow must take a `server_id` input parameter, and the create workflow must
|
|
230
|
+
return a matching `server_id` output.
|
|
119
231
|
|
|
120
|
-
|
|
232
|
+
**The workflow times out.** Increase `request_timeout`; the default is 300
|
|
233
|
+
seconds, which is short for a full VM build.
|
|
121
234
|
|
|
122
|
-
|
|
235
|
+
## Using with Chef
|
|
123
236
|
|
|
124
|
-
|
|
237
|
+
This driver is not tied to Cinc. The examples above use Cinc Workstation and the `cinc_infra` provisioner, but the driver works exactly the same with [Chef Workstation](https://www.chef.io/downloads/tools/workstation) — run `kitchen` instead of `cinc kitchen`, and use `chef_infra` instead of `cinc_infra`:
|
|
125
238
|
|
|
126
|
-
|
|
127
|
-
|
|
239
|
+
```yaml
|
|
240
|
+
provisioner:
|
|
241
|
+
name: chef_infra
|
|
128
242
|
|
|
129
|
-
|
|
130
|
-
|
|
243
|
+
verifier:
|
|
244
|
+
name: inspec
|
|
131
245
|
```
|
|
132
246
|
|
|
133
|
-
|
|
134
|
-
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
|
135
|
-
either express or implied. See the License for the specific language governing permissions
|
|
136
|
-
and limitations under the License.
|
|
247
|
+
No driver configuration changes are needed.
|
|
137
248
|
|
|
138
249
|
## Contributing
|
|
139
250
|
|
|
140
|
-
We'd love to hear from you if this doesn't perform
|
|
251
|
+
We'd love to hear from you if this doesn't perform the way you expect. Bug reports and pull requests are welcome on [GitHub](https://github.com/test-kitchen/kitchen-vro). See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup, how to run the tests, and the release process.
|
|
252
|
+
|
|
253
|
+
## License and Authors
|
|
254
|
+
|
|
255
|
+
Author: Chef Partner Engineering (<partnereng@chef.io>)
|
|
141
256
|
|
|
142
|
-
|
|
143
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
144
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
145
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
|
146
|
-
5. Create a new Pull Request
|
|
257
|
+
Licensed under the Apache License, Version 2.0. See [LICENSE](LICENSE) for details.
|
data/Rakefile
CHANGED
|
@@ -2,15 +2,33 @@ require "bundler/gem_tasks"
|
|
|
2
2
|
require "rspec/core/rake_task"
|
|
3
3
|
|
|
4
4
|
begin
|
|
5
|
-
require "chefstyle"
|
|
5
|
+
require "cookstyle/chefstyle"
|
|
6
6
|
require "rubocop/rake_task"
|
|
7
7
|
RuboCop::RakeTask.new(:style) do |task|
|
|
8
8
|
task.options += ["--display-cop-names", "--no-color"]
|
|
9
9
|
end
|
|
10
10
|
rescue LoadError
|
|
11
|
-
puts "
|
|
11
|
+
puts "cookstyle is not available. (sudo) gem install cookstyle to do style checking."
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
RSpec::Core::RakeTask.new(:test)
|
|
15
15
|
|
|
16
16
|
task default: %i{test style}
|
|
17
|
+
|
|
18
|
+
begin
|
|
19
|
+
require "yard"
|
|
20
|
+
|
|
21
|
+
# Options and the file list live in .yardopts so that a bare `yard` from the
|
|
22
|
+
# command line produces exactly what `rake doc` does.
|
|
23
|
+
YARD::Rake::YardocTask.new(:doc)
|
|
24
|
+
|
|
25
|
+
desc "List anything in lib/ that is still undocumented"
|
|
26
|
+
task :doc_coverage do
|
|
27
|
+
sh "yard stats --list-undoc"
|
|
28
|
+
end
|
|
29
|
+
rescue LoadError
|
|
30
|
+
desc "Generate YARD documentation (not installed)"
|
|
31
|
+
task :doc do
|
|
32
|
+
abort "YARD is not installed. Run: bundle install"
|
|
33
|
+
end
|
|
34
|
+
end
|
data/kitchen-vro.gemspec
CHANGED
|
@@ -3,20 +3,20 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
|
3
3
|
require "kitchen/driver/version"
|
|
4
4
|
|
|
5
5
|
Gem::Specification.new do |spec|
|
|
6
|
-
spec.name
|
|
6
|
+
spec.name = "kitchen-vro"
|
|
7
|
+
spec.required_ruby_version = ">= 3.1"
|
|
7
8
|
spec.version = Kitchen::Driver::VRO_VERSION
|
|
8
9
|
spec.authors = ["Test Kitchen Team"]
|
|
9
10
|
spec.email = ["help@sous-chefs.org"]
|
|
10
11
|
spec.summary = "A Test Kitchen driver for VMware vRealize Orchestrator (vRO)"
|
|
11
12
|
spec.description = spec.summary
|
|
12
|
-
spec.homepage = "https://
|
|
13
|
-
spec.license = "Apache
|
|
13
|
+
spec.homepage = "https://github.com/test-kitchen/kitchen-vro"
|
|
14
|
+
spec.license = "Apache-2.0"
|
|
14
15
|
|
|
15
16
|
spec.files = `git ls-files -z`.split("\x0")
|
|
16
17
|
spec.executables = []
|
|
17
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
18
18
|
spec.require_paths = ["lib"]
|
|
19
19
|
|
|
20
|
-
spec.add_dependency "test-kitchen", ">=
|
|
20
|
+
spec.add_dependency "test-kitchen", ">= 3.0", "< 5"
|
|
21
21
|
spec.add_dependency "vcoworkflows", "~> 0.2"
|
|
22
22
|
end
|
|
@@ -16,8 +16,11 @@
|
|
|
16
16
|
# limitations under the License.
|
|
17
17
|
#
|
|
18
18
|
|
|
19
|
+
# Test Kitchen's top-level namespace.
|
|
19
20
|
module Kitchen
|
|
21
|
+
# Test Kitchen's driver plugins.
|
|
20
22
|
module Driver
|
|
21
|
-
|
|
23
|
+
# The version of the kitchen-vro gem.
|
|
24
|
+
VRO_VERSION = "1.2.4".freeze
|
|
22
25
|
end
|
|
23
26
|
end
|
data/lib/kitchen/driver/vro.rb
CHANGED
|
@@ -21,8 +21,28 @@ require "vcoworkflows"
|
|
|
21
21
|
require_relative "version"
|
|
22
22
|
|
|
23
23
|
module Kitchen
|
|
24
|
+
# Test Kitchen's driver plugins.
|
|
24
25
|
module Driver
|
|
26
|
+
# Test Kitchen driver for VMware vRealize Orchestrator (vRO).
|
|
27
|
+
#
|
|
28
|
+
# This driver does not build a machine itself. It runs two vRO workflows
|
|
29
|
+
# you supply -- one to create a server and one to destroy it -- and treats
|
|
30
|
+
# their output parameters as the machine's identity.
|
|
31
|
+
#
|
|
32
|
+
# The create workflow must return two output parameters, +server_id+ and
|
|
33
|
+
# +ip_address+, both non-empty. +server_id+ is stored in instance state
|
|
34
|
+
# and handed back to the destroy workflow, and +ip_address+ becomes the
|
|
35
|
+
# address the transport connects to. A workflow that completes without
|
|
36
|
+
# those two fails the +create+, since there would be nothing to connect to
|
|
37
|
+
# and nothing to tear down later.
|
|
38
|
+
#
|
|
39
|
+
# @see https://www.vmware.com/products/vrealize-orchestrator.html vRealize Orchestrator
|
|
25
40
|
class Vro < Kitchen::Driver::Base
|
|
41
|
+
# @!attribute [rw] workflow_name
|
|
42
|
+
# @return [String] name of the workflow currently being run
|
|
43
|
+
# @!attribute [rw] workflow_id
|
|
44
|
+
# @return [String, nil] id of the workflow currently being run, used
|
|
45
|
+
# to disambiguate when several workflows share a name
|
|
26
46
|
attr_accessor :workflow_name, :workflow_id
|
|
27
47
|
|
|
28
48
|
kitchen_driver_api_version 2
|
|
@@ -41,10 +61,19 @@ module Kitchen
|
|
|
41
61
|
default_config :destroy_workflow_parameters, {}
|
|
42
62
|
default_config :request_timeout, 300
|
|
43
63
|
|
|
64
|
+
# @return [String] the driver's display name in `kitchen list`
|
|
44
65
|
def name
|
|
45
66
|
"vRO"
|
|
46
67
|
end
|
|
47
68
|
|
|
69
|
+
# Runs the create workflow and waits for the server to be reachable.
|
|
70
|
+
#
|
|
71
|
+
# Returns immediately if state already names a server, so a re-run does
|
|
72
|
+
# not create a second one.
|
|
73
|
+
#
|
|
74
|
+
# @param state [Hash] mutable instance state; gains +server_id+ and
|
|
75
|
+
# +hostname+
|
|
76
|
+
# @return [void]
|
|
48
77
|
def create(state)
|
|
49
78
|
return unless state[:server_id].nil?
|
|
50
79
|
|
|
@@ -56,6 +85,10 @@ module Kitchen
|
|
|
56
85
|
info("Server #{state[:hostname]} (#{state[:server_id]}) ready.")
|
|
57
86
|
end
|
|
58
87
|
|
|
88
|
+
# Runs the destroy workflow for the server named in state.
|
|
89
|
+
#
|
|
90
|
+
# @param state [Hash] instance state naming the server
|
|
91
|
+
# @return [void]
|
|
59
92
|
def destroy(state)
|
|
60
93
|
return if state[:server_id].nil?
|
|
61
94
|
|
|
@@ -64,6 +97,9 @@ module Kitchen
|
|
|
64
97
|
info("Server #{state[:hostname]} (#{state[:server_id]}) destroyed.")
|
|
65
98
|
end
|
|
66
99
|
|
|
100
|
+
# Connection settings for the vRO API.
|
|
101
|
+
#
|
|
102
|
+
# @return [VcoWorkflows::Config]
|
|
67
103
|
def vro_config
|
|
68
104
|
@vro_config ||= VcoWorkflows::Config.new(
|
|
69
105
|
url: config[:vro_base_url],
|
|
@@ -73,6 +109,13 @@ module Kitchen
|
|
|
73
109
|
)
|
|
74
110
|
end
|
|
75
111
|
|
|
112
|
+
# Client for the workflow named by {#workflow_name} and {#workflow_id}.
|
|
113
|
+
#
|
|
114
|
+
# Memoized, and reset by {#set_workflow_vars}, so switching from the
|
|
115
|
+
# create workflow to the destroy workflow builds a fresh client rather
|
|
116
|
+
# than reusing the previous workflow's.
|
|
117
|
+
#
|
|
118
|
+
# @return [VcoWorkflows::Workflow]
|
|
76
119
|
def vro_client
|
|
77
120
|
@vro_client ||= VcoWorkflows::Workflow.new(
|
|
78
121
|
workflow_name,
|
|
@@ -81,16 +124,32 @@ module Kitchen
|
|
|
81
124
|
)
|
|
82
125
|
end
|
|
83
126
|
|
|
127
|
+
# @return [Boolean] whether to verify the vRO server's TLS certificate
|
|
84
128
|
def verify_ssl?
|
|
85
129
|
!config[:vro_disable_ssl_verify]
|
|
86
130
|
end
|
|
87
131
|
|
|
132
|
+
# Points the driver at a different workflow.
|
|
133
|
+
#
|
|
134
|
+
# Clears the memoized client, which is what makes it safe to run the
|
|
135
|
+
# destroy workflow after the create workflow in the same process.
|
|
136
|
+
#
|
|
137
|
+
# @param name [String] workflow name
|
|
138
|
+
# @param id [String, nil] workflow id, when the name is ambiguous
|
|
139
|
+
# @return [void]
|
|
88
140
|
def set_workflow_vars(name, id)
|
|
89
141
|
@vro_client = nil
|
|
90
142
|
@workflow_name = name
|
|
91
143
|
@workflow_id = id
|
|
92
144
|
end
|
|
93
145
|
|
|
146
|
+
# Runs the create workflow and records what it produced.
|
|
147
|
+
#
|
|
148
|
+
# @param state [Hash] mutable instance state; gains +server_id+ and
|
|
149
|
+
# +hostname+
|
|
150
|
+
# @return [void]
|
|
151
|
+
# @raise [RuntimeError] if the workflow did not complete successfully,
|
|
152
|
+
# or did not return a usable +server_id+ and +ip_address+
|
|
94
153
|
def execute_create_workflow(state)
|
|
95
154
|
set_workflow_vars(config[:create_workflow_name], config[:create_workflow_id])
|
|
96
155
|
set_workflow_parameters(config[:create_workflow_parameters])
|
|
@@ -105,6 +164,11 @@ module Kitchen
|
|
|
105
164
|
state[:hostname] = output_parameter_value("ip_address")
|
|
106
165
|
end
|
|
107
166
|
|
|
167
|
+
# Runs the destroy workflow, passing it the stored +server_id+.
|
|
168
|
+
#
|
|
169
|
+
# @param state [Hash] instance state naming the server
|
|
170
|
+
# @return [void]
|
|
171
|
+
# @raise [RuntimeError] if the workflow did not complete successfully
|
|
108
172
|
def execute_destroy_workflow(state)
|
|
109
173
|
set_workflow_vars(config[:destroy_workflow_name], config[:destroy_workflow_id])
|
|
110
174
|
set_workflow_parameters(config[:destroy_workflow_parameters])
|
|
@@ -115,6 +179,11 @@ module Kitchen
|
|
|
115
179
|
raise "The workflow did not complete successfully. Check the vRO UI for more info." unless workflow_successful?
|
|
116
180
|
end
|
|
117
181
|
|
|
182
|
+
# Submits the current workflow for execution.
|
|
183
|
+
#
|
|
184
|
+
# @return [void]
|
|
185
|
+
# @raise [RestClient::BadRequest] if vRO rejects the request, after
|
|
186
|
+
# logging the response body, which is where vRO puts the reason
|
|
118
187
|
def execute_workflow
|
|
119
188
|
vro_client.execute
|
|
120
189
|
rescue RestClient::BadRequest => e
|
|
@@ -125,6 +194,10 @@ module Kitchen
|
|
|
125
194
|
raise
|
|
126
195
|
end
|
|
127
196
|
|
|
197
|
+
# Polls until the running workflow's token is no longer alive.
|
|
198
|
+
#
|
|
199
|
+
# @return [void]
|
|
200
|
+
# @raise [Timeout::Error] if it does not finish within +request_timeout+
|
|
128
201
|
def wait_for_workflow
|
|
129
202
|
wait_time = config[:request_timeout]
|
|
130
203
|
Timeout.timeout(wait_time) do
|
|
@@ -139,6 +212,13 @@ module Kitchen
|
|
|
139
212
|
raise Timeout::Error, "Workflow did not complete in #{wait_time} seconds. Please check the vRO UI for more information."
|
|
140
213
|
end
|
|
141
214
|
|
|
215
|
+
# Waits for the transport to accept a connection.
|
|
216
|
+
#
|
|
217
|
+
# A server that never becomes reachable is destroyed before the error is
|
|
218
|
+
# re-raised, so a failed create does not leave a machine behind.
|
|
219
|
+
#
|
|
220
|
+
# @param state [Hash] instance state describing how to connect
|
|
221
|
+
# @return [void]
|
|
142
222
|
def wait_for_server(state)
|
|
143
223
|
instance.transport.connection(state).wait_until_ready
|
|
144
224
|
rescue
|
|
@@ -147,24 +227,39 @@ module Kitchen
|
|
|
147
227
|
raise
|
|
148
228
|
end
|
|
149
229
|
|
|
230
|
+
# Sets input parameters on the current workflow.
|
|
231
|
+
#
|
|
232
|
+
# @param data [Hash] parameter names to values; names are stringified
|
|
233
|
+
# @return [void]
|
|
150
234
|
def set_workflow_parameters(data) # rubocop:disable Style/AccessorMethodName
|
|
151
235
|
data.each do |key, value|
|
|
152
236
|
vro_client.parameter(key.to_s, value)
|
|
153
237
|
end
|
|
154
238
|
end
|
|
155
239
|
|
|
240
|
+
# Output parameters from the finished workflow run.
|
|
241
|
+
#
|
|
242
|
+
# @return [Hash{String => VcoWorkflows::WorkflowParameter}]
|
|
156
243
|
def output_parameters
|
|
157
244
|
@output_parameters ||= vro_client.token.output_parameters
|
|
158
245
|
end
|
|
159
246
|
|
|
247
|
+
# @param key [String] output parameter name
|
|
248
|
+
# @return [String] the parameter's value, stringified
|
|
160
249
|
def output_parameter_value(key)
|
|
161
250
|
output_parameters[key].value.to_s
|
|
162
251
|
end
|
|
163
252
|
|
|
253
|
+
# @param key [String] output parameter name
|
|
254
|
+
# @return [Boolean] true when the parameter is missing or empty
|
|
164
255
|
def output_parameter_empty?(key)
|
|
165
256
|
output_parameter_value(key).nil? || output_parameter_value(key).empty?
|
|
166
257
|
end
|
|
167
258
|
|
|
259
|
+
# Checks that the create workflow returned what the driver needs.
|
|
260
|
+
#
|
|
261
|
+
# @return [void]
|
|
262
|
+
# @raise [RuntimeError] if +server_id+ or +ip_address+ is absent or empty
|
|
168
263
|
def validate_create_output_parameters!
|
|
169
264
|
raise "The workflow output did not contain a server_id and ip_address parameter." unless
|
|
170
265
|
output_parameters.key?("server_id") && output_parameters.key?("ip_address")
|
|
@@ -173,6 +268,7 @@ module Kitchen
|
|
|
173
268
|
raise "The ip_address parameter was empty." if output_parameter_empty?("ip_address")
|
|
174
269
|
end
|
|
175
270
|
|
|
271
|
+
# @return [Boolean] whether the workflow run reached the "completed" state
|
|
176
272
|
def workflow_successful?
|
|
177
273
|
vro_client.token.state == "completed"
|
|
178
274
|
end
|
data/spec/vro_spec.rb
CHANGED
|
@@ -64,6 +64,96 @@ describe Kitchen::Driver::Vro do
|
|
|
64
64
|
allow(driver).to receive(:instance).and_return(instance)
|
|
65
65
|
end
|
|
66
66
|
|
|
67
|
+
describe 'plugin metadata' do
|
|
68
|
+
it 'is a Test Kitchen driver' do
|
|
69
|
+
expect(driver).to be_a(Kitchen::Driver::Base)
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
it 'shows up as vRO in kitchen list' do
|
|
73
|
+
expect(driver.name).to eq('vRO')
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
it 'reports its own gem version to kitchen diagnose' do
|
|
77
|
+
expect(driver.diagnose_plugin[:version]).to eq(Kitchen::Driver::VRO_VERSION)
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
describe 'configuration' do
|
|
82
|
+
it 'verifies TLS by default' do
|
|
83
|
+
expect(driver[:vro_disable_ssl_verify]).to eq(false)
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
it 'defaults to a 300 second workflow timeout' do
|
|
87
|
+
expect(driver[:request_timeout]).to eq(300)
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
it 'defaults both workflow ids to nil so the name is used alone' do
|
|
91
|
+
config.delete(:create_workflow_id)
|
|
92
|
+
config.delete(:destroy_workflow_id)
|
|
93
|
+
|
|
94
|
+
expect(driver[:create_workflow_id]).to be_nil
|
|
95
|
+
expect(driver[:destroy_workflow_id]).to be_nil
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
it 'defaults both workflow parameter sets to empty' do
|
|
99
|
+
expect(driver[:create_workflow_parameters]).to eq({})
|
|
100
|
+
expect(driver[:destroy_workflow_parameters]).to eq({})
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
%i[vro_username vro_password vro_base_url
|
|
104
|
+
create_workflow_name destroy_workflow_name].each do |key|
|
|
105
|
+
it "refuses to run without #{key}" do
|
|
106
|
+
config.delete(key)
|
|
107
|
+
|
|
108
|
+
expect { driver.finalize_config!(instance) }
|
|
109
|
+
.to raise_error(Kitchen::UserError, /#{key}/)
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
describe '#set_workflow_vars' do
|
|
115
|
+
it 'points the driver at the named workflow' do
|
|
116
|
+
driver.set_workflow_vars('Some Workflow', 'workflow-9')
|
|
117
|
+
|
|
118
|
+
expect(driver.workflow_name).to eq('Some Workflow')
|
|
119
|
+
expect(driver.workflow_id).to eq('workflow-9')
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
it 'discards the memoized client so the next call builds a new one' do
|
|
123
|
+
first = double('first client')
|
|
124
|
+
allow(VcoWorkflows::Workflow).to receive(:new).and_return(first)
|
|
125
|
+
allow(driver).to receive(:vro_config).and_return(double('config'))
|
|
126
|
+
driver.set_workflow_vars('Create Workflow', 'workflow-1')
|
|
127
|
+
expect(driver.vro_client).to eq(first)
|
|
128
|
+
|
|
129
|
+
second = double('second client')
|
|
130
|
+
allow(VcoWorkflows::Workflow).to receive(:new).and_return(second)
|
|
131
|
+
driver.set_workflow_vars('Destroy Workflow', 'workflow-2')
|
|
132
|
+
|
|
133
|
+
expect(driver.vro_client).to eq(second)
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
describe '#workflow_successful?' do
|
|
138
|
+
let(:vro_client) { double('vro_client') }
|
|
139
|
+
|
|
140
|
+
before do
|
|
141
|
+
allow(driver).to receive(:vro_client).and_return(vro_client)
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
it 'is true when vRO reports the run completed' do
|
|
145
|
+
allow(vro_client).to receive(:token).and_return(double(state: 'completed'))
|
|
146
|
+
|
|
147
|
+
expect(driver.workflow_successful?).to eq(true)
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
it 'is false for any other state' do
|
|
151
|
+
allow(vro_client).to receive(:token).and_return(double(state: 'failed'))
|
|
152
|
+
|
|
153
|
+
expect(driver.workflow_successful?).to eq(false)
|
|
154
|
+
end
|
|
155
|
+
end
|
|
156
|
+
|
|
67
157
|
describe '#create' do
|
|
68
158
|
context 'when a server already exists' do
|
|
69
159
|
let(:state) { { server_id: 'server-12345' } }
|
|
@@ -142,11 +232,11 @@ describe Kitchen::Driver::Vro do
|
|
|
142
232
|
|
|
143
233
|
context 'when vro_disable_ssl_verify is false' do
|
|
144
234
|
before do
|
|
145
|
-
config[:vro_disable_ssl_verify] =
|
|
235
|
+
config[:vro_disable_ssl_verify] = false
|
|
146
236
|
end
|
|
147
237
|
|
|
148
238
|
it 'returns true' do
|
|
149
|
-
expect(driver.verify_ssl?).to eq(
|
|
239
|
+
expect(driver.verify_ssl?).to eq(true)
|
|
150
240
|
end
|
|
151
241
|
end
|
|
152
242
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: kitchen-vro
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.2.
|
|
4
|
+
version: 1.2.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Test Kitchen Team
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-08-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: test-kitchen
|
|
@@ -16,20 +16,20 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '
|
|
19
|
+
version: '3.0'
|
|
20
20
|
- - "<"
|
|
21
21
|
- !ruby/object:Gem::Version
|
|
22
|
-
version: '
|
|
22
|
+
version: '5'
|
|
23
23
|
type: :runtime
|
|
24
24
|
prerelease: false
|
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
|
26
26
|
requirements:
|
|
27
27
|
- - ">="
|
|
28
28
|
- !ruby/object:Gem::Version
|
|
29
|
-
version: '
|
|
29
|
+
version: '3.0'
|
|
30
30
|
- - "<"
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: '
|
|
32
|
+
version: '5'
|
|
33
33
|
- !ruby/object:Gem::Dependency
|
|
34
34
|
name: vcoworkflows
|
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -59,7 +59,10 @@ files:
|
|
|
59
59
|
- ".release-please-manifest.json"
|
|
60
60
|
- ".rspec"
|
|
61
61
|
- ".rubocop.yml"
|
|
62
|
+
- ".yamllint"
|
|
63
|
+
- ".yardopts"
|
|
62
64
|
- CHANGELOG.md
|
|
65
|
+
- CONTRIBUTING.md
|
|
63
66
|
- Gemfile
|
|
64
67
|
- LICENSE.txt
|
|
65
68
|
- README.md
|
|
@@ -71,9 +74,9 @@ files:
|
|
|
71
74
|
- renovate.json
|
|
72
75
|
- spec/spec_helper.rb
|
|
73
76
|
- spec/vro_spec.rb
|
|
74
|
-
homepage: https://
|
|
77
|
+
homepage: https://github.com/test-kitchen/kitchen-vro
|
|
75
78
|
licenses:
|
|
76
|
-
- Apache
|
|
79
|
+
- Apache-2.0
|
|
77
80
|
metadata: {}
|
|
78
81
|
post_install_message:
|
|
79
82
|
rdoc_options: []
|
|
@@ -83,17 +86,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
83
86
|
requirements:
|
|
84
87
|
- - ">="
|
|
85
88
|
- !ruby/object:Gem::Version
|
|
86
|
-
version: '
|
|
89
|
+
version: '3.1'
|
|
87
90
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
91
|
requirements:
|
|
89
92
|
- - ">="
|
|
90
93
|
- !ruby/object:Gem::Version
|
|
91
94
|
version: '0'
|
|
92
95
|
requirements: []
|
|
93
|
-
rubygems_version: 3.
|
|
96
|
+
rubygems_version: 3.5.9
|
|
94
97
|
signing_key:
|
|
95
98
|
specification_version: 4
|
|
96
99
|
summary: A Test Kitchen driver for VMware vRealize Orchestrator (vRO)
|
|
97
|
-
test_files:
|
|
98
|
-
- spec/spec_helper.rb
|
|
99
|
-
- spec/vro_spec.rb
|
|
100
|
+
test_files: []
|