Pull requests are welcome. Please make sure your patches are tested.
This project is maintained by the OSU Open Source Lab.
Report bugs and request features on the issue tracker. For bugs, please include:
- the version of kitchen-openstack and Test Kitchen you are using
- your OpenStack release, and which services are involved
- your
kitchen.ymlwith credentials and endpoints removed - the output of the failing command, ideally with
-l debug
kitchen diagnose is useful here: the driver merges clouds.yaml values into
its config during finalize_config!, so diagnose shows the settings actually in
effect after clouds.yaml, the OS_* environment variables, and kitchen.yml
have been combined.
git clone https://github.com/test-kitchen/kitchen-openstack
cd kitchen-openstack
bundle installbundle exec rake # tests + lint (default)
bundle exec rake test # unit tests only
bundle exec rake integration # Test Kitchen suites against fog's mocks
bundle exec rake style # Cookstyle lint
bundle exec rake yard # render docs to doc/
bundle exec rake yard_stats # list undocumented methodsrake test runs the unit task, and rake quality runs style. The default
task deliberately leaves integration out so that the common case stays fast;
CI runs it as its own job.
To run a single spec file:
bundle exec rspec spec/kitchen/driver/openstack_spec.rbUnit tests live in spec/, one file per file in lib/, and the whole suite
runs in well under a second. Nothing in it touches the network or the clock.
Nothing reads the filesystem outside a temp directory either, with one
deliberate exception: spec/kitchen/driver/openstack_version_spec.rb reads the
gemspec and the Release Please manifest to check that the version number agrees
in all four places it is written down. Those two examples skip themselves when
the files are not present.
Your own OpenStack setup cannot change the result. ENV is replaced with an
OS_*-free hash, and the clouds.yaml specs additionally pin Dir.pwd,
Dir.home and /etc/openstack, so a real clouds.yaml or secure.yaml on
your machine is never read — which also means a real password can never end up
in an RSpec diff.
Fog model objects use instance_double. Fog service objects cannot, because
Fog defines their methods dynamically at instantiation — spec/support/fog_doubles.rb
explains this.
lib/ is documented with YARD. bundle exec rake yard_stats lists anything
undocumented. Neither is enforced in CI, but new methods should come with docs.
When you add or change a configuration option, update the configuration
reference in README.md as well.
bundle exec rake integration runs the suites in kitchen.yml through Test
Kitchen itself. They need no credentials and no OpenStack deployment:
test/fog_mock.rb puts Fog into mock mode before the driver is loaded, so
create and destroy run their real code against fog-openstack's in-memory
Nova, Neutron and Cinder.
Fog has to be mocked before Test Kitchen instantiates the driver, which is why
the rake task requires the file ahead of the kitchen executable rather than
doing it from kitchen.yml:
bundle exec ruby -Itest -r fog_mock -S kitchen test
bundle exec ruby -Itest -r fog_mock -S kitchen test network-ref-cirros
bundle exec ruby -Itest -r fog_mock -S kitchen diagnose --allWhat this catches that the unit tests cannot: the driver failing to load or
register, a Driver API version mismatch, a file missing from the gemspec, a
config key that no longer survives finalize_config!, and any exception on the
real create/destroy path — each of which the unit tests can miss because they
never go through Test Kitchen's own plugin loading and instance lifecycle.
What it cannot catch: anything only a real cloud decides. Quotas, scheduling, whether the image actually boots, real networking, and SSH are all outside a mock. There is no way to run those in hosted CI — they need a live OpenStack — so they stay a manual step, below.
A few paths are not covered as suites because fog's mocks do not model them:
allocating a new floating IP (the mock's response carries no address),
Cinder volumes (mock volumes never reach available), and reading an address
back off a named network (mock servers are not attached to the mock networks).
Those are covered by the unit tests, and by the manual pass.
The tests above never contact a cloud, so changes that touch instance creation, networking, or credential resolution should also be exercised against a real OpenStack deployment.
Worth exercising separately, since they take different paths:
- each credential source —
clouds.yaml,OS_*environment variables, and explicitkitchen.ymloptions, including the precedence between them - floating IPs, both
allocate_floating_ipand a pre-existingfloating_ip - multiple networks, via
network_ref
Confirm after kitchen destroy that no instances remain, and that any floating
IP allocated by the run was released.
- Fork the repo
- Create a topic branch (
git checkout -b my-new-feature) - Make your change, with tests
- Run
bundle exec rake - Push and open a pull request
Please keep pull requests focused on a single change — it makes review much faster.
Releases are handled by the maintainers.
- Update
lib/kitchen/driver/openstack_version.rbwith the new version. - Update
CHANGELOG.md. - Merge to
main; the publish workflow builds the gem and pushes it to RubyGems.