rouster 0.57 → 0.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/Gemfile +16 -0
- data/Gemfile.lock +67 -0
- data/README.md +179 -2
- data/Rakefile +8 -7
- data/Vagrantfile +24 -9
- data/examples/aws.rb +85 -0
- data/lib/rouster.rb +128 -61
- data/lib/rouster/deltas.rb +266 -130
- data/lib/rouster/puppet.rb +2 -2
- data/lib/rouster/testing.rb +28 -6
- data/lib/rouster/vagrant.rb +52 -16
- data/path_helper.rb +3 -4
- data/plugins/aws.rb +347 -0
- data/test/functional/deltas/test_get_packages.rb +50 -6
- data/test/functional/test_caching.rb +2 -2
- data/test/functional/test_new.rb +45 -4
- data/test/functional/test_passthroughs.rb +2 -2
- data/test/puppet/test_apply.rb +1 -1
- data/test/unit/test_new.rb +65 -0
- data/test/unit/testing/resources/osx-launchd +285 -0
- data/test/unit/testing/resources/rhel-systemv +40 -0
- data/test/unit/testing/resources/rhel-upstart +20 -0
- data/test/unit/testing/test_get_services.rb +151 -0
- data/test/unit/testing/test_validate_package.rb +36 -10
- metadata +11 -4
- data/test/puppet/test_roles.rb +0 -186
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
acpid (pid 945) is running...
|
|
2
|
+
atd (pid 1010) is running...
|
|
3
|
+
auditd (pid 853) is running...
|
|
4
|
+
Stopped
|
|
5
|
+
cgred is stopped
|
|
6
|
+
crond (pid 999) is running...
|
|
7
|
+
ip6tables: Firewall is not running.
|
|
8
|
+
iptables: Firewall is not running.
|
|
9
|
+
Kdump is not operational
|
|
10
|
+
mdmonitor is stopped
|
|
11
|
+
netconsole module not loaded
|
|
12
|
+
Configured devices:
|
|
13
|
+
lo eth0
|
|
14
|
+
Currently active devices:
|
|
15
|
+
lo eth0
|
|
16
|
+
rpc.svcgssd is stopped
|
|
17
|
+
rpc.mountd is stopped
|
|
18
|
+
nfsd is stopped
|
|
19
|
+
rpc.statd (pid 905) is running...
|
|
20
|
+
ntpd (pid 1587) is running...
|
|
21
|
+
portreserve is stopped
|
|
22
|
+
master is stopped
|
|
23
|
+
puppet is stopped
|
|
24
|
+
rdisc is stopped
|
|
25
|
+
restorecond is stopped
|
|
26
|
+
rhsmcertd (pid 1023) is running...
|
|
27
|
+
rpcbind (pid 887) is running...
|
|
28
|
+
rpc.gssd is stopped
|
|
29
|
+
rpc.idmapd is stopped
|
|
30
|
+
rpc.svcgssd is stopped
|
|
31
|
+
rsyslogd (pid 869) is running...
|
|
32
|
+
sandbox is stopped
|
|
33
|
+
saslauthd is stopped
|
|
34
|
+
sendmail (pid 981) is running...
|
|
35
|
+
sm-client (pid 990) is running...
|
|
36
|
+
snmpd (pid 1569) is running...
|
|
37
|
+
snmptrapd is stopped
|
|
38
|
+
openssh-daemon (pid 965) is running...
|
|
39
|
+
svnserve is stopped
|
|
40
|
+
tgtd is stopped
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
rc stop/waiting
|
|
2
|
+
tty (/dev/tty3) start/running, process 1601
|
|
3
|
+
tty (/dev/tty2) start/running, process 1597
|
|
4
|
+
tty (/dev/tty1) start/running, process 1595
|
|
5
|
+
tty (/dev/tty6) start/running, process 1609
|
|
6
|
+
tty (/dev/tty5) start/running, process 1607
|
|
7
|
+
tty (/dev/tty4) start/running, process 1603
|
|
8
|
+
plymouth-shutdown stop/waiting
|
|
9
|
+
control-alt-delete stop/waiting
|
|
10
|
+
rcS-emergency stop/waiting
|
|
11
|
+
kexec-disable stop/waiting
|
|
12
|
+
quit-plymouth stop/waiting
|
|
13
|
+
rcS stop/waiting
|
|
14
|
+
prefdm stop/waiting
|
|
15
|
+
named start/running, process 8959
|
|
16
|
+
init-system-dbus stop/waiting
|
|
17
|
+
splash-manager stop/waiting
|
|
18
|
+
start-ttys stop/waiting
|
|
19
|
+
rcS-sulogin stop/waiting
|
|
20
|
+
serial stop/waiting
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
require sprintf('%s/../../../path_helper', File.dirname(File.expand_path(__FILE__)))
|
|
2
|
+
|
|
3
|
+
require 'rouster'
|
|
4
|
+
require 'rouster/puppet'
|
|
5
|
+
require 'rouster/testing'
|
|
6
|
+
require 'test/unit'
|
|
7
|
+
|
|
8
|
+
class TestUnitGetPackages < Test::Unit::TestCase
|
|
9
|
+
|
|
10
|
+
def setup
|
|
11
|
+
# expose private methods
|
|
12
|
+
Rouster.send(:public, *Rouster.private_instance_methods)
|
|
13
|
+
Rouster.send(:public, *Rouster.protected_instance_methods)
|
|
14
|
+
|
|
15
|
+
@app = Rouster.new(:name => 'app', :unittest => true, :verbosity => 4)
|
|
16
|
+
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def test_rhel_systemv
|
|
20
|
+
@app.instance_variable_set(:@ostype, :redhat)
|
|
21
|
+
services = {}
|
|
22
|
+
|
|
23
|
+
raw = File.read(sprintf('%s/../../../test/unit/testing/resources/rhel-systemv', File.dirname(File.expand_path(__FILE__))))
|
|
24
|
+
|
|
25
|
+
assert_nothing_raised do
|
|
26
|
+
services = @app.get_services(false, true, :systemv, raw)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
expected = {
|
|
30
|
+
'acpid' => 'running', # acpid (pid 945) is running...
|
|
31
|
+
'ip6tables' => 'stopped', # ip6tables: Firewall is not running.
|
|
32
|
+
'Kdump' => 'stopped', # Kdump is not operational
|
|
33
|
+
'mdmonitor' => 'stopped', # mdmonitor is stopped
|
|
34
|
+
'netconsole' => 'stopped', # netconsole module not loaded
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
expected.each_pair do |service,state|
|
|
38
|
+
assert(services.has_key?(service), "service[#{service}]")
|
|
39
|
+
assert_equal(services[service], state, "service[#{service}] state[#{state}]")
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def test_rhel_upstart
|
|
45
|
+
@app.instance_variable_set(:@ostype, :redhat)
|
|
46
|
+
services = {}
|
|
47
|
+
|
|
48
|
+
raw = File.read(sprintf('%s/../../../test/unit/testing/resources/rhel-upstart', File.dirname(File.expand_path(__FILE__))))
|
|
49
|
+
|
|
50
|
+
assert_nothing_raised do
|
|
51
|
+
services = @app.get_services(false, true, :upstart, raw)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
expected = {
|
|
55
|
+
'rc' => 'stopped', # rc stop/waiting
|
|
56
|
+
'named' => 'running', # named start/running, process 8959
|
|
57
|
+
'tty' => 'running', # tty (/dev/tty3) start/running, process 1601
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
expected.each_pair do |service,state|
|
|
61
|
+
assert(services.has_key?(service), "service[#{service}]")
|
|
62
|
+
assert_equal(services[service], state, "service[#{service}] state[#{state}]")
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def test_rhel_both
|
|
68
|
+
@app.instance_variable_set(:@ostype, :redhat)
|
|
69
|
+
services = {}
|
|
70
|
+
|
|
71
|
+
systemv_contents = File.read(sprintf('%s/../../../test/unit/testing/resources/rhel-systemv', File.dirname(File.expand_path(__FILE__))))
|
|
72
|
+
upstart_contents = File.read(sprintf('%s/../../../test/unit/testing/resources/rhel-upstart', File.dirname(File.expand_path(__FILE__))))
|
|
73
|
+
|
|
74
|
+
# TODO this isn't a great test, because the implementation will never have both outputs in the same control loop
|
|
75
|
+
raw = systemv_contents
|
|
76
|
+
raw << upstart_contents
|
|
77
|
+
|
|
78
|
+
assert_nothing_raised do
|
|
79
|
+
services = @app.get_services(false, true, :all, raw)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
expected = {
|
|
83
|
+
'acpid' => 'running', # initd
|
|
84
|
+
'cgred' => 'stopped', # initd
|
|
85
|
+
'named' => 'running', # upstart
|
|
86
|
+
# 'rc' => 'stopped', # upstart -- this is getting mishandled, see comment on line #74 and test_rhel_both_real for reasons this doesn't matter
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
expected.each_pair do |service,state|
|
|
90
|
+
assert(services.has_key?(service), "service[#{service}]")
|
|
91
|
+
assert_equal(services[service], state, "service[#{service}] state[#{state}]}")
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def test_rhel_both_real
|
|
97
|
+
@app.instance_variable_set(:@ostype, :redhat)
|
|
98
|
+
services = {}
|
|
99
|
+
|
|
100
|
+
systemv_contents = File.read(sprintf('%s/../../../test/unit/testing/resources/rhel-systemv', File.dirname(File.expand_path(__FILE__))))
|
|
101
|
+
upstart_contents = File.read(sprintf('%s/../../../test/unit/testing/resources/rhel-upstart', File.dirname(File.expand_path(__FILE__))))
|
|
102
|
+
|
|
103
|
+
expected = {
|
|
104
|
+
'acpid' => 'running', # initd
|
|
105
|
+
'cgred' => 'stopped', # initd
|
|
106
|
+
'named' => 'running', # upstart
|
|
107
|
+
'rc' => 'stopped', # upstart
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
assert_nothing_raised do
|
|
111
|
+
systemv = @app.get_services(false, true, :systemv, systemv_contents)
|
|
112
|
+
upstart = @app.get_services(false, true, :upstart, upstart_contents)
|
|
113
|
+
|
|
114
|
+
services = systemv.merge(upstart) # TODO how do we ensure merge order doesn't mislead us?
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
expected.each_pair do |service,state|
|
|
118
|
+
assert(services.has_key?(service), "service[#{service}]")
|
|
119
|
+
assert_equal(services[service], state, "service[#{service}] state[#{state}]}")
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
def test_osx_launchd
|
|
126
|
+
@app.instance_variable_set(:@ostype, :osx)
|
|
127
|
+
services = {}
|
|
128
|
+
|
|
129
|
+
raw = File.read(sprintf('%s/../../../test/unit/testing/resources/osx-launchd', File.dirname(File.expand_path(__FILE__))))
|
|
130
|
+
|
|
131
|
+
assert_nothing_raised do
|
|
132
|
+
services = @app.get_services(false, true, :launchd, raw)
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
expected = {
|
|
136
|
+
'com.bigfix.BESAgent' => 'running', # 100 - com.bigfix.BESAgent
|
|
137
|
+
'com.trendmicro.mpm.icore.agent' => 'stopped', # - 0 com.trendmicro.mpm.icore.agent
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
expected.each_pair do |service,state|
|
|
141
|
+
assert(services.has_key?(service), "service[#{service}]")
|
|
142
|
+
assert_equal(services[service], state, "service[#{service}] state[#{state}]")
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
def teardown
|
|
148
|
+
# noop
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
end
|
|
@@ -15,8 +15,26 @@ class TestValidatePackage < Test::Unit::TestCase
|
|
|
15
15
|
fake_facts = { 'is_virtual' => 'true', 'timezone' => 'PDT', 'uptime_days' => 42 }
|
|
16
16
|
|
|
17
17
|
fake_packages = {
|
|
18
|
-
'abrt' =>
|
|
19
|
-
|
|
18
|
+
'abrt' => {
|
|
19
|
+
:version => '2.0.8-15',
|
|
20
|
+
:arch => 'x86_64',
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
'usermode' => {
|
|
24
|
+
:version => '1.102-3',
|
|
25
|
+
:arch => 'noarch',
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
'glibc' => [
|
|
29
|
+
{
|
|
30
|
+
:version => '2.12-1.132',
|
|
31
|
+
:arch => 'x86_64',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
:version => '2.12-1.132',
|
|
35
|
+
:arch => 'i686',
|
|
36
|
+
}
|
|
37
|
+
]
|
|
20
38
|
}
|
|
21
39
|
|
|
22
40
|
@app = Rouster.new(:name => 'app', :unittest => true)
|
|
@@ -29,7 +47,8 @@ class TestValidatePackage < Test::Unit::TestCase
|
|
|
29
47
|
assert(@app.validate_package('abrt', { :ensure => true, :version => '2.0.8-15.el6.centos.x86_64' } ))
|
|
30
48
|
assert(@app.validate_package('abrt', { :ensure => 'present' } ))
|
|
31
49
|
assert(@app.validate_package('abrt', { :exists => true } ))
|
|
32
|
-
assert(@app.validate_package('abrt', { :version => '> 1.0'} ))
|
|
50
|
+
assert(@app.validate_package('abrt', { :version => '> 1.0' } ))
|
|
51
|
+
assert(@app.validate_package('abrt', { :arch => 'x86_64' } ))
|
|
33
52
|
|
|
34
53
|
assert(@app.validate_package('usermode', { :version => '1.102-3' } ))
|
|
35
54
|
assert(@app.validate_package('usermode', { :version => '> 0.5' } )) # specifying 1 here fails because 1.102-3.to_i is 1
|
|
@@ -37,14 +56,23 @@ class TestValidatePackage < Test::Unit::TestCase
|
|
|
37
56
|
assert(@app.validate_package('usermode', { :version => '< 5.0' } ))
|
|
38
57
|
|
|
39
58
|
assert(@app.validate_package('hds', { :exists => false } ))
|
|
40
|
-
assert(@app.validate_package('hds', { :ensure => 'absent'}))
|
|
59
|
+
assert(@app.validate_package('hds', { :ensure => 'absent'} ))
|
|
41
60
|
|
|
42
61
|
end
|
|
43
62
|
|
|
44
63
|
def test_positive_constrained
|
|
45
|
-
|
|
46
64
|
assert(@app.validate_package('abrt', { :ensure => true, :constrain => 'is_virtual true' } ))
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def test_arch_determination
|
|
68
|
+
# determine whether a package is installed with a particular arch, while remaining flexible
|
|
69
|
+
assert(@app.validate_package('glibc', { :ensure => true, :arch => 'x86_64' } ))
|
|
70
|
+
assert(@app.validate_package('glibc', { :ensure => true, :arch => 'i686' } ))
|
|
71
|
+
assert(@app.validate_package('glibc', { :ensure => true, :arch => [ 'i686', 'x86_64' ] } ))
|
|
72
|
+
assert(@app.validate_package('glibc', { :ensure => true } ))
|
|
47
73
|
|
|
74
|
+
assert_equal(false, @app.validate_package('glibc', { :ensure => true, :arch => [ 'noarch' ] } ))
|
|
75
|
+
assert_equal(false, @app.validate_package('glibc', { :ensure => true, :arch => 'review' } ))
|
|
48
76
|
end
|
|
49
77
|
|
|
50
78
|
def test_negative_basic
|
|
@@ -52,14 +80,12 @@ class TestValidatePackage < Test::Unit::TestCase
|
|
|
52
80
|
assert_equal(false, @app.validate_package('abrt', { :version => 'foo.bar'} ))
|
|
53
81
|
assert_equal(false, @app.validate_package('abrt', { :ensure => 'absent' } ))
|
|
54
82
|
assert_equal(false, @app.validate_package('abrt', { :exists => false } ))
|
|
55
|
-
|
|
83
|
+
assert_equal(false, @app.validate_package('abrt', { :arch => 'noarch' } ))
|
|
56
84
|
end
|
|
57
85
|
|
|
58
86
|
def test_negative_constrained
|
|
59
|
-
|
|
60
|
-
assert(@app.validate_package('abrt', { :ensure =>
|
|
61
|
-
assert(@app.validate_package('abrt', { :ensure => true, :constrain => 'is_virtual false' }))
|
|
62
|
-
|
|
87
|
+
assert(@app.validate_package('abrt', { :ensure => false, :constrain => 'is_virtual false' } ))
|
|
88
|
+
assert(@app.validate_package('abrt', { :ensure => true, :constrain => 'is_virtual false' } ))
|
|
63
89
|
end
|
|
64
90
|
|
|
65
91
|
def teardown
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rouster
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: '0.
|
|
4
|
+
version: '0.61'
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Conor Horan-Kates
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2015-01-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: json
|
|
@@ -116,10 +116,13 @@ extensions: []
|
|
|
116
116
|
extra_rdoc_files: []
|
|
117
117
|
files:
|
|
118
118
|
- .gitignore
|
|
119
|
+
- Gemfile
|
|
120
|
+
- Gemfile.lock
|
|
119
121
|
- LICENSE
|
|
120
122
|
- README.md
|
|
121
123
|
- Rakefile
|
|
122
124
|
- Vagrantfile
|
|
125
|
+
- examples/aws.rb
|
|
123
126
|
- examples/bootstrap.rb
|
|
124
127
|
- examples/demo.rb
|
|
125
128
|
- examples/error.rb
|
|
@@ -131,6 +134,7 @@ files:
|
|
|
131
134
|
- lib/rouster/tests.rb
|
|
132
135
|
- lib/rouster/vagrant.rb
|
|
133
136
|
- path_helper.rb
|
|
137
|
+
- plugins/aws.rb
|
|
134
138
|
- rouster.gemspec
|
|
135
139
|
- test/basic.rb
|
|
136
140
|
- test/functional/deltas/test_get_crontab.rb
|
|
@@ -165,13 +169,16 @@ files:
|
|
|
165
169
|
- test/puppet/manifests/manifest.pp
|
|
166
170
|
- test/puppet/modules/role/manifests/ui.pp
|
|
167
171
|
- test/puppet/test_apply.rb
|
|
168
|
-
- test/puppet/test_roles.rb
|
|
169
172
|
- test/tunnel_vs_scp.rb
|
|
170
173
|
- test/unit/puppet/test_get_puppet_star.rb
|
|
171
174
|
- test/unit/test_generate_unique_mac.rb
|
|
172
175
|
- test/unit/test_new.rb
|
|
173
176
|
- test/unit/test_parse_ls_string.rb
|
|
174
177
|
- test/unit/test_traverse_up.rb
|
|
178
|
+
- test/unit/testing/resources/osx-launchd
|
|
179
|
+
- test/unit/testing/resources/rhel-systemv
|
|
180
|
+
- test/unit/testing/resources/rhel-upstart
|
|
181
|
+
- test/unit/testing/test_get_services.rb
|
|
175
182
|
- test/unit/testing/test_meets_constraint.rb
|
|
176
183
|
- test/unit/testing/test_validate_cron.rb
|
|
177
184
|
- test/unit/testing/test_validate_file.rb
|
|
@@ -200,7 +207,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
200
207
|
version: 1.3.6
|
|
201
208
|
requirements: []
|
|
202
209
|
rubyforge_project: Rouster
|
|
203
|
-
rubygems_version: 2.
|
|
210
|
+
rubygems_version: 2.4.2
|
|
204
211
|
signing_key:
|
|
205
212
|
specification_version: 4
|
|
206
213
|
summary: Rouster is an abstraction layer for Vagrant
|
data/test/puppet/test_roles.rb
DELETED
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
require sprintf('%s/../../path_helper', File.dirname(File.expand_path(__FILE__)))
|
|
2
|
-
|
|
3
|
-
require 'rouster'
|
|
4
|
-
require 'rouster/puppet'
|
|
5
|
-
require 'rouster/testing'
|
|
6
|
-
|
|
7
|
-
require 'test/unit'
|
|
8
|
-
|
|
9
|
-
class TestPuppetRoles < Test::Unit::TestCase
|
|
10
|
-
|
|
11
|
-
def setup
|
|
12
|
-
|
|
13
|
-
piab_vagrantfile = sprintf('%s/../../../piab/Vagrantfile', File.dirname(File.expand_path(__FILE__)))
|
|
14
|
-
|
|
15
|
-
unless File.file?(piab_vagrantfile)
|
|
16
|
-
skip(sprintf('missing SFDC specific Vagrantfile[%s], skipping', piab_vagrantfile))
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
assert_nothing_raised do
|
|
20
|
-
@ppm = Rouster.new(:name => 'ppm', :vagrantfile => piab_vagrantfile)
|
|
21
|
-
@ppm.up()
|
|
22
|
-
@ppm.remove_existing_certs('ppm')
|
|
23
|
-
#@ppm.rebuild() unless @ppm.status.eql?('running') # destroy / rebuild
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
assert_nothing_raised do
|
|
27
|
-
@app = Rouster.new(:name => 'app', :vagrantfile => piab_vagrantfile)
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
assert_nothing_raised do
|
|
31
|
-
@ppm.run_puppet('master', { :expected_exitcode => [0,2] })
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
assert_match(/Finished catalog run in/, @ppm.get_output())
|
|
35
|
-
|
|
36
|
-
# define base here
|
|
37
|
-
@expected_packages = {
|
|
38
|
-
'puppet' => { :ensure => true },
|
|
39
|
-
'facter' => { :ensure => 'present' }
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
@expected_files = {
|
|
43
|
-
'/etc/passwd' => {
|
|
44
|
-
:contains => [ 'vagrant', 'root'],
|
|
45
|
-
:ensure => 'file',
|
|
46
|
-
:group => 'root',
|
|
47
|
-
:mode => '0644',
|
|
48
|
-
:owner => 'root'
|
|
49
|
-
},
|
|
50
|
-
|
|
51
|
-
'/tmp' => {
|
|
52
|
-
:ensure => 'directory',
|
|
53
|
-
:group => 'root',
|
|
54
|
-
:owner => 'root',
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
@expected_groups = {
|
|
59
|
-
'root' => { :ensure => 'true' }
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
@expected_services = Hash.new()
|
|
63
|
-
@expected_users = {
|
|
64
|
-
'root' => {
|
|
65
|
-
:ensure => 'present',
|
|
66
|
-
:group => 'root',
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
# manually specified testing
|
|
71
|
-
@expected_files.each_pair do |f,e|
|
|
72
|
-
assert_equal(true, @ppm.validate_file(f,e))
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
@expected_groups.each_pair do |g,e|
|
|
76
|
-
assert_equal(true, @ppm.validate_group(g,e))
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
@expected_packages.each_pair do |p,e|
|
|
80
|
-
assert_equal(true, @ppm.validate_package(p, e))
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
@expected_services.each_pair do |s,e|
|
|
84
|
-
assert_equal(true, @ppm.validate_service(s,e))
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
@expected_users.each_pair do |u,e|
|
|
88
|
-
assert_equal(true, @ppm.validate_user(u,e))
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
end
|
|
92
|
-
|
|
93
|
-
def test_app
|
|
94
|
-
app_expected_packages = {
|
|
95
|
-
'rsync' => { :ensure => 'present' }
|
|
96
|
-
}.merge(@expected_packages)
|
|
97
|
-
|
|
98
|
-
app_expected_files = {
|
|
99
|
-
'/etc/hosts' => {
|
|
100
|
-
:contains => [ 'localhost', 'app' ],
|
|
101
|
-
:ensure => 'present',
|
|
102
|
-
:group => 'root',
|
|
103
|
-
:owner => 'root',
|
|
104
|
-
},
|
|
105
|
-
}.merge(@expected_files)
|
|
106
|
-
|
|
107
|
-
app_expected_groups = {
|
|
108
|
-
'vagrant' => {
|
|
109
|
-
:ensure => 'present',
|
|
110
|
-
}
|
|
111
|
-
}.merge(@expected_groups)
|
|
112
|
-
|
|
113
|
-
app_expected_services = {}.merge(@expected_services)
|
|
114
|
-
|
|
115
|
-
app_expected_users = {
|
|
116
|
-
'vagrant' => {
|
|
117
|
-
:ensure => 'present',
|
|
118
|
-
},
|
|
119
|
-
}.merge(@expected_users)
|
|
120
|
-
|
|
121
|
-
assert_nothing_raised do
|
|
122
|
-
@app.up()
|
|
123
|
-
@app.run_puppet('master', { :expected_exitcode => [0, 2] })
|
|
124
|
-
end
|
|
125
|
-
|
|
126
|
-
assert_match(/Finished catalog run in/, @app.get_output())
|
|
127
|
-
|
|
128
|
-
# manually specified testing
|
|
129
|
-
app_expected_files.each_pair do |f,e|
|
|
130
|
-
assert_equal(true, @app.validate_file(f,e))
|
|
131
|
-
end
|
|
132
|
-
|
|
133
|
-
app_expected_groups.each_pair do |g,e|
|
|
134
|
-
assert_equal(true, @app.validate_group(g,e))
|
|
135
|
-
end
|
|
136
|
-
|
|
137
|
-
app_expected_packages.each_pair do |p,e|
|
|
138
|
-
assert_equal(true, @app.validate_package(p, e))
|
|
139
|
-
end
|
|
140
|
-
|
|
141
|
-
app_expected_services.each_pair do |s,e|
|
|
142
|
-
assert_equal(true, @app.validate_service(s,e))
|
|
143
|
-
end
|
|
144
|
-
|
|
145
|
-
app_expected_users.each_pair do |u,e|
|
|
146
|
-
assert_equal(true, @app.validate_user(u,e))
|
|
147
|
-
end
|
|
148
|
-
|
|
149
|
-
end
|
|
150
|
-
|
|
151
|
-
def dont_test_app_automated
|
|
152
|
-
catalog = @app.get_catalog()
|
|
153
|
-
expectations = @app.parse_catalog(catalog)
|
|
154
|
-
|
|
155
|
-
assert_nothing_raised do
|
|
156
|
-
@app.up()
|
|
157
|
-
@app.run_puppet('master', { :expected_exitcode => 2 })
|
|
158
|
-
end
|
|
159
|
-
|
|
160
|
-
assert_match(/Finished catalog run in/, @app.get_output())
|
|
161
|
-
|
|
162
|
-
expectations.each_pair do |k,v|
|
|
163
|
-
res = nil
|
|
164
|
-
case v[:type]
|
|
165
|
-
when :dir, :file
|
|
166
|
-
res = @app.validate_file(k, v)
|
|
167
|
-
when :group
|
|
168
|
-
res = @app.validate_group(k, v)
|
|
169
|
-
when :package
|
|
170
|
-
res = @app.validate_package(k, v)
|
|
171
|
-
when :user
|
|
172
|
-
res = @app.validate_user(k, v)
|
|
173
|
-
when :service
|
|
174
|
-
res = @app.validate_service(k, v)
|
|
175
|
-
end
|
|
176
|
-
|
|
177
|
-
assert_equal(true, res, sprintf('failed[%s]: %s',v, res))
|
|
178
|
-
end
|
|
179
|
-
|
|
180
|
-
end
|
|
181
|
-
|
|
182
|
-
def teardown
|
|
183
|
-
# noop
|
|
184
|
-
end
|
|
185
|
-
|
|
186
|
-
end
|