Colleen Murphy e3f67e7941 Use the default jenkins password for JJB
This module does not create a jenkins user within jenkins, so there is
no way its password could have been set to 'secret'. Trying to use this
as JJB's auth credentials was causing the JJB exec to fail. This patch
grabs the default admin password out of /var and uses that for JJB.

Change-Id: Ifa60398acbc494dcfecd0cabaa8c829590c1744e
2017-06-11 16:42:52 +02:00

35 lines
953 B
Ruby

require '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