Project

mspectator

0.0
No commit activity in last 3 years
No release in over 3 years
Use RSpec and MCollective to test your fleet
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 1.3
>= 0
 Project Readme

mspectator

Gem Version Gem Downloads Gemnasium

Use RSpec and MCollective to test your fleet

Goal

This project provides a way to test your fleet of servers using RSpec and MCollective.

It is similar to the serverspec project, but it uses MCollective instead of SSH as a network facility, and it allows to test more than a host at a time.

Installing

Client side

On the client side (where you run rspec), you need mspectator itself:

gem install mspectator

You also need to have an MCollective client set up, as well as RSpec.

Server side

On the server side (the hosts you are testing), you need:

Example

The matchers allow to test hosts based on filters, using classes and facts. Below is an example:

require 'mspectator'

describe "apache::server" do
  it { should find_nodes(10).or_less.with_agent('spec') }
  it { should have_certificate.signed }
  it { should pass_puppet_spec }

  context "when on Debian", :facts => [:operatingsystem => "Debian"] do
    it { should find_nodes(5).or_more }
    it { should have_service('apache2').with(
      :ensure => 'running',
      :enable => 'true'
      )
    }
    it { should have_package('apache2') }
    it { should have_user('www-data') }
  end
end

Architecture

Network architecture and libraries

The general architecture of the solution is the following:

 +-------------------------------------+           +-------------------------------------+
 |      Client                         |           |        Server                       |
 |-------------------------------------|           |-------------------------------------|
 |                                     |           |                                     |
 |     rspec                           |           |                                     |
 |       +                             |           |                                     |
 |       | (check_action, *args)       |           |                                     |
 |       v                             |           |                                     |
 |  MCollective::RPC#rpcclient         |           |         Specinfra::Backend::Exec    |
 |       |                             |           |           ^                         |
 |       +                             |           |           | (check_action, *args)   |
 |       |                             |           |           +                         |
 |       +------------------------------------------->  MCollective::RPC::Agent          |
 |                action, *args        |           |                                     |
 |                                     |           |                                     |
 +-------------------------------------+           +-------------------------------------+

The components required for this architecture are:

  • RSpec, on the client side;
  • The serverspec backends and matchers, on the server side;
  • The spec MCollective agent on the server side;
  • A series of matchers on the client side to describe the hosts being tested.