serverspec 0.6.21 → 0.6.22

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.
Files changed (37) hide show
  1. data/Rakefile +1 -1
  2. data/lib/serverspec.rb +2 -0
  3. data/lib/serverspec/backend/exec.rb +2 -0
  4. data/lib/serverspec/commands/base.rb +5 -0
  5. data/lib/serverspec/commands/smartos.rb +8 -0
  6. data/lib/serverspec/commands/solaris.rb +7 -2
  7. data/lib/serverspec/commands/solaris11.rb +7 -0
  8. data/lib/serverspec/helper.rb +1 -0
  9. data/lib/serverspec/helper/solaris11.rb +9 -0
  10. data/lib/serverspec/matchers.rb +3 -0
  11. data/lib/serverspec/matchers/be_listening.rb +9 -0
  12. data/lib/serverspec/type/port.rb +11 -2
  13. data/lib/serverspec/version.rb +1 -1
  14. data/spec/darwin/port_spec.rb +18 -0
  15. data/spec/debian/port_spec.rb +18 -0
  16. data/spec/gentoo/port_spec.rb +18 -0
  17. data/spec/redhat/port_spec.rb +18 -0
  18. data/spec/solaris/commands_spec.rb +17 -2
  19. data/spec/solaris/port_spec.rb +18 -0
  20. data/spec/solaris10/commands_spec.rb +2 -2
  21. data/spec/solaris11/command_spec.rb +48 -0
  22. data/spec/solaris11/commands_spec.rb +82 -0
  23. data/spec/solaris11/cron_spec.rb +21 -0
  24. data/spec/solaris11/default_gateway_spec.rb +16 -0
  25. data/spec/solaris11/file_spec.rb +381 -0
  26. data/spec/solaris11/group_spec.rb +8 -0
  27. data/spec/solaris11/host_spec.rb +58 -0
  28. data/spec/solaris11/ipfilter_spec.rb +7 -0
  29. data/spec/solaris11/ipnat_spec.rb +7 -0
  30. data/spec/solaris11/package_spec.rb +76 -0
  31. data/spec/solaris11/port_spec.rb +12 -0
  32. data/spec/solaris11/routing_table_spec.rb +120 -0
  33. data/spec/solaris11/service_spec.rb +13 -0
  34. data/spec/solaris11/svcprop_spec.rb +8 -0
  35. data/spec/solaris11/user_spec.rb +12 -0
  36. data/spec/solaris11/zfs_spec.rb +9 -0
  37. metadata +37 -2
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+
3
+ include Serverspec::Helper::Solaris11
4
+
5
+ describe ipfilter do
6
+ it { should have_rule 'pass in quick on lo0 all' }
7
+ end
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+
3
+ include Serverspec::Helper::Solaris11
4
+
5
+ describe ipnat do
6
+ it { should have_rule 'map net1 192.168.0.0/24 -> 0.0.0.0/32' }
7
+ end
@@ -0,0 +1,76 @@
1
+ require 'spec_helper'
2
+
3
+ include Serverspec::Helper::Solaris11
4
+
5
+ describe package('httpd') do
6
+ it { should be_installed }
7
+ its(:command) { should eq "pkg list -H httpd 2> /dev/null" }
8
+ end
9
+
10
+ describe package('invalid-package') do
11
+ it { should_not be_installed }
12
+ end
13
+
14
+ describe package('httpd') do
15
+ it { should be_installed.with_version('2.2') }
16
+ its(:command) { should eq "pkg list -H httpd 2> /dev/null | grep -qw -- 2.2" }
17
+ end
18
+
19
+ describe package('httpd') do
20
+ it { should_not be_installed.with_version('invalid-version') }
21
+ end
22
+
23
+ describe package('jekyll') do
24
+ it { should be_installed.by('gem') }
25
+ its(:command) { should eq "gem list --local | grep -w -- ^jekyll" }
26
+ end
27
+
28
+ describe package('invalid-gem') do
29
+ it { should_not be_installed.by('gem') }
30
+ end
31
+
32
+ describe package('jekyll') do
33
+ it { should be_installed.by('gem').with_version('1.1.1') }
34
+ its(:command) { should eq "gem list --local | grep -w -- ^jekyll | grep -w -- 1.1.1" }
35
+ end
36
+
37
+ describe package('jekyll') do
38
+ it { should_not be_installed.by('gem').with_version('invalid-version') }
39
+ end
40
+
41
+ describe package('bower') do
42
+ it { should be_installed.by('npm') }
43
+ its(:command) { should eq "npm ls bower -g" }
44
+ end
45
+
46
+ describe package('invalid-npm-package') do
47
+ it { should_not be_installed.by('npm') }
48
+ end
49
+
50
+ describe package('bower') do
51
+ it { should be_installed.by('npm').with_version('0.9.2') }
52
+ its(:command) { should eq "npm ls bower -g | grep -w -- 0.9.2" }
53
+ end
54
+
55
+ describe package('bower') do
56
+ it { should_not be_installed.by('npm').with_version('invalid-version') }
57
+ end
58
+
59
+
60
+ describe package('mongo') do
61
+ it { should be_installed.by('pecl') }
62
+ its(:command) { should eq "pecl list | grep -w -- ^mongo" }
63
+ end
64
+
65
+ describe package('invalid-pecl') do
66
+ it { should_not be_installed.by('pecl') }
67
+ end
68
+
69
+ describe package('mongo') do
70
+ it { should be_installed.by('pecl').with_version('1.4.1') }
71
+ its(:command) { should eq "pecl list | grep -w -- ^mongo | grep -w -- 1.4.1" }
72
+ end
73
+
74
+ describe package('mongo') do
75
+ it { should_not be_installed.by('pecl').with_version('invalid-version') }
76
+ end
@@ -0,0 +1,12 @@
1
+ require 'spec_helper'
2
+
3
+ include Serverspec::Helper::Solaris11
4
+
5
+ describe port(80) do
6
+ it { should be_listening }
7
+ its(:command) { should eq %q!netstat -an 2> /dev/null | egrep 'LISTEN|Idle' | grep -- .80\\ ! }
8
+ end
9
+
10
+ describe port('invalid') do
11
+ it { should_not be_listening }
12
+ end
@@ -0,0 +1,120 @@
1
+ require 'spec_helper'
2
+
3
+ include Serverspec::Helper::Solaris11
4
+
5
+ describe routing_table do
6
+ let(:stdout) { "192.168.100.0/24 dev eth1 proto kernel scope link src 192.168.100.10 \r\ndefault via 192.168.100.1 dev eth0 \r\n" }
7
+ it { should have_entry( :destination => '192.168.100.0/24' ) }
8
+ its(:command) { should eq "ip route | grep -E '^192.168.100.0/24 |^default '" }
9
+ end
10
+
11
+ describe routing_table do
12
+ let(:stdout) { "192.168.100.0/24 dev eth1 proto kernel scope link src 192.168.100.10 \r\ndefault via 192.168.100.1 dev eth0 \r\n" }
13
+ it { should_not have_entry( :destination => '192.168.100.100/24' ) }
14
+ its(:command) { should eq "ip route | grep -E '^192.168.100.100/24 |^default '" }
15
+ end
16
+
17
+ describe routing_table do
18
+ let(:stdout) { "192.168.100.0/24 dev eth1 proto kernel scope link src 192.168.100.10 \r\ndefault via 192.168.100.1 dev eth0 \r\n" }
19
+ it do
20
+ should have_entry(
21
+ :destination => '192.168.100.0/24',
22
+ :gateway => '192.168.100.1'
23
+ )
24
+ end
25
+
26
+ it do
27
+ should have_entry(
28
+ :destination => '192.168.100.0/24',
29
+ :gateway => '192.168.100.1',
30
+ :interface => 'eth1'
31
+ )
32
+ end
33
+
34
+ it do
35
+ should_not have_entry(
36
+ :gateway => '192.168.100.1',
37
+ :interface => 'eth1'
38
+ )
39
+ end
40
+
41
+ it do
42
+ should_not have_entry(
43
+ :destination => '192.168.100.0/32',
44
+ :gateway => '192.168.100.1',
45
+ :interface => 'eth1'
46
+ )
47
+ end
48
+ end
49
+
50
+ describe routing_table do
51
+ let(:stdout) { "192.168.200.0/24 via 192.168.200.1 dev eth0 \r\ndefault via 192.168.100.1 dev eth0 \r\n" }
52
+ it { should have_entry( :destination => '192.168.200.0/24' ) }
53
+ it { should_not have_entry( :destination => '192.168.200.200/24' ) }
54
+
55
+ it do
56
+ should have_entry(
57
+ :destination => '192.168.200.0/24',
58
+ :gateway => '192.168.200.1'
59
+ )
60
+ end
61
+
62
+ it do
63
+ should have_entry(
64
+ :destination => '192.168.200.0/24',
65
+ :gateway => '192.168.200.1',
66
+ :interface => 'eth0'
67
+ )
68
+ end
69
+
70
+ it do
71
+ should_not have_entry(
72
+ :gateway => '192.168.200.1',
73
+ :interface => 'eth0'
74
+ )
75
+ end
76
+
77
+ it do
78
+ should_not have_entry(
79
+ :destination => '192.168.200.0/32',
80
+ :gateway => '192.168.200.1',
81
+ :interface => 'eth0'
82
+ )
83
+ end
84
+ end
85
+
86
+ describe routing_table do
87
+ let(:stdout) { "default via 10.0.2.2 dev eth0 \r\n" }
88
+ it { should have_entry( :destination => 'default' ) }
89
+ it { should_not have_entry( :destination => 'defaulth' ) }
90
+
91
+ it do
92
+ should have_entry(
93
+ :destination => 'default',
94
+ :gateway => '10.0.2.2'
95
+ )
96
+ end
97
+
98
+ it do
99
+ should have_entry(
100
+ :destination => 'default',
101
+ :gateway => '10.0.2.2',
102
+ :interface => 'eth0'
103
+ )
104
+ end
105
+
106
+ it do
107
+ should_not have_entry(
108
+ :gateway => '10.0.2.2',
109
+ :interface => 'eth0'
110
+ )
111
+ end
112
+
113
+ it do
114
+ should_not have_entry(
115
+ :destination => 'default',
116
+ :gateway => '10.0.2.1',
117
+ :interface => 'eth0'
118
+ )
119
+ end
120
+ end
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ include Serverspec::Helper::Solaris11
4
+
5
+ describe 'Serverspec service matchers of Solaris11' do
6
+ it_behaves_like 'support service enabled matcher', 'sshd'
7
+ it_behaves_like 'support service enabled with level matcher', 'sshd', 3
8
+ it_behaves_like 'support service running matcher', 'sshd'
9
+ it_behaves_like 'support service running under supervisor matcher', 'sshd'
10
+ it_behaves_like 'support service running under unimplemented matcher', 'sshd'
11
+ it_behaves_like 'support service monitored by monit matcher', 'unicorn'
12
+ it_behaves_like 'support service monitored by unimplemented matcher', 'unicorn'
13
+ end
@@ -0,0 +1,8 @@
1
+ require 'spec_helper'
2
+
3
+ include Serverspec::Helper::Solaris11
4
+
5
+ describe service('svc:/network/http:apache22') do
6
+ it { should have_property 'httpd/enable_64bit' => false }
7
+ it { should have_property 'httpd/enable_64bit' => false, 'httpd/server_type' => 'worker' }
8
+ end
@@ -0,0 +1,12 @@
1
+ require 'spec_helper'
2
+
3
+ include Serverspec::Helper::Solaris11
4
+
5
+ describe 'Serverspec user matchers of Solaris11 family' do
6
+ it_behaves_like 'support user exist matcher', 'root'
7
+ it_behaves_like 'support user belong_to_group matcher', 'root', 'root'
8
+ it_behaves_like 'support user have_uid matcher', 'root', 0
9
+ it_behaves_like 'support user have_login_shell matcher', 'root', '/bin/bash'
10
+ it_behaves_like 'support user have_home_directory matcher', 'root', '/root'
11
+ it_behaves_like 'support user have_authorized_key matcher', 'root', 'ssh-rsa ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGH foo@bar.local'
12
+ end
@@ -0,0 +1,9 @@
1
+ require 'spec_helper'
2
+
3
+ include Serverspec::Helper::Solaris11
4
+
5
+ describe zfs('rpool') do
6
+ it { should exist }
7
+ it { should have_property 'mountpoint' => '/rpool' }
8
+ it { should have_property 'mountpoint' => '/rpool', 'compression' => 'off' }
9
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: serverspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.21
4
+ version: 0.6.22
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-04 00:00:00.000000000 Z
12
+ date: 2013-07-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: net-ssh
@@ -153,6 +153,7 @@ files:
153
153
  - lib/serverspec/commands/smartos.rb
