serverspec 2.0.0.beta8 → 2.0.0.beta9

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 (139) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +24 -2
  3. data/lib/serverspec/setup.rb +6 -8
  4. data/lib/serverspec/type/cgroup.rb +1 -0
  5. data/lib/serverspec/type/command.rb +1 -1
  6. data/lib/serverspec/type/cron.rb +1 -1
  7. data/lib/serverspec/type/default_gateway.rb +2 -2
  8. data/lib/serverspec/type/file.rb +21 -17
  9. data/lib/serverspec/type/group.rb +2 -2
  10. data/lib/serverspec/type/host.rb +3 -3
  11. data/lib/serverspec/type/iis_app_pool.rb +2 -2
  12. data/lib/serverspec/type/iis_website.rb +5 -5
  13. data/lib/serverspec/type/interface.rb +1 -1
  14. data/lib/serverspec/type/ipfilter.rb +1 -1
  15. data/lib/serverspec/type/ipnat.rb +1 -1
  16. data/lib/serverspec/type/iptables.rb +1 -1
  17. data/lib/serverspec/type/kernel_module.rb +1 -1
  18. data/lib/serverspec/type/lxc.rb +2 -2
  19. data/lib/serverspec/type/mail_alias.rb +1 -1
  20. data/lib/serverspec/type/package.rb +2 -7
  21. data/lib/serverspec/type/port.rb +1 -1
  22. data/lib/serverspec/type/ppa.rb +2 -2
  23. data/lib/serverspec/type/routing_table.rb +1 -1
  24. data/lib/serverspec/type/selinux.rb +3 -3
  25. data/lib/serverspec/type/service.rb +7 -15
  26. data/lib/serverspec/type/user.rb +12 -6
  27. data/lib/serverspec/type/windows_feature.rb +1 -1
  28. data/lib/serverspec/type/windows_hot_fix.rb +1 -1
  29. data/lib/serverspec/type/windows_registry_key.rb +4 -4
  30. data/lib/serverspec/type/windows_scheduled_task.rb +1 -1
  31. data/lib/serverspec/type/yumrepo.rb +2 -2
  32. data/lib/serverspec/type/zfs.rb +2 -2
  33. data/lib/serverspec/version.rb +1 -1
  34. data/serverspec.gemspec +1 -1
  35. data/spec/spec_helper.rb +11 -0
  36. data/spec/type/aix/file_spec.rb +35 -0
  37. data/spec/type/aix/group_spec.rb +15 -0
  38. data/spec/type/aix/package_spec.rb +15 -0
  39. data/spec/type/aix/port_spec.rb +37 -0
  40. data/spec/type/aix/service_spec.rb +23 -0
  41. data/spec/type/aix/user_spec.rb +32 -0
  42. data/spec/type/arch/file_spec.rb +32 -0
  43. data/spec/type/arch/package_spec.rb +31 -0
  44. data/spec/type/arch/service_spec.rb +13 -0
  45. data/spec/type/{command_spec.rb → base/command_spec.rb} +1 -3
  46. data/spec/type/{cron_spec.rb → base/cron_spec.rb} +5 -1
  47. data/spec/type/{default_gateway_spec.rb → base/default_gateway_spec.rb} +1 -1
  48. data/spec/type/{file_spec.rb → base/file_spec.rb} +23 -24
  49. data/spec/type/{group_spec.rb → base/group_spec.rb} +5 -1
  50. data/spec/type/{host_spec.rb → base/host_spec.rb} +5 -1
  51. data/spec/type/{mail_alias_spec.rb → base/mail_alias_spec.rb} +5 -1
  52. data/spec/type/{package_spec.rb → base/package_spec.rb} +3 -32
  53. data/spec/type/{php_config_spec.rb → base/php_config_spec.rb} +1 -1
  54. data/spec/type/{port_spec.rb → base/port_spec.rb} +5 -1
  55. data/spec/type/{process_spec.rb → base/process_spec.rb} +5 -1
  56. data/spec/type/{routing_table_spec.rb → base/routing_table_spec.rb} +5 -1
  57. data/spec/type/{service_spec.rb → base/service_spec.rb} +5 -25
  58. data/spec/type/{user_spec.rb → base/user_spec.rb} +5 -1
  59. data/spec/type/darwin/file_spec.rb +43 -0
  60. data/spec/type/darwin/package_spec.rb +24 -0
  61. data/spec/type/darwin/port_spec.rb +37 -0
  62. data/spec/type/darwin/service_spec.rb +32 -0
  63. data/spec/type/debian/package_spec.rb +39 -0
  64. data/spec/type/debian/service_spec.rb +23 -0
  65. data/spec/type/fedora/service_spec.rb +19 -0
  66. data/spec/type/fedora15/service_spec.rb +19 -0
  67. data/spec/type/fedora20/service_spec.rb +19 -0
  68. data/spec/type/freebsd/file_spec.rb +11 -0
  69. data/spec/type/freebsd/package_spec.rb +31 -0
  70. data/spec/type/freebsd/port_spec.rb +37 -0
  71. data/spec/type/freebsd/service_spec.rb +16 -0
  72. data/spec/type/freebsd10/package_spec.rb +31 -0
  73. data/spec/type/gentoo/package_spec.rb +16 -0
  74. data/spec/type/gentoo/service_spec.rb +24 -0
  75. data/spec/type/{cgroup_spec.rb → linux/cgroup_spec.rb} +1 -1
  76. data/spec/type/linux/file_spec.rb +38 -0
  77. data/spec/type/{interface_spec.rb → linux/interface_spec.rb} +5 -1
  78. data/spec/type/{iptables_spec.rb → linux/iptables_spec.rb} +6 -2
  79. data/spec/type/linux/kernel_module_spec.rb +15 -0
  80. data/spec/type/{linux_kernel_parameter_spec.rb → linux/linux_kernel_parameter_spec.rb} +1 -1
  81. data/spec/type/{lxc_spec.rb → linux/lxc_container_spec.rb} +5 -1
  82. data/spec/type/{selinux_spec.rb → linux/selinux_spec.rb} +5 -1
  83. data/spec/type/{zfs_spec.rb → linux/zfs_spec.rb} +5 -1
  84. data/spec/type/nixos/package_spec.rb +31 -0
  85. data/spec/type/nixos/service_spec.rb +13 -0
  86. data/spec/type/openbsd/file_spec.rb +174 -0
  87. data/spec/type/openbsd/interface_spec.rb +25 -0
  88. data/spec/type/openbsd/mail_alias_spec.rb +15 -0
  89. data/spec/type/openbsd/package_spec.rb +24 -0
  90. data/spec/type/openbsd/port_spec.rb +11 -0
  91. data/spec/type/openbsd/service_spec.rb +24 -0
  92. data/spec/type/openbsd/user_spec.rb +24 -0
  93. data/spec/type/opensuse/service_spec.rb +32 -0
  94. data/spec/type/plamo/package_spec.rb +16 -0
  95. data/spec/type/plamo/service_spec.rb +16 -0
  96. data/spec/type/redhat/file_spec.rb +36 -0
  97. data/spec/type/redhat/package_spec.rb +39 -0
  98. data/spec/type/redhat/service_spec.rb +23 -0
  99. data/spec/type/{yumrepo_spec.rb → redhat/yumrepo_spec.rb} +5 -1
  100. data/spec/type/redhat5/iptables_spec.rb +23 -0
  101. data/spec/type/redhat7/service_spec.rb +13 -0
  102. data/spec/type/smartos/package_spec.rb +31 -0
  103. data/spec/type/smartos/service_spec.rb +32 -0
  104. data/spec/type/solaris/cron_spec.rb +23 -0
  105. data/spec/type/solaris/file_spec.rb +33 -0
  106. data/spec/type/solaris/group_spec.rb +15 -0
  107. data/spec/type/solaris/host_spec.rb +31 -0
  108. data/spec/type/solaris/ipfilter_spec.rb +11 -0
  109. data/spec/type/solaris/ipnat_spec.rb +11 -0
  110. data/spec/type/solaris/package_spec.rb +15 -0
  111. data/spec/type/solaris/port_spec.rb +37 -0
  112. data/spec/type/solaris/service_spec.rb +32 -0
  113. data/spec/type/solaris/user_spec.rb +32 -0
  114. data/spec/type/solaris/zfs_spec.rb +19 -0
  115. data/spec/type/solaris10/file_spec.rb +391 -0
  116. data/spec/type/solaris10/group_spec.rb +16 -0
  117. data/spec/type/solaris10/host_spec.rb +24 -0
  118. data/spec/type/solaris10/package_spec.rb +15 -0
  119. data/spec/type/solaris10/user_spec.rb +16 -0
  120. data/spec/type/suse/package_spec.rb +39 -0
  121. data/spec/type/suse/service_spec.rb +23 -0
  122. data/spec/type/ubuntu/ppa_spec.rb +23 -0
  123. data/spec/type/ubuntu/service_spec.rb +15 -0
  124. data/spec/type/windows/command_spec.rb +65 -0
  125. data/spec/type/windows/feature_spec.rb +13 -0
  126. data/spec/type/windows/file_spec.rb +161 -0
  127. data/spec/type/windows/group_spec.rb +31 -0
  128. data/spec/type/windows/host_spec.rb +56 -0
  129. data/spec/type/windows/hot_fix_spec.rb +26 -0
  130. data/spec/type/windows/iis_app_pool_spec.rb +18 -0
  131. data/spec/type/windows/iis_webisite_spec.rb +30 -0
  132. data/spec/type/windows/package_spec.rb +14 -0
  133. data/spec/type/windows/port_spec.rb +33 -0
  134. data/spec/type/windows/registry_key_spec.rb +62 -0
  135. data/spec/type/windows/scheduled_task_spec.rb +13 -0
  136. data/spec/type/windows/service_spec.rb +42 -0
  137. data/spec/type/windows/user_spec.rb +45 -0
  138. metadata +208 -50
  139. data/spec/type/kernel_module_spec.rb +0 -11
