Add init unit test (WIP)

Signed-off-by: Emilien Macchi <emilien.macchi@enovance.com>
This commit is contained in:
Emilien Macchi 2013-12-29 21:25:45 +01:00
parent 11063d001c
commit 6ee7c13283
3 changed files with 87 additions and 5 deletions

View File

@ -23,6 +23,7 @@ fixtures:
repo: 'git://github.com/puppetlabs/puppetlabs-rabbitmq'
ref: 'origin/2.x'
'memcached': 'git://github.com/saz/puppet-memcached'
'ntp': 'git://github.com/enovance/puppetlabs-ntp.git'
'sysctl': 'git://github.com/duritong/puppet-sysctl.git'
'inifile': 'git://github.com/puppetlabs/puppetlabs-inifile'
'vswitch': 'git://github.com/stackforge/puppet-vswitch'

View File

@ -44,11 +44,11 @@ This node is under the control of Puppet ${::puppetversion}.
# DNS
$datacenter = 'ci'
class{ 'resolver':
dcinfo => { ci => $os_params::dns_ips, },
domainname => $os_params::site_domain,
searchpath => $os_params::site_domain,
}
class{ 'resolver':
dcinfo => { ci => $os_params::dns_ips, },
domainname => $os_params::site_domain,
searchpath => $os_params::site_domain,
}
# NTP
class { 'ntp': }

View File

@ -0,0 +1,81 @@
#
# Copyright (C) 2013 eNovance SAS <licensing@enovance.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# Unit tests for privatecloud
#
require 'spec_helper'
describe 'privatecloud' do
shared_examples_for 'private cloud node' do
let :pre_condition do
'
include concat::setup
'
end
let :file_defaults do
{
:mode => '0644'
}
end
it {should contain_file('/etc/motd').with(
{:ensure => 'file'}.merge(file_defaults)
)}
it 'should build motd file with correct message' do
verify_contents(subject, '/etc/motd',
[
"############################################################################",
"# eNovance IT Operations #",
"############################################################################",
"# #",
"# *** RESTRICTED ACCESS *** #",
"# Only the authorized users may access this system. #",
"# Any attempted unauthorized access or any action affecting the computer #",
"# system of eNovance is punishable under articles 323-1 to 323-7 of #",
"# French criminal law. #",
"# #",
"############################################################################",
"This node is under the control of Puppet ${::puppetversion}."
]
)
end
end
context 'on Debian platforms' do
let :facts do
{ :osfamily => 'Debian',
:concat_basedir => '/var/lib/puppet/concat',
:puppetversion => '3.3' }
end
# it_configures 'private cloud node'
end
context 'on RedHat platforms' do
let :facts do
{ :osfamily => 'RedHat',
:concat_basedir => '/var/lib/puppet/concat',
:puppetversion => '3.3' }
end
# it_configures 'private cloud node'
end
end