https://github.com/raphink/mspectator
Use RSpec and MCollective to test your fleet
https://github.com/raphink/mspectator
Last synced: about 1 year ago
JSON representation
Use RSpec and MCollective to test your fleet
- Host: GitHub
- URL: https://github.com/raphink/mspectator
- Owner: raphink
- Created: 2013-04-12T06:43:11.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2020-05-24T20:58:19.000Z (about 6 years ago)
- Last Synced: 2025-03-29T06:21:38.548Z (about 1 year ago)
- Language: Ruby
- Size: 25.4 KB
- Stars: 20
- Watchers: 4
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
mspectator
==========
[](https://rubygems.org/gems/mspectator)
[](https://rubygems.org/gems/mspectator)
[](https://gemnasium.com/raphink/mspectator)
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](http://serverspec.org) 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:
* An MCollective node with the [`spec` agent](https://github.com/camptocamp/puppet-spec/tree/master/files/mcollective/agent);
* [`serverspec`](http://serverspec.org);
# 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](http://rspec.info), on the client side;
* The [serverspec](http://serverspec.org) backends and matchers, on the server side;
* The [spec MCollective agent](https://github.com/camptocamp/puppet-spec/tree/master/files/mcollective/agent) on the server side;
* A series of matchers on the client side to describe the hosts being tested.