154
154
  - lib/serverspec/commands/solaris.rb
155
155
  - lib/serverspec/commands/solaris10.rb
156
+ - lib/serverspec/commands/solaris11.rb
156
157
  - lib/serverspec/configuration.rb
157
158
  - lib/serverspec/helper.rb
158
159
  - lib/serverspec/helper/attributes.rb
@@ -168,12 +169,14 @@ files:
168
169
  - lib/serverspec/helper/smartos.rb
169
170
  - lib/serverspec/helper/solaris.rb
170
171
  - lib/serverspec/helper/solaris10.rb
172
+ - lib/serverspec/helper/solaris11.rb
171
173
  - lib/serverspec/helper/ssh.rb
172
174
  - lib/serverspec/helper/type.rb
173
175
  - lib/serverspec/matchers.rb
174
176
  - lib/serverspec/matchers/be_enabled.rb
175
177
  - lib/serverspec/matchers/be_executable.rb
176
178
  - lib/serverspec/matchers/be_installed.rb
179
+ - lib/serverspec/matchers/be_listening.rb
177
180
  - lib/serverspec/matchers/be_mounted.rb
178
181
  - lib/serverspec/matchers/be_reachable.rb
179
182
  - lib/serverspec/matchers/be_readable.rb
@@ -298,6 +301,22 @@ files:
298
301
  - spec/solaris/user_spec.rb
