Skip to content

Commit

Permalink
Merge pull request redhat-openstack#218 from mhaskel/test
Browse files Browse the repository at this point in the history
Merge 3.2.x into master
  • Loading branch information
cmurphy committed Oct 31, 2014
2 parents a607bd4 + 5a63a51 commit 00e30e0
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 26 deletions.
3 changes: 1 addition & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ group :development, :test do
gem 'puppetlabs_spec_helper', :require => false
gem 'serverspec', :require => false
gem 'puppet-lint', :require => false
gem 'beaker', :require => false
gem 'beaker-rspec', :require => false
gem 'beaker-rspec','>=2.2.0', :require => false
gem 'pry', :require => false
gem 'simplecov', :require => false
end
Expand Down
15 changes: 10 additions & 5 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
$udlc = false
$interfaces = []

# On virtual machines allow large clock skews.
# On virtual machines allow large clock skews.
$panic = str2bool($::is_virtual) ? {
true => false,
default => true,
Expand Down Expand Up @@ -87,6 +87,12 @@
]
}
'Suse': {
if $::operatingsystem == 'SLES' and $::operatingsystemmajrelease == '12'
{
$service_name = 'ntpd'
} else{
$service_name = 'ntp'
}
$config = $default_config
$keys_file = $default_keys_file
$driftfile = '/var/lib/ntp/drift/ntp.drift'
Expand All @@ -97,7 +103,6 @@
'127.0.0.1',
'-6 ::1',
]
$service_name = 'ntp'
$iburst_enable = false
$servers = [
'0.opensuse.pool.ntp.org',
Expand Down Expand Up @@ -168,7 +173,7 @@
'3.pool.ntp.org',
]
}
# Gentoo was added as its own $::osfamily in Facter 1.7.0
# Gentoo was added as its own $::osfamily in Facter 1.7.0
'Gentoo': {
$config = $default_config
$keys_file = $default_keys_file
Expand All @@ -190,8 +195,8 @@
]
}
'Linux': {
# Account for distributions that don't have $::osfamily specific settings.
# Before Facter 1.7.0 Gentoo did not have its own $::osfamily
# Account for distributions that don't have $::osfamily specific settings.
# Before Facter 1.7.0 Gentoo did not have its own $::osfamily
case $::operatingsystem {
'Gentoo': {
$config = $default_config
Expand Down
20 changes: 20 additions & 0 deletions spec/acceptance/nodesets/sles-12-64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
HOSTS:
czriitzephrrlzw:
roles:
- master
- database
- dashboard
- agent
- default
platform: sles-12-x86_64
template: sles-12-x86_64
hypervisor: vcloud
CONFIG:
nfs_server: none
consoleport: 443
datastore: instance0
folder: Delivery/Quality Assurance/Enterprise/Dynamic
resourcepool: delivery/Quality Assurance/Enterprise/Dynamic
pooling_api: http://vcloud.delivery.puppetlabs.net/
pe_dir: http://enterprise.delivery.puppetlabs.net/3.4/preview
6 changes: 5 additions & 1 deletion spec/acceptance/ntp_install_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@
packagename = 'service/network/ntp'
end
else
packagename = 'ntp'
if fact('operatingsystem') == 'SLES' and fact('operatingsystemmajrelease') == '12'
servicename = 'ntpd'
else
servicename = 'ntp'
end
end

describe 'ntp::install class', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
Expand Down
6 changes: 5 additions & 1 deletion spec/acceptance/ntp_parameters_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@
packagename = 'service/network/ntp'
end
else
packagename = 'ntp'
if fact('operatingsystem') == 'SLES' and fact('operatingsystemmajrelease') == '12'
servicename = 'ntpd'
else
servicename = 'ntp'
end
end

if (fact('osfamily') == 'Solaris')
Expand Down
20 changes: 12 additions & 8 deletions spec/acceptance/ntp_service_spec.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
require 'spec_helper_acceptance'

case fact('osfamily')
when 'RedHat', 'FreeBSD', 'Linux', 'Gentoo'
servicename = 'ntpd'
when 'Solaris'
servicename = 'network/ntp'
when 'AIX'
servicename = 'xntpd'
else
servicename = 'ntp'
when 'RedHat', 'FreeBSD', 'Linux', 'Gentoo'
servicename = 'ntpd'
when 'Solaris'
servicename = 'network/ntp'
when 'AIX'
servicename = 'xntpd'
else
if fact('operatingsystem') == 'SLES' and fact('operatingsystemmajrelease') == '12'
servicename = 'ntpd'
else
servicename = 'ntp'
end
end

describe 'ntp::service class', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
Expand Down
14 changes: 9 additions & 5 deletions spec/classes/ntp_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
let :facts do
super().merge({ :osfamily => 'Linux', :operatingsystem => 'Gentoo' })
end
elsif system == 'Suse'
let :facts do
super().merge({ :osfamily => system,:operatingsystem => 'SLES',:operatingsystemmajrelease => '11' })
end
else
let :facts do
super().merge({ :osfamily => system })
Expand Down Expand Up @@ -214,19 +218,19 @@
:servers => ['a', 'b', 'c', 'd'],
:logfile => '/var/log/foobar.log',
}}

it 'should contain logfile setting' do
should contain_file('/etc/ntp.conf').with({
'content' => /^logfile = \/var\/log\/foobar\.log\n/,
})
end
end

context 'when set to false' do
let(:params) {{
:servers => ['a', 'b', 'c', 'd'],
}}

it 'should not contain a logfile line' do
should_not contain_file('/etc/ntp.conf').with({
'content' => /logfile =/,
Expand Down Expand Up @@ -289,13 +293,13 @@

describe "on osfamily Suse" do
let :facts do
super().merge({ :osfamily => 'Suse' })
super().merge({ :osfamily => 'Suse', :operatingsystem => 'SLES',:operatingsystemmajrelease => '11' })
end

it 'uses the opensuse ntp servers by default' do
should contain_file('/etc/ntp.conf').with({
'content' => /server \d.opensuse.pool.ntp.org/,
})
})
end
end

Expand Down
14 changes: 10 additions & 4 deletions spec/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
require 'beaker-rspec'

UNSUPPORTED_PLATFORMS = [ 'windows', 'Darwin' ]
UNSUPPORTED_PLATFORMS = ['windows', 'Darwin']

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' }
foss_opts = {:default_action => 'gem_install'}

if default.is_pe?; then install_pe; else install_puppet( foss_opts ); end
if default.is_pe?; then
install_pe;
else
install_puppet(foss_opts);
end

hosts.each do |host|
unless host.is_pe?
on host, "/bin/echo '' > #{host['hieraconf']}"
end
on host, "mkdir -p #{host['distmoduledir']}"
on host, puppet('module install puppetlabs-stdlib'), { :acceptable_exit_codes => [0,1] }
on host, apply_manifest('package{"git":ensure => present}')
on host, 'git clone -b 3.2.x https://github.com/puppetlabs/puppetlabs-stdlib /etc/puppetlabs/puppet/modules/stdlib'
end
end

Expand All @@ -29,6 +34,7 @@
c.before :suite do
hosts.each do |host|
on host, "mkdir -p #{host['distmoduledir']}/ntp"
on host, puppet('module install puppetlabs-stdlib')
%w(lib manifests templates metadata.json).each do |file|
scp_to host, "#{proj_root}/#{file}", "#{host['distmoduledir']}/ntp"
end
Expand Down

0 comments on commit 00e30e0

Please sign in to comment.