@@ -0,0 +1,39 @@
1
+ require 'spec_helper'
2
+
3
+ set :os, :family => 'suse'
4
+
5
+ describe commands.command_class('package').create do
6
+ it { should be_an_instance_of(Specinfra::Command::Suse::Base::Package) }
7
+ end
8
+
9
+ describe package('httpd') do
10
+ it { should be_installed }
11
+ end
12
+
13
+ describe package('invalid-package') do
14
+ it { should_not be_installed }
15
+ end
16
+
17
+ describe package('invalid-package') do
18
+ it { should_not be_installed.by('rpm') }
19
+ end
20
+
21
+ describe package('httpd') do
22
+ it { should be_installed.with_version('2.2.15-28.el6') }
23
+ end
24
+
25
+ describe package('httpd') do
26
+ it { should be_installed.by('rpm').with_version('2.2.15-28.el6') }
27
+ end
28
+
29
+ describe package('httpd') do
30
+ it { should_not be_installed.with_version('invalid-version') }
31
+ end
32
+
33
+ describe package('httpd') do
34
+ let(:stdout) { "2.2.15\n" }
35
+ its(:version) { should eq '2.2.15' }
36
+ its(:version) { should > '2.2.14' }
37
+ its(:version) { should < '2.2.16' }
38
+ its(:version) { should > '2.2.9' }
39
+ end
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ set :os, :family => 'suse'
4
+
5
+ describe commands.command_class('service').create do
6
+ it { should be_an_instance_of(Specinfra::Command::Suse::Base::Service) }
7
+ end
8
+
9
+ describe service('sshd') do
10
+ it { should be_enabled }
11
+ end
12
+
13
+ describe service('invalid-service') do
14
+ it { should_not be_enabled }
15
+ end
16
+
17
+ describe service('sshd') do
18
+ it { should be_enabled.with_level(4) }
19
+ end
20
+
21
+ describe service('invalid-service') do
22
+ it { should_not be_enabled.with_level(4) }
23
+ end
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ set :os, :family => 'ubuntu'
4
+
5
+ describe commands.command_class('ppa').create do
6
+ it { should be_an_instance_of(Specinfra::Command::Ubuntu::Base::Ppa) }
7
+ end
8
+
9
+ describe ppa('username/ppa-name') do
10
+ it { should exist }
11
+ end
12
+
13
+ describe ppa('invalid-ppa') do
14
+ it { should_not exist }
15
+ end
16
+
17
+ describe ppa('username/ppa-name') do
18
+ it { should be_enabled }
19
+ end
20
+
21
+ describe ppa('invalid-ppa') do
22
+ it { should_not be_enabled }
23
+ end
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+
3
+ set :os, :family => 'ubuntu'
4
+
5
+ describe commands.command_class('service').create do
6
+ it { should be_an_instance_of(Specinfra::Command::Ubuntu::Base::Service) }
7
+ end
8
+
9
+ describe service('sshd') do
10
+ it { should be_running }
11
+ end
12
+
13
+ describe service('invalid-service') do
14
+ it { should_not be_running }
15
+ end
@@ -0,0 +1,65 @@
1
+ require 'spec_helper'
2
+
3
+ include Specinfra::Helper::Cmd
4
+
5
+ set :os, :family => 'windows'
6
+
7
+ describe command('test_cmd /test/path/file') do
8
+ let(:stdout) { "test output 1.2.3\r\n" }
9
+ it { should return_stdout("test output 1.2.3") }
10
+ end
11
+
12
+ describe 'complete matching of stdout' do
13
+ context command('test_cmd /test/path/file') do
14
+ let(:stdout) { "foocontent-should-be-includedbar\r\n" }
15
+ it { should_not return_stdout('content-should-be-included') }
16
+ end
17
+ end
18
+
19
+ describe 'regexp matching of stdout' do
20
+ context command('test_cmd /test/path/file') do
21
+ let(:stdout) { "test output 1.2.3\r\n" }
22
+ it { should return_stdout(/1\.2\.3/) }
23
+ end
24
+ end
25
+
26
+ describe command('test_cmd /test/path/file') do
27
+ let(:stderr) { "No such file or directory\r\n" }
28
+ it { should return_stderr("No such file or directory") }
29
+ end
30
+
31
+ describe 'complete matching of stderr' do
32
+ context command('test_cmd /test/path/file') do
33
+ let(:stderr) { "No such file or directory\r\n" }
34
+ it { should_not return_stderr('file') }
35
+ end
36
+ end
37
+
38
+ describe 'regexp matching of stderr' do
39
+ context command('test_cmd /test/path/file') do
40
+ let(:stderr) { "No such file or directory\r\n" }
41
+ it { should return_stderr(/file/) }
42
+ end
43
+ end
44
+
45
+ describe command('test_cmd /test/path/file') do
46
+ it { should return_exit_status 0 }
47
+ end
48
+
49
+ describe command('dir "c:\"') do
50
+ let(:stdout) { <<EOF
51
+ Directory: C:\
52
+
53
+ Mode LastWriteTime Length Name
54
+ ---- ------------- ------ ----
55
+ d-r-- 23/09/2013 10:46 AM Program Files
56
+ d-r-- 23/09/2013 1:21 PM Program Files (x86)
57
+ d---- 17/10/2013 8:46 PM temp
58
+ d-r-- 23/09/2013 11:52 AM Users
59
+ d---- 23/09/2013 1:21 PM Windows
60
+ EOF
61
+ }
62
+
63
+ its(:stdout) { should match /Program Files/ }
64
+ its(:stdout) { should eq stdout }
65
+ end
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ include Specinfra::Helper::Cmd
4
+
5
+ set :os, :family => 'windows'
6
+
7
+ describe commands.command_class('feature').create do
8
+ it { should be_an_instance_of(Specinfra::Command::Windows::Base::Feature) }
9
+ end
10
+
11
+ describe windows_feature('Minesweeper') do
12
+ it{ should be_installed }
13
+ end
@@ -0,0 +1,161 @@
1
+ require 'spec_helper'
2
+
3
+ include Specinfra::Helper::Cmd
4
+
5
+ set :os, :family => 'windows'
6
+
7
+ describe commands.command_class('file').create do
8
+ it { should be_an_instance_of(Specinfra::Command::Windows::Base::File) }
9
+ end
10
+
11
+ describe file('/some/valid/file') do
12
+ it { should be_file }
13
+ end
14
+
15
+ describe file('/some/invalid/file') do
16
+ it { should_not be_file }
17
+ end
18
+
19
+ describe file('/some/valid/folder') do
20
+ it { should be_directory }
21
+ end
22
+
23
+ describe file('/some/invalid/folder') do
24
+ it { should_not be_directory }
25
+ end
26
+
27
+ describe file('/some/file') do
28
+ it { should contain 'search text' }
29
+ end
30
+
31
+ describe file('/some/file') do
32
+ it { should contain /^search text/ }
33
+ end
34
+
35
+ describe file('/some/file') do
36
+ it { should_not contain 'This is invalid text!!' }
37
+ end
38
+
39
+ describe file('Gemfile') do
40
+ it { should contain('rspec').from(/^group :test do/).to(/^end/) }
41
+ end
42
+
43
+ describe file('/some/file') do
44
+ it { should_not contain('This is invalid text!!').from(/^group :test do/).to(/^end/) }
45
+ end
46
+
47
+ describe file('Gemfile') do
48
+ it { should contain('rspec').after(/^group :test do/) }
49
+ end
50
+
51
+ describe file('Gemfile') do
52
+ it { should_not contain('This is invalid text!!').after(/^group :test do/) }
53
+ end
54
+
55
+ describe file('Gemfile') do
56
+ it { should contain('rspec').before(/end/) }
57
+ end
58
+
59
+ describe file('Gemfile') do
60
+ it { should_not contain('This is invalid text!!').before(/^end/) }
61
+ end
62
+
63
+ describe file('/some/file') do
64
+ it { should be_readable }
65
+ end
66
+
67
+ describe file('/some/invalid/file') do
68
+ it { should_not be_readable }
69
+ end
70
+
71
+ describe file('/some/file') do
72
+ it "should raise error if trying to check access by 'owner' or 'group' or 'others'" do
73
+ ['owner', 'group', 'others'].each do |access|
74
+ expect { should be_readable.by(access) }.to raise_error
75
+ end
76
+ end
77
+ end
78
+
79
+ describe file('/some/file') do
80
+ it { should be_readable.by('test.identity') }
81
+ end
82
+
83
+ describe file('/some/file') do
84
+ it { should be_readable.by_user('test.identity') }
85
+ end
86
+
87
+ describe file('/some/file') do
88
+ it { should be_writable }
89
+ end
90
+
91
+ describe file('/some/invalid/file') do
92
+ it { should_not be_writable }
93
+ end
94
+
95
+ describe file('/some/file') do
96
+ it "should raise error if trying to check access by 'owner' or 'group' or 'others'" do
97
+ ['owner', 'group', 'others'].each do |access|
98
+ expect { should be_writable.by(access) }.to raise_error
99
+ end
100
+ end
101
+ end
102
+
103
+ describe file('/some/file') do
104
+ it { should be_writable.by('test.identity') }
105
+ end
106
+
107
+ describe file('/some/file') do
108
+ it { should be_writable.by_user('test.identity') }
109
+ end
110
+
111
+ describe file('/some/file') do
112
+ it { should be_executable }
113
+ end
114
+
115
+ describe file('/some/invalid/file') do
116
+ it { should_not be_executable }
117
+ end
118
+
119
+ describe file('/some/file') do
120
+ it "should raise error if trying to check access by 'owner' or 'group' or 'others'" do
121
+ ['owner', 'group', 'others'].each do |access|
122
+ expect { should be_executable.by(access) }.to raise_error
123
+ end
124
+ end
125
+ end
126
+
127
+ describe file('/some/file') do
128
+ it { should be_executable.by('test.identity') }
129
+ end
130
+
131
+ describe file('/some/file') do
132
+ it { should be_executable.by_user('test.identity') }
133
+ end
134
+
135
+ describe file('/some/file') do
136
+ it { should be_version 1 }
137
+ end
138
+
139
+ describe file('/some/test/file') do
140
+ it "should raise error if command is not supported" do
141
+ {
142
+ :be_socket => [],
143
+ :be_mode => 644,
144
+ :be_owned_by => 'root',
145
+ :be_grouped_into => 'root',
146
+ :be_linked_to => '/some/other/file',
147
+ :be_mounted => [],
148
+ :match_md5checksum => '35435ea447c19f0ea5ef971837ab9ced',
149
+ :match_sha256checksum => '0c3feee1353a8459f8c7d84885e6bc602ef853751ffdbce3e3b6dfa1d345fc7a'
150
+ }.each do |method, args|
151
+ expect { should self.send(method, *args) }.to raise_error Specinfra::Command::Base::NotImplementedError
152
+ end
153
+ end
154
+ end
155
+
156
+
157
+
158
+
159
+
160
+
161
+
@@ -0,0 +1,31 @@
1
+ require 'spec_helper'
2
+
3
+ include Specinfra::Helper::Cmd
4
+
5
+ set :os, :family => 'windows'
6
+
7
+ describe commands.command_class('group').create do
8
+ it { should be_an_instance_of(Specinfra::Command::Windows::Base::Group) }
9
+ end
10
+
11
+ describe group('test.group') do
12
+ it { should exist }
13
+ end
14
+
15
+ describe group('test.domain\test.group') do
16
+ it { should exist }
17
+ end
18
+
19
+ describe group('invalid-group') do
20
+ it { should_not exist }
21
+ end
22
+
23
+ describe group('test.group') do
24
+ it "should raise error if command is not supported" do
25
+ {
26
+ :have_gid => [nil],
27
+ }.each do |method, args|
28
+ expect { should self.send(method, *args) }.to raise_error Specinfra::Command::Base::NotImplementedError
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,56 @@
1
+ require 'spec_helper'
2
+
3
+ include Specinfra::Helper::Cmd
4
+ set :os, :family => 'windows'
5
+
6
+ describe commands.command_class('host').create do
7
+ it { should be_an_instance_of(Specinfra::Command::Windows::Base::Host) }
8
+ end
9
+
10
+ describe host('127.0.0.1') do
11
+ it { should be_resolvable }
12
+ end
13
+
14
+ describe host('invalid-name') do
15
+ it { should_not be_resolvable }
16
+ end
17
+
18
+ describe host('127.0.0.1') do
19
+ it { should be_resolvable.by('hosts') }
20
+ end
21
+
22
+ describe host('invalid-name') do
23
+ it { should_not be_resolvable.by('hosts') }
24
+ end
25
+
26
+ describe host('127.0.0.1') do
27
+ it { should be_resolvable.by('dns') }
28
+ end
29
+
30
+ describe host('invalid-name') do
31
+ it { should_not be_resolvable.by('dns') }
32
+ end
33
+
34
+ describe host('127.0.0.1') do
35
+ it { should be_reachable }
36
+ end
37
+
38
+ describe host('invalid-host') do
39
+ it { should_not be_reachable }
40
+ end
41
+
42
+ describe host('127.0.0.1') do
43
+ it { should be_reachable.with(:proto => "icmp", :timeout=> 1) }
44
+ end
45
+
46
+ describe host('127.0.0.1') do
47
+ it { should be_reachable.with(:proto => "tcp", :port => 22, :timeout=> 1) }
48
+ end
49
+
50
+ describe host('127.0.0.1') do
51
+ it { should be_reachable.with(:proto => "udp", :port => 53, :timeout=> 1) }
52
+ end
53
+
54
+ describe host('invalid-host') do
55
+ it { should_not be_reachable.with(:proto => "udp", :port => 53, :timeout=> 1) }
56
+ end
@@ -0,0 +1,26 @@
1
+ require 'spec_helper'
2
+
3
+ include Specinfra::Helper::Cmd
4
+
5
+ set :os, :family => 'windows'
6
+
7
+ describe commands.command_class('hot_fix').create do
8
+ it { should be_an_instance_of(Specinfra::Command::Windows::Base::HotFix) }
9
+ end
10
+
11
+ describe windows_hot_fix('DESCRIPTION-OR-KB-ID') do
12
+ it { should be_installed }
13
+ end
14
+
15
+ describe windows_hot_fix('DESCRIPTION') do
16
+ it { should be_installed.with_version('KB-ID') }
17
+ end
18
+
19
+ describe windows_hot_fix('DESCRIPTION_WITH_KB123456789_INLINED') do
20
+ it { should be_installed }
21
+ end
22
+
23
+ describe windows_hot_fix('DESCRIPTION_WITH_SUFFIX_KB123456789') do
24
+ it { should be_installed }
25
+ end
26
+
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ include Specinfra::Helper::Cmd
4
+
5
+ set :os, :family => 'windows'
6
+
7
+ describe commands.command_class('iis_app_pool').create do
8
+ it { should be_an_instance_of(Specinfra::Command::Windows::Base::IisAppPool) }
9
+ end
10
+
11
+ describe iis_app_pool('Default App Pool') do
12
+ it{ should exist }
13
+ end
14
+
15
+ describe iis_app_pool('Default App Pool') do
16
+ it{ should have_dotnet_version('2.0') }
17
+ end
18
+
@@ -0,0 +1,30 @@
1
+ require 'spec_helper'
2
+
3
+ include Specinfra::Helper::Cmd
4
+
5
+ set :os, :family => 'windows'
6
+
7
+ describe commands.command_class('iis_website').create do
8
+ it { should be_an_instance_of(Specinfra::Command::Windows::Base::IisWebsite) }
9
+ end
10
+
11
+ describe iis_website('Default Website') do
12
+ it{ should exist }
13
+ end
14
+
15
+ describe iis_website('Default Website') do
16
+ it{ should be_enabled }
17
+ end
18
+
19
+ describe iis_website('Default Website') do
20
+ it{ should be_running }
21
+ end
22
+
23
+ describe iis_website('Default Website') do
24
+ it{ should be_in_app_pool('Default App Pool') }
25
+ end
26
+
27
+ describe iis_website('Default Website') do
28
+ it{ should have_physical_path('C:\\inetpub\\www') }
29
+ end
30
+
@@ -0,0 +1,14 @@
1
+ require 'spec_helper'
2
+
3
+ include Specinfra::Helper::Cmd
4
+
5
+ set :os, :family => 'windows'
6
+
7
+ describe commands.command_class('package').create do
8
+ it { should be_an_instance_of(Specinfra::Command::Windows::Base::Package) }
9
+ end
10
+
11
+ describe package('foo') do
12
+ it { should be_installed }
13
+ end
14
+
@@ -0,0 +1,33 @@
1
+ require 'spec_helper'
2
+
3
+ include Specinfra::Helper::Cmd
4
+
5
+ set :os, :family => 'windows'
6
+
7
+ describe commands.command_class('port').create do
8
+ it { should be_an_instance_of(Specinfra::Command::Windows::Base::Port) }
9
+ end
10
+
11
+ describe port(80) do
12
+ it { should be_listening }
13
+ end
14
+
15
+ describe port('invalid') do
16
+ it { should_not be_listening }
17
+ end
18
+
19
+ describe port(80) do
20
+ it { should be_listening.with("tcp") }
21
+ end
22
+
23
+ describe port(123) do
24
+ it { should be_listening.with("udp") }
25
+ end
26
+
27
+ describe port(80) do
28
+ it {
29
+ expect {
30
+ should be_listening.with('not implemented')
31
+ }.to raise_error(ArgumentError, %r/\A`be_listening` matcher doesn\'t support/)
32
+ }
33
+ end
@@ -0,0 +1,62 @@
1
+ require 'spec_helper'
2
+
3
+ include Specinfra::Helper::Cmd
4
+ set :os, :family => 'windows'
5
+
6
+ describe commands.command_class('registry_key').create do
7
+ it { should be_an_instance_of(Specinfra::Command::Windows::Base::RegistryKey) }
8
+ end
9
+
10
+ describe windows_registry_key('PATH/TO/THE_KEY') do
11
+ it { should exist }
12
+ end
13
+
14
+ describe windows_registry_key('PATH/TO/THE_KEY') do
15
+ it { should have_value('Test Value') }
16
+ end
17
+
18
+ describe 'Key value types' do
19
+ context 'default type' do
20
+ describe windows_registry_key('PATH/TO/THE_KEY') do
21
+ it { should have_property('TestProperty') }
22
+ end
23
+ end
24
+
25
+ {
26
+ :type_string => 'String',
27
+ :type_binary => 'Binary',
28
+ :type_dword => 'DWord',
29
+ :type_qword => 'QWord',
30
+ :type_multistring => 'MultiString',
31
+ :type_expandstring => 'ExpandString'
32
+ }.each do |sym, type|
33
+ context "type #{type}" do
34
+ describe windows_registry_key('PATH/TO/THE_KEY') do
35
+ it { should have_property('TestProperty', sym) }
36
+ end
37
+ end
38
+ end
39
+ end
40
+
41
+ describe windows_registry_key('PATH/TO/THE_KEY') do
42
+ it { should have_property_value('TestProperty', :type_binary, '12a07b') }
43
+ end
44
+
45
+ describe windows_registry_key('PATH/TO/THE_KEY') do
46
+ it { should have_property_value('TestProperty', :type_dword, 'fffffd6c') }
47
+ end
48
+
49
+ describe windows_registry_key('PATH/TO/THE_KEY') do
50
+ it { should have_property_value('TestProperty', :type_qword, '1e240') }
51
+ end
52
+
53
+ describe windows_registry_key('PATH/TO/THE_KEY') do
54
+ it {
55
+ value = <<-EOF
56
+ test line1
57
+ test line2
58
+ test line3
59
+ EOF
60
+ should have_property_value('TestProperty', :type_multistring, value)
61
+ }
62
+ end
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ include Specinfra::Helper::Cmd
4
+
5
+ set :os, :family => 'windows'
6
+
7
+ describe commands.command_class('scheduled_task').create do
8
+ it { should be_an_instance_of(Specinfra::Command::Windows::Base::ScheduledTask) }
9
+ end
10
+
11
+ describe windows_scheduled_task('foo') do
12
+ it { should exist }
13
+ end
@@ -0,0 +1,42 @@
1
+ require 'spec_helper'
2
+
3
+ include Specinfra::Helper::Cmd
4
+
5
+ set :os, :family => 'windows'
6
+
7
+ describe commands.command_class('service').create do
8
+ it { should be_an_instance_of(Specinfra::Command::Windows::Base::Service) }
9
+ end
10
+
11
+ describe service('Test Service') do
12
+ it { should be_enabled }
13
+ end
14
+
15
+ describe service('invalid-service') do
16
+ it { should_not be_enabled }
17
+ end
18
+
19
+ describe service('Test Service') do
20
+ it { should be_running }
21
+ end
22
+
23
+ describe service('invalid-daemon') do
24
+ it { should_not be_running }
25
+ end
26
+
27
+ describe service('service') do
28
+ it { should be_installed }
29
+ end
30
+
31
+ describe service('service') do
32
+ it { should have_start_mode 'mode' }
33
+ end
34
+
35
+ describe service('Test service') do
36
+ it "should raise error if trying to check service process controller" do
37
+ expect { should be_running.under('supervisor') }.to raise_error
38
+ end
39
+ it "should raise error if trying to check service monitoring" do
40
+ expect { should_not be_monitored_by('monit') }.to raise_error
41
+ end
42
+ end