299
302
  - spec/solaris/zfs_spec.rb
300
303
  - spec/solaris10/commands_spec.rb
304
+ - spec/solaris11/command_spec.rb
305
+ - spec/solaris11/commands_spec.rb
306
+ - spec/solaris11/cron_spec.rb
307
+ - spec/solaris11/default_gateway_spec.rb
308
+ - spec/solaris11/file_spec.rb
309
+ - spec/solaris11/group_spec.rb
310
+ - spec/solaris11/host_spec.rb
311
+ - spec/solaris11/ipfilter_spec.rb
312
+ - spec/solaris11/ipnat_spec.rb
313
+ - spec/solaris11/package_spec.rb
314
+ - spec/solaris11/port_spec.rb
315
+ - spec/solaris11/routing_table_spec.rb
316
+ - spec/solaris11/service_spec.rb
317
+ - spec/solaris11/svcprop_spec.rb
318
+ - spec/solaris11/user_spec.rb
319
+ - spec/solaris11/zfs_spec.rb
301
320
  - spec/spec_helper.rb
302
321
  - spec/support/shared_commands_examples.rb
303
322
  - spec/support/shared_group_examples.rb
@@ -414,6 +433,22 @@ test_files:
414
433
  - spec/solaris/user_spec.rb
415
434
  - spec/solaris/zfs_spec.rb
416
435
  - spec/solaris10/commands_spec.rb
436
+ - spec/solaris11/command_spec.rb
437
+ - spec/solaris11/commands_spec.rb
438
+ - spec/solaris11/cron_spec.rb
439
+ - spec/solaris11/default_gateway_spec.rb
440
+ - spec/solaris11/file_spec.rb
441
+ - spec/solaris11/group_spec.rb
442
+ - spec/solaris11/host_spec.rb
443
+ - spec/solaris11/ipfilter_spec.rb
444
+ - spec/solaris11/ipnat_spec.rb
445
+ - spec/solaris11/package_spec.rb
446
+ - spec/solaris11/port_spec.rb
447
+ - spec/solaris11/routing_table_spec.rb
448
+ - spec/solaris11/service_spec.rb
449
+ - spec/solaris11/svcprop_spec.rb
450
+ - spec/solaris11/user_spec.rb
451
+ - spec/solaris11/zfs_spec.rb
417
452
  - spec/spec_helper.rb
418
453
  - spec/support/shared_commands_examples.rb
419
454
  - spec/support/shared_group_examples.rb