forked from jhoblitt/puppet-udev
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
43 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,57 @@ | ||
require 'beaker-rspec/spec_helper' | ||
require 'beaker-rspec/helpers/serverspec' | ||
require 'beaker/puppet_install_helper' | ||
|
||
unless ENV['RS_PROVISION'] == 'no' or ENV['BEAKER_provision'] == 'no' | ||
# This will install the latest available package on el and deb based | ||
# systems fail on windows and osx, and install via gem on other *nixes | ||
foss_opts = {:default_action => 'gem_install'} | ||
|
||
if default.is_pe?; then | ||
install_pe; | ||
else | ||
install_puppet(foss_opts); | ||
end | ||
|
||
hosts.each do |host| | ||
on hosts, "mkdir -p #{host['distmoduledir']}" | ||
end | ||
# Install Puppet | ||
unless ENV['RS_PROVISION'] == 'no' | ||
ENV['PUPPET_INSTALL_TYPE'] ||= 'agent' | ||
# puppet_install_helper does not understand pessimistic version constraints | ||
# so we are ignoring PUPPET_VERSION. Use PUPPET_INSTALL_VERSION instead. | ||
ENV.delete 'PUPPET_VERSION' | ||
run_puppet_install_helper | ||
end | ||
|
||
RSpec.configure do |c| | ||
# Project root | ||
proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) | ||
|
||
# Readable test descriptions | ||
c.formatter = :documentation | ||
|
||
# Configure all nodes in nodeset | ||
c.before :suite do | ||
# Install module and dependencies | ||
puppet_module_install(:source => proj_root, :module_name => 'udev') | ||
hosts.each do |host| | ||
copy_module_to(host, :source => proj_root, :module_name => 'udev') | ||
|
||
on host, puppet('module', 'install', 'puppetlabs-stdlib'), {:acceptable_exit_codes => [0, 1]} | ||
on host, puppet('module', 'install', 'stahnma-epel'), {:acceptable_exit_codes => [0, 1]} | ||
end | ||
end | ||
end | ||
|
||
def apply(pp, options = {}) | ||
if ENV.key?('PUPPET_DEBUG') | ||
options[:debug] = true | ||
end | ||
|
||
apply_manifest(pp, options) | ||
end | ||
|
||
# Run it twice and test for idempotency | ||
def apply2(pp) | ||
apply(pp, :catch_failures => true) | ||
apply(pp, :catch_changes => true) | ||
end | ||
|
||
# probe stolen from: | ||
# https://github.com/camptocamp/puppet-systemd/blob/master/lib/facter/systemd.rb#L26 | ||
# | ||
# See these issues for an explination of why this is nessicary rather than | ||
# using fact() from beaker-facter in the DSL: | ||
# | ||
# https://tickets.puppetlabs.com/browse/BKR-1040 | ||
# https://tickets.puppetlabs.com/browse/BKR-1041 | ||
# | ||
if shell('ps -p 1 -o comm=').stdout =~ /systemd/ | ||
$systemd = true | ||
else | ||
$systemd = false | ||
end |