kitchen-openstack is a Test Kitchen driver for OpenStack. It provisions and destroys Nova instances using the Fog OpenStack library.
- Ruby 3.1+ required
- All files must start with
# frozen_string_literal: true - Follow Cookstyle (Chef's RuboCop) conventions — config in
.rubocop.yml - Spec files are excluded from linting
- Driver class:
Kitchen::Driver::Openstackinlib/kitchen/driver/openstack.rb— extendsKitchen::Driver::Base(Driver API v2) - Clouds.yaml support:
Kitchen::Driver::Openstack::Cloudsinlib/kitchen/driver/openstack/clouds.rb— parses OpenStackclouds.yaml/secure.yamland translates to Fog config - Server configuration:
Kitchen::Driver::Openstack::Configinlib/kitchen/driver/openstack/config.rb— server naming helpers - Helpers:
Kitchen::Driver::Openstack::Helpersinlib/kitchen/driver/openstack/helpers.rb— ohai hints, SSL, server wait - Networking:
Kitchen::Driver::Openstack::Networkinginlib/kitchen/driver/openstack/networking.rb— floating IP allocation, IP resolution - Server creation:
Kitchen::Driver::Openstack::ServerHelperinlib/kitchen/driver/openstack/server_helper.rb— server creation, image/flavor/network finders - Volume handling:
Kitchen::Driver::Openstack::Volumeinlib/kitchen/driver/openstack/volume.rb - Version constant:
OPENSTACK_VERSIONinlib/kitchen/driver/openstack_version.rb— used by gemspec and release automation - Configuration uses
default_configdeclarations; raiseKitchen::ActionFailedfor driver errors - Supports
clouds.yamlviaopenstack_cloudconfig orOS_CLOUDenv var — seeCloudsmodule
bundle install
bundle exec rake # runs tests + style (default)
bundle exec rake test # unit tests only (RSpec)
bundle exec rake style # Cookstyle lint
bundle exec rake quality # style
bundle exec rake yard # render YARD docs to doc/ (not CI-gated)
bundle exec rake yard_stats # list undocumented methods- Use
Fog::OpenStack::ComputeandFog::OpenStack::Networkfor cloud interactions - Thread safety: use
Mutexfor shared resource pools (e.g., floating IP allocation) - Resource finders (
find_image,find_flavor,find_network) support regex matching via/pattern/syntax - Every method in
lib/carries YARD tags (@param/@return/@raise). Keep new ones documented;rake yard_statsreports gaps but nothing enforces it - Specs mirror
lib/one-to-one:spec/kitchen/driver/openstack/<module>_spec.rb - Shared spec setup lives in
spec/support/: the"with a configured driver"shared context builds the driver and stubsinstance;FogDoublesbuilds the Fog stand-ins verify_partial_doublesis on. Fog model classes takeinstance_double; Fog service objects cannot, because Fog defines their methods dynamically at instantiation- Unit tests never sleep, hit the network, or read outside a
Dir.mktmpdir. The one exemption isopenstack_version_spec.rb, which reads the gemspec and the Release Please manifest to catch version drift, and skips when they are absent.ENVis replaced with anOS_*-free hash, and the clouds.yaml specs additionally pinDir.pwd,Dir.homeand/etc/openstack, so neither a developer's OpenStack environment nor their realclouds.yaml/secure.yamlcan leak in - SimpleCov reports to
coverage/with no enforced threshold - Release automation via Release Please — version bumps go in
lib/kitchen/driver/openstack_version.rb