Skip to content
This repository was archived by the owner on Mar 28, 2019. It is now read-only.

Commit 5045f01

Browse files
author
Zach Leslie
committed
Merge pull request #101 from danieldreier/thin_beaker_tests
Fix thin support
2 parents e8bec53 + 1830291 commit 5045f01

File tree

8 files changed

+115
-6
lines changed

8 files changed

+115
-6
lines changed

.fixtures.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ fixtures:
1515
inifile: "git://github.com/puppetlabs/puppetlabs-inifile.git"
1616
apache: "git://github.com/puppetlabs/puppetlabs-apache.git"
1717
portage: "git://github.com/gentoo/puppet-portage.git"
18+
thin: "git://github.com/danieldreier/puppet-thin.git"
1819
symlinks:
1920
puppet: "#{source_dir}"
2021

Modulefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ dependency 'puppetlabs/inifile', '>= 1.0.0'
1616
dependency 'puppetlabs/apache', '>= 0.9.0'
1717
dependency 'gentoo/portage', '>= 2.1.0'
1818
dependency 'ploperations/nginx'
19+
dependency 'danieldreier/thin'

manifests/server/thin.pp

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,23 @@
44
include puppet::server::rack
55

66
class { 'puppet::server::standalone': enabled => false }
7+
class { '::thin': }
8+
class { 'nginx::server': }
9+
10+
Ini_setting {
11+
ensure => 'present',
12+
section => 'master',
13+
path => $puppet::params::puppet_conf,
14+
}
15+
16+
ini_setting {
17+
'ssl_client_header':
18+
ensure => 'absent',
19+
setting => 'ssl_client_header';
20+
'ssl_client_verify_header':
21+
ensure => 'absent',
22+
setting => 'ssl_client_verify_header';
23+
}
724

825
$servers = $::processorcount
926
nginx::vhost { 'puppetmaster':
@@ -18,10 +35,13 @@
1835
}
1936

2037
thin::app { 'puppetmaster':
21-
user => 'puppet',
22-
group => 'puppet',
23-
rackup => "${::puppet::params::puppet_confdir}/config.ru",
24-
chdir => $puppet::params::puppet_confdir,
25-
subscribe => Concat["${::puppet::params::puppet_confdir}/config.ru"],
38+
user => 'puppet',
39+
group => 'puppet',
40+
rackup => "${::puppet::params::puppet_confdir}/config.ru",
41+
chdir => $puppet::params::puppet_confdir,
42+
subscribe => Concat["${::puppet::params::puppet_confdir}/config.ru"],
43+
require => Class['::thin'],
44+
socket => '/var/run/thin/puppetmaster.sock',
45+
force_home => '/etc/puppet',
2646
}
2747
}

spec/acceptance/server_spec.rb

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,4 +117,43 @@ class { "puppet::server":
117117
end
118118
end
119119

120+
context 'running on thin' do
121+
after(:all) do
122+
cleanup_server()
123+
end
124+
125+
it 'should run with no errors' do
126+
pp = <<-EOS
127+
class { "puppet::server":
128+
servertype => 'thin',
129+
ca => true,
130+
}
131+
EOS
132+
133+
# Run it twice and test for idempotency
134+
apply_manifest(pp, :catch_failures => true)
135+
expect(apply_manifest(pp, :catch_failures => true).exit_code).to be_zero
136+
end
137+
138+
describe package('thin') do
139+
it {
140+
should be_installed.by('gem')
141+
}
142+
end
143+
144+
describe service('thin-puppetmaster') do
145+
it {
146+
should be_enabled
147+
}
148+
it {
149+
should be_running
150+
}
151+
end
152+
153+
describe port(8140) do
154+
it {
155+
should be_listening
156+
}
157+
end
158+
end
120159
end

spec/classes/server_spec.rb

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,4 +160,45 @@
160160
end
161161
end
162162
end
163+
describe "thin puppet::server" do
164+
let(:params) {{
165+
:servertype => 'thin',
166+
:storeconfigs => 'puppetdb',
167+
:manifest => '/etc/puppet/manifests/site.pp',
168+
:modulepath => ['/etc/puppet/environments/production/modules'],
169+
:ca => true,
170+
}}
171+
context 'Debian' do
172+
let(:facts) {{
173+
:operatingsystem => 'debian',
174+
:operatingsystemrelease => '7',
175+
:osfamily => 'debian',
176+
:puppetversion => '3.4.2',
177+
:concat_basedir => '/foo',
178+
:kernel => 'linux',
179+
:lsbdistid => 'debian',
180+
:lsbdistcodename => 'wheezy',
181+
}}
182+
it_behaves_like "all puppet master types"
183+
it_behaves_like "basic puppetmaster config"
184+
185+
it { should contain_package('puppetmaster') }
186+
187+
# Tests specific to passenger server
188+
it { should contain_class('puppet::server::thin') }
189+
190+
it do
191+
should contain_service('puppetmaster').with({
192+
:ensure => "stopped"
193+
})
194+
should contain_service('nginx').with({
195+
:ensure => "running"
196+
})
197+
should contain_service('thin-puppetmaster').with({
198+
:ensure => "running"
199+
})
200+
should contain_file('/etc/thin.d/puppetmaster.yml')
201+
end
202+
end
203+
end
163204
end

spec/spec_helper_acceptance.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@
5151
mod 'inifile', :git => 'git://github.com/puppetlabs/puppetlabs-inifile.git'
5252
mod 'apache', :git => 'git://github.com/puppetlabs/puppetlabs-apache.git'
5353
mod 'portage', :git => 'git://github.com/gentoo/puppet-portage.git'
54+
mod 'thin', :git => 'git://github.com/danieldreier/puppet-thin.git'
55+
56+
5457
EOS
5558
on host, "echo \"#{puppetfile}\" > /etc/puppet/Puppetfile"
5659
on host, "cd /etc/puppet; r10k puppetfile install"

templates/vhost/nginx/thin.conf.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# nginx configuration for a puppetmaster running on thin
22

33
upstream puppetmaster_upstream {
4-
<% (0...servers.to_i).each do |count| %>
4+
<% (0...@servers.to_i).each do |count| %>
55
server unix:/var/run/thin/puppetmaster.<%= count %>.sock max_fails=0 fail_timeout=0s;
66
<% end -%>
77
}

tests/thin.pp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
class { 'puppet::server':
2+
servertype => 'thin',
3+
ca => true,
4+
}

0 commit comments

Comments
 (0)