forked from CERIT-SC/puppet-yum
-
-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from Yuav/add_tests
Add basic spec tests
- Loading branch information
Showing
14 changed files
with
130 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
fixtures: | ||
repositories: | ||
stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib.git" | ||
symlinks: | ||
yum: "#{source_dir}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
require 'spec_helper_acceptance' | ||
|
||
describe 'yum class' do | ||
context 'default parameters' do | ||
# Using puppet_apply as a helper | ||
it 'must work idempotently with no errors' do | ||
pp = <<-EOS | ||
class { 'yum': } | ||
EOS | ||
|
||
# Run it twice and test for idempotency | ||
apply_manifest(pp, catch_failures: true) | ||
apply_manifest(pp, catch_changes: true) | ||
end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
HOSTS: | ||
centos-5-x64: | ||
default_apply_opts: | ||
order: random | ||
strict_variables: | ||
platform: el-5-x86_64 | ||
hypervisor : docker | ||
image: tianon/centos:5.10 | ||
docker_preserve_image: true | ||
docker_cmd: '["/sbin/init"]' | ||
docker_image_commands: | ||
- 'yum install -y crontabs tar wget which' | ||
- 'sed -i -e "/mingetty/d" /etc/inittab' | ||
CONFIG: | ||
type: aio | ||
log_level: debug |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
HOSTS: | ||
centos-6-x64: | ||
platform: el-6-x86_64 | ||
image: centos:centos6 | ||
hypervisor: docker | ||
docker_cmd: '["/sbin/init"]' | ||
docker_image_commands: | ||
- 'yum install -y wget tar ntpdate rubygems ruby-augeas ruby-devel augeas-devel' | ||
- 'touch /etc/sysconfig/network' | ||
docker_preserve_image: true | ||
CONFIG: | ||
log_level: debug | ||
type: aio |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
HOSTS: | ||
centos-7-x64: | ||
platform: el-7-x86_64 | ||
hypervisor: docker | ||
image: centos:7 | ||
docker_preserve_image: true | ||
docker_cmd: '["/usr/sbin/init"]' | ||
docker_image_commands: | ||
- 'yum install -y crontabs tar wget' | ||
CONFIG: | ||
type: aio | ||
log_level: debug |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
require 'spec_helper' | ||
|
||
describe 'yum' do | ||
context 'supported operating systems' do | ||
on_supported_os.each do |os, facts| | ||
context "on #{os}" do | ||
let(:facts) do | ||
facts | ||
end | ||
|
||
context 'yum class without any parameters' do | ||
it { is_expected.to compile.with_all_deps } | ||
|
||
it { is_expected.to contain_class('yum::params') } | ||
end | ||
end | ||
end | ||
end | ||
|
||
context 'unsupported operating system' do | ||
describe 'yum class without any parameters on Solaris/Nexenta' do | ||
let(:facts) do | ||
{ | ||
osfamily: 'Solaris', | ||
operatingsystem: 'Nexenta' | ||
} | ||
end | ||
|
||
it { expect { is_expected.to contain_package('yum') }.to raise_error(Puppet::Error, %r{Nexenta not supported}) } | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
require 'beaker-rspec' | ||
|
||
install_puppet_agent_on hosts, {} unless ENV['BEAKER_provision'] == 'no' | ||
|
||
RSpec.configure do |c| | ||
# Project root | ||
proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) | ||
|
||
# Readable test descriptions | ||
c.formatter = :documentation | ||
|
||
# Configure all nodes in nodeset | ||
c.before :suite do | ||
# Install module and dependencies | ||
puppet_module_install(source: proj_root, module_name: 'yum') | ||
hosts.each do |host| | ||
on host, puppet('module', 'install', 'puppetlabs-stdlib'), acceptable_exit_codes: [0, 1] | ||
end | ||
end | ||
end |