-
-
Notifications
You must be signed in to change notification settings - Fork 882
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/master'
- Loading branch information
Showing
19 changed files
with
285 additions
and
20 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,35 @@ | ||
--- | ||
default_set: 'centos-64-x64' | ||
sets: | ||
'centos-59-x64': | ||
nodes: | ||
"main.foo.vm": | ||
prefab: 'centos-59-x64' | ||
'centos-64-x64': | ||
nodes: | ||
"main.foo.vm": | ||
prefab: 'centos-64-x64' | ||
'fedora-18-x64': | ||
nodes: | ||
"main.foo.vm": | ||
prefab: 'fedora-18-x64' | ||
'debian-607-x64': | ||
nodes: | ||
"main.foo.vm": | ||
prefab: 'debian-607-x64' | ||
'debian-70rc1-x64': | ||
nodes: | ||
"main.foo.vm": | ||
prefab: 'debian-70rc1-x64' | ||
'ubuntu-server-10044-x64': | ||
nodes: | ||
"main.foo.vm": | ||
prefab: 'ubuntu-server-10044-x64' | ||
'ubuntu-server-12042-x64': | ||
nodes: | ||
"main.foo.vm": | ||
prefab: 'ubuntu-server-12042-x64' | ||
'sles-11sp1-x64': | ||
nodes: | ||
"main.foo.vm": | ||
prefab: 'sles-11sp1-x64' |
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
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 |
---|---|---|
|
@@ -62,7 +62,7 @@ | |
} | ||
|
||
package { $redhat_packages: | ||
ensure => present, | ||
ensure => $nginx::package_ensure, | ||
} | ||
|
||
} |
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 |
---|---|---|
|
@@ -24,6 +24,6 @@ | |
] | ||
|
||
package { $suse_packages: | ||
ensure => present, | ||
ensure => $nginx::package_ensure, | ||
} | ||
} |
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 |
---|---|---|
|
@@ -84,4 +84,6 @@ | |
|
||
$nx_http_cfg_append = false | ||
|
||
$package_ensure = 'present' | ||
|
||
} |
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,25 @@ | ||
require 'spec_helper' | ||
|
||
describe 'nginx::resource::vhost' do | ||
|
||
describe 'applies allow and deny rules' do | ||
let (:title) { 'test' } | ||
let (:params) {{ | ||
:www_root => '/var/www/nginx', | ||
:location_allow => ['10.0.0.1', 'host1'], | ||
:location_deny => ['host2', '10.0.0.2'] | ||
}} | ||
|
||
it 'applies location_allow rules' do | ||
should contain_file('/nginx.d/test-500-test-default').with({ | ||
'content' => /allow 10.0.0.1\n allow host1/ | ||
}) | ||
end | ||
it 'applies location_deny rules' do | ||
should contain_file('/nginx.d/test-500-test-default').with({ | ||
'content' => /deny host2\n deny 10.0.0.2/ | ||
}) | ||
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,27 @@ | ||
require 'rspec-system/spec_helper' | ||
require 'rspec-system-puppet/helpers' | ||
require 'rspec-system-serverspec/helpers' | ||
include Serverspec::Helper::RSpecSystem | ||
include Serverspec::Helper::DetectOS | ||
include RSpecSystemPuppet::Helpers | ||
|
||
RSpec.configure do |c| | ||
# Project root | ||
proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) | ||
|
||
# Enable colour | ||
c.tty = true | ||
|
||
c.include RSpecSystemPuppet::Helpers | ||
|
||
# This is where we 'setup' the nodes before running our tests | ||
c.before :suite do | ||
# Install puppet | ||
puppet_install | ||
|
||
# Install modules and dependencies | ||
puppet_module_install(:source => proj_root, :module_name => 'nginx') | ||
shell('puppet module install puppetlabs-apt') | ||
shell('puppet module install puppetlabs-stdlib') | ||
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,13 @@ | ||
require 'spec_helper_system' | ||
|
||
# Here we put the more basic fundamental tests, ultra obvious stuff. | ||
describe "basic tests:" do | ||
context 'make sure we have copied the module across' do | ||
# No point diagnosing any more if the module wasn't copied properly | ||
context shell 'ls /etc/puppet/modules/nginx' do | ||
its(:stdout) { should =~ /Modulefile/ } | ||
its(:stderr) { should be_empty } | ||
its(:exit_code) { should be_zero } | ||
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 'spec_helper_system' | ||
|
||
describe "nginx class:" do | ||
context 'should run successfully' do | ||
pp = "class { 'nginx': }" | ||
|
||
context puppet_apply(pp) do | ||
its(:stderr) { should be_empty } | ||
its(:exit_code) { should_not == 1 } | ||
its(:refresh) { should be_nil } | ||
its(:stderr) { should be_empty } | ||
its(:exit_code) { should be_zero } | ||
end | ||
end | ||
|
||
describe service('nginx') do | ||
it { should be_running } | ||
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,38 @@ | ||
require 'spec_helper_system' | ||
|
||
describe "nginx::resource::mailhost define:" do | ||
context 'should run successfully' do | ||
|
||
pp = " | ||
class { 'nginx': | ||
mail => true, | ||
} | ||
nginx::resource::vhost { 'www.puppetlabs.com': | ||
ensure => present, | ||
www_root => '/var/www/www.puppetlabs.com', | ||
} | ||
nginx::resource::mailhost { 'domain1.example': | ||
ensure => present, | ||
auth_http => 'localhost/cgi-bin/auth', | ||
protocol => 'smtp', | ||
listen_port => 587, | ||
ssl_port => 465, | ||
xclient => 'off', | ||
} | ||
" | ||
|
||
context puppet_apply(pp) do | ||
its(:exit_code) { should_not == 1 } | ||
its(:refresh) { should be_nil } | ||
# Not until deprecated variables fixed. | ||
#its(:stderr) { should be_empty } | ||
its(:exit_code) { should be_zero } | ||
end | ||
end | ||
|
||
describe file('/etc/nginx/conf.mail.d/vhost_autogen.conf') do | ||
it { should be_file } | ||
it { should contain "auth_http localhost/cgi-bin/auth;" } | ||
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,43 @@ | ||
require 'spec_helper_system' | ||
|
||
describe "nginx::resource::upstream define:" do | ||
context 'should run successfully' do | ||
|
||
pp = " | ||
class { 'nginx': } | ||
nginx::resource::upstream { 'puppet_rack_app': | ||
ensure => present, | ||
members => [ | ||
'localhost:3000', | ||
'localhost:3001', | ||
'localhost:3002', | ||
], | ||
} | ||
nginx::resource::vhost { 'rack.puppetlabs.com': | ||
ensure => present, | ||
proxy => 'http://puppet_rack_app', | ||
} | ||
" | ||
|
||
context puppet_apply(pp) do | ||
its(:exit_code) { should_not == 1 } | ||
its(:refresh) { should be_nil } | ||
its(:stderr) { should be_empty } | ||
its(:exit_code) { should be_zero } | ||
end | ||
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" } | ||
end | ||
|
||
describe file('/etc/nginx/conf.d/vhost_autogen.conf') do | ||
it { should be_file } | ||
it { should contain "proxy_pass http://puppet_rack_app;" } | ||
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,27 @@ | ||
require 'spec_helper_system' | ||
|
||
describe "nginx::resource::vhost define:" do | ||
context 'should run successfully' do | ||
|
||
pp = " | ||
class { 'nginx': } | ||
nginx::resource::vhost { 'www.puppetlabs.com': | ||
ensure => present, | ||
www_root => '/var/www/www.puppetlabs.com', | ||
} | ||
" | ||
|
||
context puppet_apply(pp) do | ||
its(:exit_code) { should_not == 1 } | ||
its(:refresh) { should be_nil } | ||
its(:stderr) { should be_empty } | ||
its(:exit_code) { should be_zero } | ||
end | ||
end | ||
|
||
describe file('/etc/nginx/conf.d/vhost_autogen.conf') do | ||
it { should be_file } | ||
it { should contain "www.puppetlabs.com" } | ||
end | ||
|
||
end |
Oops, something went wrong.