Skip to content

Instantly share code, notes, and snippets.

@deanwilson
Created March 16, 2011 17:32
Show Gist options
  • Save deanwilson/872888 to your computer and use it in GitHub Desktop.
Save deanwilson/872888 to your computer and use it in GitHub Desktop.
Simple Puppet cucumber-nagios package stub
Feature: puppetwrappers
Package Checks
Scenario: Confirming package installation
When a machine has been puppeted
Then the bash package should be installed.
Scenario: Confirm bash package is absent
When a machine has been puppeted
Then the bash package should not be installed.
Scenario: Confirm doodoodoo package is absent
When a machine has been puppeted
Then the doodoodoo package should not be installed.
Scenario: Confirm cron service is running
When a machine has been puppeted
Then the cron service should be running.
Scenario: Confirm tomcat6 service is not running
When a machine has been puppeted
Then the tomcat6 service should not be running.
When /^a machine has been puppeted$/ do
require 'puppet'
end
Then /^the (.+) package should be installed.$/ do | package |
ppp = Puppet::Type.type(:package).new(:name => package ).provider.properties
ppp[:status].should == "installed"
end
Then /^the (.+) package should not be installed.$/ do | package |
ppp = Puppet::Type.type(:package).new(:name => package ).provider.properties
ppp[:status].should == "missing"
end
Then /^the (.+) service should be running.$/ do | service |
service_status = Puppet::Type.type(:service).new(:name => service, :hasstatus => true).provider.status
service_status.should == :running
end
# fails on not installed services:
# took away has status as tomcat test script didn't support it.
Then /^the (.+) service should not be running.$/ do | service |
service_status = Puppet::Type.type(:service).new(:name => service).provider.status
service_status.should == :stopped
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment