Skip to content

Commit

Permalink
Merge pull request voxpupuli#607 from 3flex/beaker
Browse files Browse the repository at this point in the history
Switch acceptance tests to Beaker
  • Loading branch information
3flex committed Apr 21, 2015
2 parents 821f4b2 + 8eb3bf2 commit 23a5efc
Show file tree
Hide file tree
Showing 20 changed files with 210 additions and 205 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
files/server_test.crt
files/server_test.pem
pkg/
pkg/
log/
Gemfile.lock
spec/fixtures/modules
spec/fixtures/manifests
vendor
.ruby-version
.vagrant/
31 changes: 0 additions & 31 deletions .nodeset.yml

This file was deleted.

4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ end
group :rake, :test do
gem 'puppetlabs_spec_helper', '>=0.8.2', :require => false
gem 'puppet-blacksmith', :require => false
gem 'rspec-system-puppet', :require => false
gem 'beaker', :require => false
gem 'beaker-rspec', :require => false
end

group :rake do
gem 'rspec-puppet', '>=2', :require => false
gem 'rake', '>=0.9.2.2'
gem 'puppet-lint', '>=1.0.1'
gem 'rspec-system-serverspec', :require => false
end

if puppetversion = ENV['PUPPET_GEM_VERSION']
Expand Down
1 change: 0 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ CLOBBER.include('.tmp', '.librarian')

require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet_blacksmith/rake_tasks'
require 'rspec-system/rake_task'

task :default => [:clean, :spec]

Expand Down
24 changes: 24 additions & 0 deletions spec/acceptance/class_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
require 'spec_helper_acceptance'

describe "nginx class:" do

context 'default parameters' do
it 'should run successfully' do
pp = "class { 'nginx': }"

# Run it twice and test for idempotency
apply_manifest(pp, :catch_failures => true)
expect(apply_manifest(pp, :catch_failures => true).exit_code).to be_zero
end
end

describe package('nginx') do
it { is_expected.to be_installed }
end

describe service('nginx') do
it { is_expected.to be_running }
it { is_expected.to be_enabled }
end

end
39 changes: 39 additions & 0 deletions spec/acceptance/nginx_mail_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
require 'spec_helper_acceptance'

describe "nginx::resource::mailhost define:" do
it 'should run successfully' do

pp = "
class { 'nginx':
mail => true,
}
nginx::resource::mailhost { 'domain1.example':
ensure => present,
auth_http => 'localhost/cgi-bin/auth',
protocol => 'smtp',
listen_port => 587,
ssl => true,
ssl_port => 465,
ssl_cert => '/tmp/blah.cert',
ssl_key => '/tmp/blah.key',
xclient => 'off',
}
"

apply_manifest(pp, :catch_failures => true)
end

describe file('/etc/nginx/conf.mail.d/domain1.example.conf') do
it { is_expected.to be_file }
it { is_expected.to contain "auth_http localhost/cgi-bin/auth;" }
end

describe port(587) do
it { is_expected.to be_listening }
end

describe port(465) do
it { is_expected.to be_listening }
end

end
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'spec_helper_system'
require 'spec_helper_acceptance'

describe "nginx::resource::upstream define:" do
it 'should run successfully' do
Expand All @@ -19,25 +19,20 @@ class { 'nginx': }
}
"

puppet_apply(pp) do |r|
[0,2].should include r.exit_code
r.refresh
r.stderr.should be_empty
r.exit_code.should be_zero
end
apply_manifest(pp, :catch_failures => true)
end

describe file('/etc/nginx/conf.d/puppet_rack_app-upstream.conf') do
it { should be_file }
it { should contain "server localhost:3000" }
it { should contain "server localhost:3001" }
it { should contain "server localhost:3002" }
it { should_not contain "server localhost:3003" }
it { is_expected.to be_file }
it { is_expected.to contain "server localhost:3000" }
it { is_expected.to contain "server localhost:3001" }
it { is_expected.to contain "server localhost:3002" }
it { is_expected.not_to contain "server localhost:3003" }
end

describe file('/etc/nginx/sites-available/rack.puppetlabs.com.conf') do
it { should be_file }
it { should contain "proxy_pass http://puppet_rack_app;" }
it { is_expected.to be_file }
it { is_expected.to contain "proxy_pass http://puppet_rack_app;" }
end

end
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'spec_helper_system'
require 'spec_helper_acceptance'

describe "nginx::resource::vhost define:" do
context 'new vhost on port 80' do
Expand All @@ -15,31 +15,30 @@ class { 'nginx': }
file { '/var/www/www.puppetlabs.com/index.html': ensure => file, content => 'Hello from www\n', }
"

puppet_apply(pp) do |r|
[0,2].should include r.exit_code
r.refresh
r.stderr.should be_empty
r.exit_code.should be_zero
end
apply_manifest(pp, :catch_failures => true)
end

describe file('/etc/nginx/sites-available/www.puppetlabs.com.conf') do
it { should be_file }
it { should contain "www.puppetlabs.com" }
it { is_expected.to be_file }
it { is_expected.to contain "www.puppetlabs.com" }
end

describe file('/etc/nginx/sites-enabled/www.puppetlabs.com.conf') do
it { should be_linked_to '/etc/nginx/sites-available/www.puppetlabs.com.conf' }
it { is_expected.to be_linked_to '/etc/nginx/sites-available/www.puppetlabs.com.conf' }
end

describe service('nginx') do
it { should be_running }
it { is_expected.to be_running }
end

describe port(80) do
it { is_expected.to be_listening }
end

