Skip to content

Instantly share code, notes, and snippets.

@raphink
Last active February 4, 2016 00:44
Show Gist options
  • Save raphink/5337833 to your computer and use it in GitHub Desktop.
Save raphink/5337833 to your computer and use it in GitHub Desktop.
Distributed serverspec tests using MCollective instead of SSH.
+-------------------------------------+ +-------------------------------------+
| Client | | Server |
|-------------------------------------| |-------------------------------------|
| | | |
| mco spec | | Serverspec |
| + | | ^ |
| | | | | |
| v | | + |
| MCollective::Application | | RSpec::Core::Runner#run |
| | | | ^ |
| + | | | |
| | | | + |
| +-------------------------------------------> MCollective::RPC::Agent |
| | | |
| | | |
| | | |
+-------------------------------------+ +-------------------------------------+
+-------------------------------------+ +-------------------------------------+
| Client | | Server |
|-------------------------------------| |-------------------------------------|
| | | |
| rspec | | |
| + | | |
| | | | |
| v | | |
| Serverspec | | |
| + | | |
| | (check_action, *args) | | |
| v | | |
| Serverspec::Backend::MCollective | | |
| + | | |
| | (check_action, *args) | | Serverspec::Backend::Puppet |
| v | | or |
| MCollective::RPC#rpcclient | | Serverspec::Backend::Exec |
| | | | ^ |
| + | | | (check_action, *args) |
| | | | + |
| +-------------------------------------------> MCollective::RPC::Agent |
| action, *args | | |
| | | |
| | | |
+-------------------------------------+ +-------------------------------------+
@raphink
Copy link
Author

raphink commented Apr 8, 2013

Required to implement local_tests:

Pros:

  • The same tests can be run with puppet-spec and through MCollective. MCollective only triggers them.

Cons:

  • The tests have to be deployed before they can be triggered.

Required to implement passed_commands:

  • A Serverspec::Backend::MCollective Serverspec backend, passing check_* methods to MCollective::RPC#rpcclient
  • An MCollective::RPC::Agent taking actions sent by Serverspec::Backend::MCollective and sending them to a local Serverspec backend (Exec, Puppet, etc) and returning the status through MCollective::RPC.

Pros:

  • No command is passed, which makes the system it more secure by design.

Cons:

  • It requires to deploy Serverspec on all servers (which isn't really hard with gem + your favorite config manager).

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