
Instead of keeping a local copy of spec_helper_acceptance.rb and requiring updates to all modules for any change, we can move it into the common helper gem and require it from there. This will make it easier to create and review changes that affect all puppet modules. Also change the Gemfile to look for the gem in the local workspace if running in a zuul environment. Change-Id: Icfe2ae1d6379bb55a37be833e974c567595053c5
35 lines
988 B
Ruby
35 lines
988 B
Ruby
require 'puppet-openstack_infra_spec_helper/spec_helper_acceptance'
|
|
|
|
describe 'puppet-jenkins slave module', :if => ['debian', 'ubuntu'].include?(os[:family]) do
|
|
def pp_path
|
|
base_path = File.dirname(__FILE__)
|
|
File.join(base_path, 'fixtures')
|
|
end
|
|
|
|
def preconditions_puppet_module
|
|
module_path = File.join(pp_path, 'preconditions.pp')
|
|
File.read(module_path)
|
|
end
|
|
|
|
def default_password
|
|
command('/bin/cat /var/lib/jenkins/secrets/initialAdminPassword').stdout.chomp
|
|
end
|
|
|
|
def jenkins_slave_puppet_module
|
|
module_path = File.join(pp_path, 'slave.pp')
|
|
File.read(module_path).gsub('<<jenkins_default_password>>', default_password)
|
|
end
|
|
|
|
before(:all) do
|
|
apply_manifest(preconditions_puppet_module, catch_failures: true)
|
|
end
|
|
|
|
it 'should work with no errors' do
|
|
apply_manifest(jenkins_slave_puppet_module, catch_failures: true)
|
|
end
|
|
|
|
it 'should be idempotent' do
|
|
apply_manifest(jenkins_slave_puppet_module, catch_changes: true)
|
|
end
|
|
end
|