it 'should answer to www.puppetlabs.com' do
shell("/usr/bin/curl http://www.puppetlabs.com:80") do |r|
r.stdout.should == "Hello from www\n"
r.exit_code.should be_zero
expect(r.stdout).to eq("Hello from www\n")
expect(r.exit_code).to be_zero
end
end
end
Expand All @@ -61,39 +60,38 @@ class { 'nginx': }
file { '/var/www/www.puppetlabs.com/index.html': ensure => file, content => 'Hello from www\n', }
"

puppet_apply(pp) do |r|
[0,2].should include r.exit_code
r.refresh
r.stderr.should be_empty
r.exit_code.should be_zero
end
apply_manifest(pp, :catch_failures => true)
end

describe file('/etc/nginx/sites-available/www.puppetlabs.com.conf') do
it { should be_file }
it { should contain "ssl on;" }
it { is_expected.to be_file }
it { is_expected.to contain "ssl on;" }
end

describe file('/etc/nginx/sites-enabled/www.puppetlabs.com.conf') do
it { should be_linked_to '/etc/nginx/sites-available/www.puppetlabs.com.conf' }
it { is_expected.to be_linked_to '/etc/nginx/sites-available/www.puppetlabs.com.conf' }
end

describe service('nginx') do
it { should be_running }
it { is_expected.to be_running }
end

describe port(443) do
it { is_expected.to be_listening }
end

it 'should answer to http://www.puppetlabs.com' do
shell("/usr/bin/curl http://www.puppetlabs.com:80") do |r|
r.stdout.should == "Hello from www\n"
r.exit_code.should == 0
expect(r.stdout).to eq("Hello from www\n")
expect(r.exit_code).to eq(0)
end
end

it 'should answer to https://www.puppetlabs.com' do
# use --insecure because it's a self-signed cert
shell("/usr/bin/curl --insecure https://www.puppetlabs.com:443") do |r|
r.stdout.should == "Hello from www\n"
r.exit_code.should == 0
expect(r.stdout).to eq("Hello from www\n")
expect(r.exit_code).to eq(0)
end
end
end
Expand Down
11 changes: 11 additions & 0 deletions spec/acceptance/nodesets/centos-5-x64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
HOSTS:
centos-5-x64:
roles:
- master
platform: el-5-x86_64
box : puppetlabs/centos-5.11-64-nocm
box_url : https://vagrantcloud.com/puppetlabs/boxes/centos-5.11-64-nocm
hypervisor : vagrant
CONFIG:
log_level: verbose
type: foss
11 changes: 11 additions & 0 deletions spec/acceptance/nodesets/centos-6-x64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
HOSTS:
centos-6-x64:
roles:
- master
platform: el-6-x86_64
box : puppetlabs/centos-6.6-64-nocm
box_url : https://vagrantcloud.com/puppetlabs/boxes/centos-6.6-64-nocm
hypervisor : vagrant
CONFIG:
log_level: verbose
type: foss
11 changes: 11 additions & 0 deletions spec/acceptance/nodesets/centos-7-x64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
HOSTS:
centos-7-x64:
roles:
- master
platform: el-7-x86_64
box : puppetlabs/centos-7.0-64-nocm
box_url : https://vagrantcloud.com/puppetlabs/boxes/centos-7.0-64-nocm
hypervisor : vagrant
CONFIG:
log_level: verbose
type: foss
11 changes: 11 additions & 0 deletions spec/acceptance/nodesets/debian-6-x64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
HOSTS:
debian-6-x64:
roles:
- master
platform: debian-6-amd64
box : puppetlabs/debian-6.0.10-64-nocm
box_url : http://vagrantcloud.com/puppetlabs/debian-6.0.10-64-nocm
hypervisor : vagrant
CONFIG:
log_level: debug
type: git
11 changes: 11 additions & 0 deletions spec/acceptance/nodesets/debian-7-x64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
HOSTS:
debian-7-x64:
roles:
- master
platform: debian-7-amd64
box : puppetlabs/debian-7.8-64-nocm
box_url : http://vagrantcloud.com/puppetlabs/debian-7.8-64-nocm
hypervisor : vagrant
CONFIG:
log_level: debug
type: git
11 changes: 11 additions & 0 deletions spec/acceptance/nodesets/default.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
HOSTS:
ubuntu-server-1404-x64:
roles:
- master
platform: ubuntu-14.04-amd64
box: puppetlabs/ubuntu-14.04-64-nocm
box_url: https://vagrantcloud.com/puppetlabs/ubuntu-14.04-64-nocm
hypervisor: vagrant
CONFIG:
log_level: debug
type: git
11 changes: 11 additions & 0 deletions spec/acceptance/nodesets/ubuntu-server-1204-x64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
HOSTS:
ubuntu-server-1204-x64:
roles:
- master
platform: ubuntu-12.04-amd64
box: puppetlabs/ubuntu-12.04-64-nocm
box_url: https://vagrantcloud.com/puppetlabs/ubuntu-12.04-64-nocm
hypervisor: vagrant
CONFIG:
log_level: debug
type: git
11 changes: 11 additions & 0 deletions spec/acceptance/nodesets/ubuntu-server-1404-x64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
HOSTS:
ubuntu-server-1404-x64:
roles:
- master
platform: ubuntu-14.04-amd64
box: puppetlabs/ubuntu-14.04-64-nocm
box_url: https://vagrantcloud.com/puppetlabs/ubuntu-14.04-64-nocm
hypervisor: vagrant
CONFIG:
log_level: debug
type: git
Loading

0 comments on commit 23a5efc

Please sign in to comment.