Skip to content

Latest commit

 

History

134 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

busser-serverspec

Gem Version

A Busser runner plugin that runs Serverspec tests as integration tests.

Busser installs Serverspec on the machine under test the first time a suite runs, then executes the suite's serverspec directory against it. Because the tests run on the machine itself, they use Serverspec's exec backend rather than SSH.

Status

This gem has been archived. No active maintainers have come forward in the past five years and the original maintainer has since pulled the plugin.

We recommend moving to a maintained project for similar functionality, or building and running the gem yourself. In particular, kitchen-verifier-shell with Serverspec covers the same ground and is configured directly in your kitchen.yml.

Requirements

Ruby 3.2 or newer, and busser 0.9.0 or newer.

Installation

Select the Busser verifier in your kitchen.yml:

verifier:
  name: busser

Busser then installs the plugin for you when the suite runs. To install it by hand:

busser plugin install busser-serverspec

Usage

Put your specs in a subdirectory of the suite's serverspec directory:

test
`-- integration
    `-- default              # suite name
        `-- serverspec
            |-- Gemfile          # optional
            |-- spec_helper.rb
            `-- localhost
                `-- httpd_spec.rb

Specs are collected recursively as **/*_spec.rb, so any depth works; the localhost/ directory above is convention, not a requirement. The separator is an underscore — _spec.rb, not -spec.rb. The suite directory is also added to the load path and set as RSpec's default path, so require "spec_helper" works without a relative path.

require "spec_helper"

describe command("echo hello") do
  its(:exit_status) { should eq 0 }
  its(:stdout) { should eq "hello\n" }
end

Backend

The tests run on the machine under test, after Test Kitchen has logged in, so the exec backend is the right one:

require "serverspec"
set :backend, :exec

Do not use set :backend, :ssh — that would have Serverspec connect back out over the network from a machine that is already the target.

Pinning Serverspec

A Gemfile in the suite directory is bundle installed before the run, which is how you pin a particular Serverspec version:

source "https://rubygems.org"

gem "serverspec", "~> 2.43"

Without one, the plugin installs Serverspec 2.43 or newer.

Using it with Test Kitchen

This is how most people run it, and it needs no Busser commands of your own. Select the verifier in kitchen.yml:

verifier:
  name: busser

suites:
  - name: default

Then put your tests in a serverspec directory inside the suite:

test/integration/default/serverspec/localhost/httpd_spec.rb

kitchen verify installs Busser and this plugin on the instance and runs them. The directory name is what selects this plugin -- there is nothing else to configure.

When nothing runs

If the suite files do not match what this plugin looks for, the run prints one line and exits 0:

-----> Running serverspec test suite

No tests ran, and nothing said so. Work through these in order:

  1. Is the directory named serverspec? That name alone selects this plugin. serverspecs/, tests/ or anything else is not picked up.
  2. Do the filenames match? Only *_spec.rb is run, searched recursively; note the underscore -- default-spec.rb is not picked up.
  3. Is the plugin installed? busser plugin list shows what is available.
  4. Is BUSSER_ROOT what you think? busser suite path prints where suites are actually being looked for.

Contributing

Bug reports and pull requests are welcome. See CONTRIBUTING.md for how to set up the project, run the test suite, and format your commits.

License

Apache License 2.0. See LICENSE.

Originally created by HIGUCHI Daisuke.

About

A Busser runner plugin for the serverspec testing library

Topics

Resources

Code of conduct

Contributing

Stars

54 stars

Watchers

13 watching

Forks

Releases

Packages

Used by

Contributors

Languages