Skip to content

test: exercise the driver through Test Kitchen against a stubbed vRA - #93

Open
tas50 wants to merge 1 commit into
mainfrom
test/kitchen-integration
Open

tas50 wants to merge 1 commit into
mainfrom
test/kitchen-integration

Conversation

@tas50

@tas50 tas50 commented Aug 30, 2026

Copy link
Copy Markdown
Member

There was no kitchen.yml anywhere in this repo and nothing that ran the driver through Test Kitchen at all. The unit specs build the driver directly and stub the vmware-vra gem, which leaves a lot of code nobody runs: the plugin lookup that turns name: vra into this class, the config merging Test Kitchen does before the driver ever sees a value, required_config validation, the lazy defaults that need an instance to resolve, and every line of vmware-vra that turns a catalog request into HTTP and an HTTP response back into a Resource.

spec/integration

Loads a real kitchen.yml with the real loader, takes the driver Test Kitchen hands back, and runs create, status and destroy against a vRA stubbed at the wire with WebMock — which has been a development dependency all along without a single spec using it.

23 examples, covering a successful build, a deployment that reports CREATE_INPROGRESS before it finishes, a deployment holding resources that are not machines, a blueprint that builds two, a machine vRA reports no address for, a failed request, a deployment destroyed behind our back, and one offering no Delete action.

A vRA appliance cannot be stood up in a GitHub runner, but everything on this side of the socket can be, and now is, on every supported Ruby.

The rest

  • kitchen.yml in the root, taking every setting from the environment so no site details or credentials land in the repo. It verifies over the transport, so a green kitchen test means the deployment came up and Test Kitchen could log in to it — which is the whole of what this driver is responsible for.
  • A CI job running kitchen list and kitchen diagnose --all. That proves the gem is something the kitchen binary can find and load, that name: vra resolves to this driver, and that kitchen.yml is a config Test Kitchen accepts. Neither command contacts vRA.
  • rake unit and rake integration, with rake test running both — so the shared lint-unit workflow picks up the integration specs with no change on its side.
  • CONTRIBUTING gains what the two suites are for and how to run against a real appliance, and loses two instructions that were wrong: a spec path that does not exist (spec/kitchen/driver/vra_spec.rb), and a bare cookstyle that reports a hundred cookbook offenses on a gem.

bundle exec cookstyle --chefstyle, bundle exec rake test (55 unit + 23 integration), yamllint and markdownlint all pass.

There was no kitchen.yml anywhere in the repo and nothing that ran the
driver through Test Kitchen. The unit specs build the driver directly and
stub the vmware-vra gem, which leaves a lot of code nobody runs: the
plugin lookup that turns `name: vra` into this class, the config merging
Test Kitchen does before the driver sees a value, required_config
validation, the lazy defaults that need an instance to resolve, and every
line of vmware-vra that turns a catalog request into HTTP and an HTTP
response back into a Resource.

spec/integration loads a real kitchen.yml with the real loader, takes the
driver Test Kitchen hands back, and runs create, status and destroy
against a vRA stubbed at the wire with WebMock -- which has been a
development dependency all along without a single spec using it. 23
examples covering a successful build, a deployment that reports
CREATE_INPROGRESS before it finishes, a deployment holding resources that
are not machines, a blueprint that builds two, a machine vRA reports no
address for, a failed request, a deployment destroyed behind our back,
and one offering no Delete action.

A vRA appliance cannot be stood up in a GitHub runner, but everything on
this side of the socket can be, and now is, on every supported Ruby.

Also:

* kitchen.yml in the root, taking every setting from the environment, so
  a change can be tried against a real appliance with `kitchen test`. It
  verifies over the transport, so a green run means the deployment came
  up and Test Kitchen could log in to it.
* A CI job running `kitchen list` and `kitchen diagnose --all`, which
  proves the gem is something the `kitchen` binary can find and load and
  that kitchen.yml is a config Test Kitchen accepts. Neither contacts vRA.
* rake unit and rake integration, with rake test running both.
* CONTRIBUTING gains what the two suites are for, and loses two wrong
  instructions: a spec path that does not exist, and a bare `cookstyle`
  that reports a hundred cookbook offenses on a gem.

Signed-off-by: Tim Smith <tsmith84@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant