Commit bcf8ea2e authored by Tim Meusel's avatar Tim Meusel Committed by GitHub

Merge pull request #874 from bastelfreak/manual_fixes

partial modulesync 1.9.2
parents e281241f 692d230f
fixtures:
repositories:
apt:
repo: "https://github.com/puppetlabs/puppetlabs-apt"
ref: "4.1.0"
stdlib:
repo: "https://github.com/puppetlabs/puppetlabs-stdlib"
ref: "4.18.0"
apt: "https://github.com/puppetlabs/puppetlabs-apt"
stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib"
java: "https://github.com/puppetlabs/puppetlabs-java"
zypprepo: "https://github.com/voxpupuli/puppet-zypprepo.git"
archive: "https://github.com/voxpupuli/puppet-archive.git"
......
--color --order random --fail-fast
--format documentation
--color
......@@ -14,6 +14,7 @@ gem 'rspec-puppet', '~> 2.5.0', :require => false
gem 'rubocop', '~> 0.49.1', :require => false
gem 'rubocop-rspec', '~> 1.15.0', :require => false
gem 'travis', '~> 1.8', :require => false
gem 'rspec-puppet-facts'
group :development do
gem 'byebug'
......
# lint:ignore:autoloader_layout
class jenkins::job::build(
# lint:endignore
$config = undef,
$jobname = $title,
$enabled = 1,
......
# lint:ignore:autoloader_layout
class jenkins::plugin::git (
# lint:endignore
$version = 0,
$manage_config = false,
$config_filename = 'hudson.plugins.git.GitSCM.xml',
......@@ -20,4 +22,4 @@ class jenkins::plugin::git (
config_filename => $config_filename,
config_content => $real_content,
}
}
\ No newline at end of file
}
......@@ -91,7 +91,7 @@ define jenkins::plugin(
fail("unsupported plugin extension in source url: ${download_url}")
}
$installed_plugins = $::jenkins_plugins ? {
$installed_plugins = fact('jenkins_plugins') ? {
undef => [],
default => strip(split($::jenkins_plugins, ',')),
}
......
require 'spec_helper'
describe 'jenkins', type: :class do
# Switching OS Family to prevent duplicate declaration
let(:facts) do
{
osfamily: 'Debian',
lsbdistcodename: 'precise',
lsbdistid: 'ubuntu',
operatingsystem: 'Debian',
os: {
name: 'Debian',
release: { full: '11.04' }
}
}
end
on_supported_os.each do |os, facts|
next unless facts[:os]['family'] == 'Debian'
context 'repo::debian' do
shared_examples 'an apt catalog' do
it { is_expected.to contain_class('apt') }
it { is_expected.to contain_apt__source('jenkins').that_notifies('Exec[apt_update]') }
end
context "on #{os} " do
systemd_fact = case facts[:operatingsystemmajrelease]
when '6'
{ systemd: false }
else
{ systemd: true }
end
let :facts do
facts.merge(systemd_fact)
end
describe 'default' do
it_behaves_like 'an apt catalog'
it { is_expected.to contain_apt__source('jenkins').with_location('https://pkg.jenkins.io/debian-stable') }
end
context 'repo::debian' do
shared_examples 'an apt catalog' do
it { is_expected.to contain_class('apt') }
it { is_expected.to contain_apt__source('jenkins').that_notifies('Exec[apt_update]') }
end
describe 'lts = true' do
let(:params) { { lts: true } }
describe 'default' do
it_behaves_like 'an apt catalog'
it { is_expected.to contain_apt__source('jenkins').with_location('https://pkg.jenkins.io/debian-stable') }
end
it_behaves_like 'an apt catalog'
it { is_expected.to contain_apt__source('jenkins').with_location('https://pkg.jenkins.io/debian-stable') }
end
describe 'lts = true' do
let(:params) { { lts: true } }
it_behaves_like 'an apt catalog'
it { is_expected.to contain_apt__source('jenkins').with_location('https://pkg.jenkins.io/debian-stable') }
end
describe 'lts = false' do
let(:params) { { lts: false } }
describe 'lts = false' do
let(:params) { { lts: false } }
it_behaves_like 'an apt catalog'
it { is_expected.to contain_apt__source('jenkins').with_location('https://pkg.jenkins.io/debian') }
it_behaves_like 'an apt catalog'
it { is_expected.to contain_apt__source('jenkins').with_location('https://pkg.jenkins.io/debian') }
end
end
end
end
end
require 'spec_helper'
describe 'jenkins', type: :class do
describe 'repo' do
describe 'default' do
describe 'RedHat' do
let(:facts) do
{
osfamily: 'RedHat',
operatingsystem: 'CentOs',
operatingsystemrelease: '6.7',
operatingsystemmajrelease: '6'
}
end
it { is_expected.to contain_class('jenkins::repo::el') }
it { is_expected.not_to contain_class('jenkins::repo::suse') }
it { is_expected.not_to contain_class('jenkins::repo::debian') }
on_supported_os.each do |os, facts|
context "on #{os} " do
systemd_fact = case facts[:operatingsystemmajrelease]
when '6'
{ systemd: false }
else
{ systemd: true }
end
let :facts do
facts.merge(systemd_fact)
end
describe 'Suse' do
let(:facts) { { osfamily: 'Suse', operatingsystem: 'OpenSuSE' } }
it { is_expected.to contain_class('jenkins::repo::suse') }
it { is_expected.not_to contain_class('jenkins::repo::el') }
it { is_expected.not_to contain_class('jenkins::repo::debian') }
end
describe 'Debian' do
let(:facts) do
{
osfamily: 'Debian',
lsbdistid: 'debian',
lsbdistcodename: 'natty',
operatingsystem: 'Debian',
os: {
name: 'Debian',
release: { full: '11.04' }
}
}
describe 'repo' do
describe 'default' do
case facts[:os]['family']
when 'RedHat'
describe 'RedHat' do
it { is_expected.to contain_class('jenkins::repo::el') }
it { is_expected.not_to contain_class('jenkins::repo::suse') }
it { is_expected.not_to contain_class('jenkins::repo::debian') }
end
describe 'repo => false' do
let(:params) { { repo: false } }
it { is_expected.not_to contain_class('jenkins::repo') }
it { is_expected.not_to contain_class('jenkins::repo::el') }
it { is_expected.not_to contain_class('jenkins::repo::suse') }
it { is_expected.not_to contain_class('jenkins::repo::debian') }
end
when 'Suse'
describe 'Suse' do
it { is_expected.to contain_class('jenkins::repo::suse') }
it { is_expected.not_to contain_class('jenkins::repo::el') }
it { is_expected.not_to contain_class('jenkins::repo::debian') }
end
when 'Debian'
describe 'Debian' do
it { is_expected.to contain_class('jenkins::repo::debian') }
it { is_expected.not_to contain_class('jenkins::repo::suse') }
it { is_expected.not_to contain_class('jenkins::repo::el') }
end
end
end
it { is_expected.to contain_class('jenkins::repo::debian') }
it { is_expected.not_to contain_class('jenkins::repo::suse') }
it { is_expected.not_to contain_class('jenkins::repo::el') }
end
describe 'Unknown' do
let(:facts) { { osfamily: 'SomethingElse', operatingsystem: 'RedHat' } }
it { expect { is_expected.to raise_error(Puppet::Error) } }
end
end
describe 'repo => false' do
let(:facts) do
{
osfamily: 'RedHat',
operatingsystem: 'CentOs',
operatingsystemrelease: '6.7',
operatingsystemmajrelease: '6'
}
end
let(:params) { { repo: false } }
it { is_expected.not_to contain_class('jenkins::repo') }
it { is_expected.not_to contain_class('jenkins::repo::el') }
it { is_expected.not_to contain_class('jenkins::repo::suse') }
it { is_expected.not_to contain_class('jenkins::repo::debian') }
end
end
end
require 'spec_helper'
describe 'jenkins::sysconfig' do
let(:pre_condition) { 'include ::jenkins' }
let(:pre_condition) { 'include jenkins' }
let(:title) { 'myprop' }
let(:params) { { 'value' => 'myvalue' } }
describe 'on RedHat' do
let(:facts) do
{
osfamily: 'RedHat',
operatingsystem: 'CentOS',
operatingsystemrelease: '7.2',
operatingsystemmajrelease: '7'
}
end
it do
is_expected.to contain_file_line('Jenkins sysconfig setting myprop').with(
path: '/etc/sysconfig/jenkins',
line: 'myprop="myvalue"',
match: '^myprop='
).that_notifies('Service[jenkins]')
end
end # on RedHat
let(:params) { { 'value' => 'myvalue' } }
describe 'on Debian' do
let(:facts) do
{
osfamily: 'Debian',
operatingsystem: 'Debian',
lsbdistcodename: 'squeeze',
lsbdistid: 'debian',
os: {
name: 'Debian',
release: { full: '11.04' }
}
}
end
on_supported_os.each do |os, facts|
context "on #{os} " do
systemd_fact = case facts[:operatingsystemmajrelease]
when '6'
{ systemd: false }
else
{ systemd: true }
end
let :facts do
facts.merge(systemd_fact)
end
it do
is_expected.to contain_file_line('Jenkins sysconfig setting myprop').with(
path: '/etc/default/jenkins',
line: 'myprop="myvalue"',
match: '^myprop='
).that_notifies('Service[jenkins]')
case facts[:os]['family']
when 'RedHat'
describe 'on RedHat' do
it do
is_expected.to contain_file_line('Jenkins sysconfig setting myprop').with(
path: '/etc/sysconfig/jenkins',
line: 'myprop="myvalue"',
match: '^myprop='
).that_notifies('Service[jenkins]')
end
end
when 'Debian'
describe 'on Debian' do
it do
is_expected.to contain_file_line('Jenkins sysconfig setting myprop').with(
path: '/etc/default/jenkins',
line: 'myprop="myvalue"',
match: '^myprop='
).that_notifies('Service[jenkins]')
end
end
end
end
end # on Debian
end
end
require 'rspec'
require 'rspec/its'
require 'puppetlabs_spec_helper/module_spec_helper'
require 'rspec-puppet-facts'
include RspecPuppetFacts
ENV['STRICT_VARIABLES'] = 'no'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment