Skip to content

Instantly share code, notes, and snippets.

@fnichol
Created April 23, 2013 16:41
Show Gist options
  • Save fnichol/5445260 to your computer and use it in GitHub Desktop.
Save fnichol/5445260 to your computer and use it in GitHub Desktop.
Test Kitchen with bats - A Lightning Guide
SUITE_NAME=default
# create a bats subdirectory under your desired suite
mkdir -p test/integration/$SUITE_NAME/bats
# create an initial "canary" bats test file
# more examples at:
# * https://github.com/fnichol/chef-rvm/tree/master/test/integration/rubies/bats
# * https://github.com/fnichol/chef-ruby_build/tree/master/test/integration/alltherubies/bats
# * https://github.com/sstephenson/bats
cat <<'_EOF_' > test/integration/$SUITE_NAME/bats/sanity.bats
@test "gives me a /tmp directory" {
[ -d /tmp ]
}
_EOF_
# run the suite
kitchen verify ${SUITE_NAME}-
@svanzoest
Copy link

Thanks.
That allowed me to write initial tests for the sysctl cookbook.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment