About Commands

Test Kitchen is driven entirely from the kitchen command line tool. Every subcommand follows the same shape:

kitchen SUBCOMMAND [INSTANCE|REGEXP|all] [FLAGS]

Run kitchen help for the full list, or kitchen help SUBCOMMAND for the flags a single subcommand accepts.

Choosing which instances to act on

An instance is one suite paired with one platform. If your kitchen.yml defines two suites and three platforms, you have six instances. Every subcommand that operates on instances accepts the same target argument:

Target Meaning
(omitted) Every instance. Equivalent to all for most subcommands.
all Every instance.
default-ubuntu-2204 One instance, matched by its full name.
default A Ruby regular expression. Matches every instance whose name contains default.
^default.*2204$ Anchored regular expression, for when a loose match is too broad.

The argument is a regular expression, not a glob. kitchen converge ubuntu converges every instance with ubuntu anywhere in its name, and kitchen converge '.*' is the same as kitchen converge all.

Quote your regular expressions. Characters like *, ?, and | are meaningful to your shell and will be expanded before kitchen ever sees them.

The instance lifecycle

Instances move through a fixed sequence of states. Each state has a subcommand, and running any subcommand also runs every earlier action the instance has not completed yet.

destroy → create → converge → setup → verify → destroy
State Subcommand What happens
create kitchen create The driver builds the compute instance.
converge kitchen converge The provisioner configures the instance.
setup kitchen setup The verifier installs whatever it needs to run tests.
verify kitchen verify The verifier runs the tests.
destroy kitchen destroy The driver tears the instance down.

Because the actions are cumulative, kitchen verify on a fresh checkout will create the instance, converge it, and set it up before running a single test. You rarely need to call create or setup yourself.

kitchen test runs the whole cycle from a clean slate and is the command you want in CI.

Flags shared by most subcommands

Every instance-oriented subcommand accepts these logging flags:

Flag Alias Description
--log-level LEVEL -l Set the log level: debug, info, warn, error, or fatal.
--log-overwrite Set to false to keep previous log files instead of overwriting them on each run.
--color Toggle color output on STDOUT. Defaults to on when STDOUT is a TTY.
--test-base-path PATH -t Set the base path Test Kitchen searches for tests.

The five lifecycle subcommands and kitchen test additionally accept:

Flag Alias Description
--concurrency [N] -c Act on matching instances concurrently. With no number, all matching instances run at once.
--parallel -p Deprecated. Use --concurrency.

The five lifecycle subcommands — but not kitchen test — also accept --fail-fast (-f), which stops as soon as any instance fails instead of letting the rest finish. kitchen converge and kitchen verify accept --debug (-D) to run the provisioner or verifier in debug mode.

--concurrency with no argument means unlimited, which on a large matrix will happily start dozens of cloud instances at once. Pass a number you actually want: kitchen test -c 4.

Command reference

Lifecycle

Inspecting and debugging

Project and environment

Configuration file locations

kitchen reads up to three YAML files and merges them, in increasing order of precedence:

File Environment variable Purpose
~/.kitchen/config.yml KITCHEN_GLOBAL_YAML Personal defaults across every project.
kitchen.yml KITCHEN_YAML The project’s committed configuration.
kitchen.local.yml KITCHEN_LOCAL_YAML Uncommitted local overrides.

Use KITCHEN_YAML to keep several configurations side by side:

KITCHEN_YAML=kitchen.dokken.yml kitchen test
The older .kitchen.yml filename, with a leading dot, still works. kitchen.yml is preferred for new projects.