Upgrade to Pro — share decks privately, control downloads, hide ads and more …

CI with Puppet

CI with Puppet

Jon spoke at the June meetup of the London Continuous Delivery Meetup about Continuous Integration with Puppet.

The Scale Factory

June 22, 2016
Tweet

More Decks by The Scale Factory

Other Decks in Technology

Transcript

  1. TESTING GOALS_ Fast Feedback Don’t Break Other Customers Don’t Break

    Other Distributions Ensure Forward Compatibility Ensure Backward Compatibility Work in Dev and CI
  2. TESTING OPTIONS_ Syntax Check - 26s Linting - 31s Spec

    Testing - 1m 56s Integration - 6+ hrs
  3. Feature: NTP daemon installation In order to keep time synchronised

    As a systems administrator I want to install, configure and run ntpd Scenario: NTP client installation Given there is a running VM called "server" When I apply a puppet manifest containing: """ include cucumber_defaults class { "sf_ntpd": } """ Then a second manifest application should do nothing And there should be some processes matching /^ntpd$/ running And a process matching /^ntpd$/ should be listening on UDP port 123 vagrant-cucumber https:/ /github.com/scalefactory/vagrant-cucumber
  4. Given /^there is a running VM called "([^"]*)"$/ do |vmname|

    machine = vagrant_glue.get_vm( vmname ) machine.action(:up) unless machine.provider.driver.has_snapshot? vagrant_glue.vagrant_env.cli('snap', 'take', vmname ) end end vagrant-cucumber
  5. When /^I apply a puppet manifest(#{VMRE}) containing:$/ do |vmre, manifest_content|

    exit_status = run_manifest(vmre, manifest_content) @last_puppet_exit_status = exit_status success = exit_status == 0 || exit_status == 2 exit_status_log(success) Test::Unit.assert( success, "Exit code of puppet run (#{exit_status}) not 0 or 2 - errors" ) end vagrant-cucumber
  6. Then a second manifest application should do nothing And there

    should be a process matching /^mongod[a-z]?$/ running on the VM called "server" And there should be a process matching /^mongod[a-z]?$/ running on the VM called "client" And there should be a process matching /^mongod[a-z]?$/ running on the VM called "slave" Then I sleep for 5 seconds And a process matching /^mongod[a-z]?$/ should be listening on TCP port 27017 on the VM called "server" And a process matching /^mongod[a-z]?$/ should be listening on TCP port 27017 on the VM called "client" And a process matching /^mongod[a-z]?$/ should be listening on TCP port 27017 on the VM called "slave" And shell command `echo "db.things.find()" | mongo 10.42.42.2/test` on the VM called "client" should succeed within 60 seconds And shell command `echo "db.things.find()" | mongo 10.42.42.2/test` on the VM called "slave" should succeed within 60 seconds And shell command `echo "db.things.find()" | mongo 10.42.42.3/test` on the VM called "server" should succeed within 60 seconds And shell command `echo "db.things.find()" | mongo 10.42.42.3/test` on the VM called "client" should succeed within 60 seconds And shell command `echo "db.things.find()" | mongo 10.42.42.5/test` on the VM called "server" should succeed within 60 seconds And shell command `echo "db.things.find()" | mongo 10.42.42.5/test` on the VM called "slave" should succeed within 60 seconds And shell command `/usr/sbin/sf-mongodb-initiate-replset 10.42.42.3,10.42.42.5` on the VM called "server" should succeed Then I sleep for 5 seconds And the output from shell command `echo "rs.status()" | mongo` on the VM called "server" should match /"_id" : 2,/ And the output from shell command `echo "rs.status()" | mongo` on the VM called "slave" should match /"_id" : 2,/ And the output from shell command `echo "rs.status()" | mongo` on the VM called "client" should match /"_id" : 2,/ vagrant-cucumber
  7. TEST SCENARIO_ Start Vagrant Boxes For each test: Snapshot Box

    Run Scenario Rollback Box Destroy Boxes
  8. WHAT TO TEST_ Test that Puppet works Branch Coverage Things

    That Often Break Things That Are Complex