forked from cegeka/puppet-cegeka_apache
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Working beaker serverspec & rspec tests
- Loading branch information
1 parent
f8e7e60
commit 4e3be15
Showing
13 changed files
with
212 additions
and
21 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 |
---|---|---|
@@ -1,3 +1,10 @@ | ||
fixtures: | ||
symlinks: | ||
"apache": "#{source_dir}" | ||
apache: "#{source_dir}" | ||
repositories: | ||
concat: | ||
repo: 'https://github.com/cegeka/puppet-concat.git' | ||
stdlib: | ||
repo: 'https://github.com/cegeka/puppet-stdlib.git' | ||
collectd: | ||
repo: 'https://github.com/cegeka/puppet-collectd.git' |
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 |
---|---|---|
@@ -1 +1,5 @@ | ||
/.project | ||
log | ||
Gemfile.lock | ||
.DS_Store | ||
spec/fixtures/ |
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,10 @@ | ||
source 'https://rubygems.org' | ||
|
||
gem 'fpm', '0.3.11' | ||
gem 'puppet', '3.8.1' | ||
gem 'puppet-lint', '1.1.0' | ||
gem 'rspec-puppet', '2.2.0' | ||
gem 'rake', '0.9.2.2' | ||
gem 'ci_reporter', '1.8.4' | ||
gem 'puppetlabs_spec_helper' | ||
gem 'beaker-rspec' |
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 |
---|---|---|
@@ -1,11 +1 @@ | ||
require 'rubygems' | ||
require 'rake' | ||
|
||
task_dir = File.expand_path("../tasks", __FILE__) | ||
|
||
FileList["#{task_dir}/**/*.rake"].each { |fn| load fn } | ||
|
||
desc "Default task prints the available targets." | ||
task :default do | ||
sh %{rake -T} | ||
end | ||
require 'puppetlabs_spec_helper/rake_tasks' |
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,29 @@ | ||
require 'spec_helper_acceptance' | ||
|
||
describe 'apache::vhost_access_restriction' do | ||
|
||
describe 'running puppet code' do | ||
it 'should work with no errors' do | ||
pp = <<-EOS | ||
include apache | ||
apache::vhost { 'www.example.com': | ||
ensure => present, | ||
} | ||
apache::vhost_access_restriction { 'www.example.com': | ||
vhost => 'www.example.com', | ||
folder => '/var/www/vhosts/www.example.com/htdocs', | ||
allow_from => '127.0.0.1', | ||
} | ||
EOS | ||
|
||
# Run it twice and test for idempotency | ||
apply_manifest(pp, :catch_failures => true) | ||
apply_manifest(pp, :catch_changes => true) | ||
end | ||
|
||
describe file '/var/www/vhosts/www.example.com/conf/00-vhost_access_restriction-www.example.com.conf' do | ||
it { is_expected.to be_file } | ||
its(:content) { should match /Allow from/ } | ||
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,32 @@ | ||
require 'spec_helper_acceptance' | ||
|
||
describe 'apache::proxypass' do | ||
|
||
describe 'running puppet code' do | ||
it 'should work with no errors' do | ||
pp = <<-EOS | ||
include apache | ||
apache::vhost { 'www.example.com': | ||
ensure => present, | ||
} | ||
apache::proxypass { "proxy legacy dir to legacy server": | ||
ensure => present, | ||
location => "/legacy/", | ||
url => "http://legacyserver.example.com", | ||
params => ["retry=5", "ttl=120"], | ||
vhost => "www.example.com", | ||
proxy_config => ['ProxyPreserveHost On'] | ||
} | ||
EOS | ||
|
||
# Run it twice and test for idempotency | ||
apply_manifest(pp, :catch_failures => true) | ||
apply_manifest(pp, :catch_changes => true) | ||
end | ||
|
||
describe file '/var/www/vhosts/www.example.com/conf/proxypass-proxy_legacy_dir_to_legacy_server.conf' do | ||
it { is_expected.to be_file } | ||
its(:content) { should match /ProxyPass/ } | ||
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,29 @@ | ||
require 'spec_helper_acceptance' | ||
|
||
describe 'apache::redirectmatch' do | ||
|
||
describe 'running puppet code' do | ||
it 'should work with no errors' do | ||
pp = <<-EOS | ||
include apache | ||
apache::vhost { 'www.example.com': | ||
ensure => present, | ||
} | ||
apache::redirectmatch { "example": | ||
regex => "^/(foo|bar)", | ||
url => "http://foobar.example.com/", | ||
vhost => "www.example.com", | ||
} | ||
EOS | ||
|
||
# Run it twice and test for idempotency | ||
apply_manifest(pp, :catch_failures => true) | ||
apply_manifest(pp, :catch_changes => true) | ||
end | ||
|
||
describe file '/var/www/vhosts/www.example.com/conf/redirect-example.conf' do | ||
it { is_expected.to be_file } | ||
its(:content) { should match /RedirectMatch/ } | ||
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,26 @@ | ||
require 'spec_helper_acceptance' | ||
|
||
describe 'apache' do | ||
|
||
describe 'running puppet code' do | ||
it 'should work with no errors' do | ||
pp = <<-EOS | ||
include apache | ||
EOS | ||
|
||
# Run it twice and test for idempotency | ||
apply_manifest(pp, :catch_failures => true) | ||
apply_manifest(pp, :catch_changes => true) | ||
end | ||
|
||
|
||
describe port(80) do | ||
it { is_expected.to be_listening } | ||
end | ||
|
||
describe service('httpd') do | ||
it { is_expected.to be_enabled } | ||
it { is_expected.to be_running } | ||
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,24 @@ | ||
require 'spec_helper_acceptance' | ||
|
||
describe 'apache::vhost' do | ||
|
||
describe 'running puppet code' do | ||
it 'should work with no errors' do | ||
pp = <<-EOS | ||
include apache | ||
apache::vhost { 'www.example.com': | ||
ensure => present, | ||
} | ||
EOS | ||
|
||
# Run it twice and test for idempotency | ||
apply_manifest(pp, :catch_failures => true) | ||
apply_manifest(pp, :catch_changes => true) | ||
end | ||
|
||
describe file '/etc/httpd/sites-enabled/www.example.com' do | ||
it { is_expected.to be_file } | ||
its(:content) { should match /ServerName www.example.com/ } | ||
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,15 @@ | ||
HOSTS: | ||
centos-66-x64: | ||
roles: | ||
- master | ||
platform: el-6-x86_64 | ||
box : puppetlabs/centos-6.6-64-nocm | ||
box_url : https://atlas.hashicorp.com/puppetlabs/centos-6.6-64-nocm | ||
hypervisor: vagrant | ||
centos-70-x64: | ||
platform: el-7-x86_64 | ||
box : puppetlabs/centos-7.0-64-nocm | ||
box_url : https://atlas.hashicorp.com/puppetlabs/centos-7.0-64-nocm | ||
hypervisor: vagrant | ||
CONFIG: | ||
type: foss |
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,33 @@ | ||
require 'rake' | ||
require 'puppetlabs_spec_helper/rake_tasks' | ||
require 'beaker-rspec' | ||
|
||
Rake::Task[:spec_prep].invoke | ||
|
||
hosts.each do |host| | ||
# Install Puppet | ||
on host, install_puppet | ||
end | ||
|
||
RSpec.configure do |c| | ||
module_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) | ||
module_name = module_root.split('/').last | ||
dependencies_path = module_root + '/spec/fixtures/modules' | ||
|
||
# Readable test descriptions | ||
c.formatter = :documentation | ||
|
||
# Configure all nodes in nodeset | ||
c.before :suite do | ||
# Install module | ||
puppet_module_install(:source => module_root, :module_name => module_name) | ||
|
||
# Install dependencies | ||
Dir.foreach(dependencies_path) do |dependency| | ||
next if dependency == '.' or dependency == '..' | ||
dependency_source = dependencies_path+'/'+dependency | ||
puppet_module_install(:source => dependency_source, :module_name => dependency) | ||
end | ||
|
||
end | ||
end |
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