kitchen-verifier-serverspec 0.4.5 → 0.4.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +36 -29
- data/lib/kitchen/verifier/serverspec.rb +20 -7
- data/lib/kitchen/verifier/serverspec_version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 043246681b786882e2a9a6cf4fb1229fc09e8e2e
|
4
|
+
data.tar.gz: 5a1ce432cdcabb18880f84ac20feca46a6252fc6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 850399866c291c374c1991773a2839a959a28d707cc3c0718add734a4c516c3e6da35cc6632eb5e6ca7ae272030b5c7fe8ba7af0ced45c098dd178b261769a89
|
7
|
+
data.tar.gz: a334b7323080ba0051800e06dd7501f26822b09cb1398bda3e9e8c3c4169f9387d59c02f56ce2475dd80776cd2f8924c7c57ede4769d46a00702101c2108f61a
|
data/README.md
CHANGED
@@ -36,6 +36,34 @@ gem 'serverspec'
|
|
36
36
|
|
37
37
|
this allows extra dependencies to be specified and the version of serverspec specified.
|
38
38
|
|
39
|
+
# Serverspec Verifier Options
|
40
|
+
|
41
|
+
key | default value | Notes
|
42
|
+
----|---------------|--------
|
43
|
+
sleep | 0 |
|
44
|
+
remote_exec | true | specify false to run serverspec on workstation
|
45
|
+
custom_serverspec_command | nil | custom command to run serverspec. Can be multiline. See examples below.
|
46
|
+
additional_serverspec_command | nil | additional command to run serverspec. Can be multiline. See examples below.
|
47
|
+
format | 'documentation' | format of serverspec output
|
48
|
+
color | true | enable color in the output
|
49
|
+
default_path | '/tmp/kitchen' | Set the default path where serverspec looks for patterns
|
50
|
+
patterns | [] | array of patterns for spec test files
|
51
|
+
gemfile | nil | custom gemfile to use to install serverspec
|
52
|
+
custom_install_commmand | nil | Custom shell command to be used at install stage. Can be multiline. See examples below.
|
53
|
+
additional_install_commmand | nil | Additional shell command to be used at install stage. Can be multiline. See examples below.
|
54
|
+
test_serverspec_installed | true | only run install_command if serverspec not installed
|
55
|
+
extra_flags | nil | extra flags to add to ther serverspec command
|
56
|
+
remove_default_path | false | remove the default_path after successful serverspec run
|
57
|
+
http_proxy | nil | use http proxy when installing ruby, serverspec and running serverspec
|
58
|
+
https_proxy | nil | use https proxy when installing puppet, ruby, serverspec and running serverspec
|
59
|
+
sudo | nil | use sudo to run commands
|
60
|
+
sudo_command | 'sudo -E -H' | sudo command to run when sudo set to true
|
61
|
+
env_vars | {} | environment variable to set for rspec
|
62
|
+
bundler_path | | override path for bundler command
|
63
|
+
rspec_path | | override path for rspec command
|
64
|
+
runner_url | https://raw.githubusercontent.com /neillturner/serverspec-runners/ master/ansiblespec_runner.rb | url for custom runner
|
65
|
+
require_runner | false | run the custom runner instead of rspec directly
|
66
|
+
|
39
67
|
## Usage
|
40
68
|
|
41
69
|
There are three ways to run verifier serverspec:
|
@@ -43,6 +71,14 @@ There are three ways to run verifier serverspec:
|
|
43
71
|
* Remotely directly on the server running serverspec in ssh mode
|
44
72
|
* Locally on your workstation running serverspec in ssh mode
|
45
73
|
|
74
|
+
Verifier Serverspec allows the serverspec files to be anywhere in the repository.This means that you can use spec files that follow ansiblespec or puppet beaker locations.
|
75
|
+
|
76
|
+
### Spec File Location and Updating
|
77
|
+
|
78
|
+
Verfier Serverspec does not copy the the serverspec files. They are assumed to be there in the repository and to have been copied to the server via the provisioner. This means if you change a spec file you need to run converge again to get the spec files copied to the server. Verifier Serverspec doesn't copy spec files in the test/integration directory like the busser serverspec that is supplied by chef.
|
79
|
+
|
80
|
+
|
81
|
+
|
46
82
|
## Remotely directly on server running serverspec in exec mode
|
47
83
|
|
48
84
|
This allow testing directly on the server. Typicaly used in conjunction with ansible using local connection.
|
@@ -200,35 +236,6 @@ suites:
|
|
200
236
|
SSH_KEY: 'spec/tomcat_private_key.pem'
|
201
237
|
```
|
202
238
|
|
203
|
-
|
204
|
-
# Serverspec Verifier Options
|
205
|
-
|
206
|
-
key | default value | Notes
|
207
|
-
----|---------------|--------
|
208
|
-
sleep | 0 |
|
209
|
-
remote_exec | true | specify false to run serverspec on workstation
|
210
|
-
custom_serverspec_command | nil | custom command to run serverspec. Can be multiline. See examples below.
|
211
|
-
additional_serverspec_command | nil | additional command to run serverspec. Can be multiline. See examples below.
|
212
|
-
format | 'documentation' | format of serverspec output
|
213
|
-
color | true | enable color in the output
|
214
|
-
default_path | '/tmp/kitchen' | Set the default path where serverspec looks for patterns
|
215
|
-
patterns | [] | array of patterns for spec test files
|
216
|
-
gemfile | nil | custom gemfile to use to install serverspec
|
217
|
-
custom_install_commmand | nil | Custom shell command to be used at install stage. Can be multiline. See examples below.
|
218
|
-
additional_install_commmand | nil | Additional shell command to be used at install stage. Can be multiline. See examples below.
|
219
|
-
test_serverspec_installed | true | only run install_command if serverspec not installed
|
220
|
-
extra_flags | nil | extra flags to add to ther serverspec command
|
221
|
-
remove_default_path | false | remove the default_path after successful serverspec run
|
222
|
-
http_proxy | nil | use http proxy when installing ruby, serverspec and running serverspec
|
223
|
-
https_proxy | nil | use https proxy when installing puppet, ruby, serverspec and running serverspec
|
224
|
-
sudo | nil | use sudo to run commands
|
225
|
-
sudo_command | 'sudo -E -H' | sudo command to run when sudo set to true
|
226
|
-
env_vars | {} | environment variable to set for rspec
|
227
|
-
bundler_path | '/usr/local/bin' | path for bundler command
|
228
|
-
rspec_path | '/usr/local/bin' | path for rspec command
|
229
|
-
runner_url | https://raw.githubusercontent.com /neillturner/serverspec-runners/ master/ansiblespec_runner.rb | url for custom runner
|
230
|
-
require_runner | false | run the custom runner instead of rspec directly
|
231
|
-
|
232
239
|
#### custom_install_command example usage
|
233
240
|
|
234
241
|
* One liner
|
@@ -42,8 +42,8 @@ module Kitchen
|
|
42
42
|
default_config :extra_flags, nil
|
43
43
|
default_config :remove_default_path, false
|
44
44
|
default_config :env_vars, {}
|
45
|
-
default_config :bundler_path,
|
46
|
-
default_config :rspec_path,
|
45
|
+
default_config :bundler_path, nil
|
46
|
+
default_config :rspec_path, nil
|
47
47
|
default_config :require_runner, false
|
48
48
|
default_config :runner_url, 'https://raw.githubusercontent.com/neillturner/serverspec-runners/master/ansiblespec_runner.rb'
|
49
49
|
|
@@ -87,6 +87,8 @@ module Kitchen
|
|
87
87
|
#{config[:additional_serverspec_command]}
|
88
88
|
if [ -d #{config[:default_path]} ]; then
|
89
89
|
cd #{config[:default_path]}
|
90
|
+
RSPEC_CMD=#{rspec_bash_cmd}
|
91
|
+
echo $RSPEC_CMD
|
90
92
|
#{rspec_commands}
|
91
93
|
#{remove_default_path}
|
92
94
|
else
|
@@ -185,12 +187,13 @@ module Kitchen
|
|
185
187
|
|
186
188
|
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
187
189
|
def install_serverspec
|
188
|
-
bundler_cmd = "#{bundler_path}bundle"
|
189
190
|
if config[:remote_exec]
|
190
191
|
<<-INSTALL
|
191
192
|
#{test_serverspec_installed}
|
192
193
|
#{install_gemfile}
|
193
|
-
|
194
|
+
BUNDLE_CMD=#{bundler_cmd}
|
195
|
+
echo $BUNDLE_CMD
|
196
|
+
#{sudo_env('')} $BUNDLE_CMD install --gemfile=#{config[:default_path]}/Gemfile
|
194
197
|
#{fi_test_serverspec_installed}
|
195
198
|
INSTALL
|
196
199
|
else
|
@@ -210,7 +213,7 @@ module Kitchen
|
|
210
213
|
end
|
211
214
|
gemfile = config[:gemfile] if config[:gemfile]
|
212
215
|
begin
|
213
|
-
system "#{
|
216
|
+
system "#{bundler_local_cmd} install --gemfile=#{gemfile}"
|
214
217
|
rescue
|
215
218
|
raise ActionFailed, 'Serverspec install failed'
|
216
219
|
end
|
@@ -260,6 +263,8 @@ module Kitchen
|
|
260
263
|
info('Running Serverspec')
|
261
264
|
if config[:require_runner]
|
262
265
|
"#{env_vars} #{sudo_env(rspec_cmd)} #{color} -f #{config[:format]} --default-path #{config[:default_path]} #{rspec_path_option} #{config[:extra_flags]}"
|
266
|
+
elsif config[:remote_exec]
|
267
|
+
config[:patterns].map { |s| "#{env_vars} #{sudo_env('')} $RSPEC_CMD #{color} -f #{config[:format]} --default-path #{config[:default_path]} #{config[:extra_flags]} -P #{s}" }.join(';')
|
263
268
|
else
|
264
269
|
config[:patterns].map { |s| "#{env_vars} #{sudo_env(rspec_cmd)} #{color} -f #{config[:format]} --default-path #{config[:default_path]} #{config[:extra_flags]} -P #{s}" }.join(';')
|
265
270
|
end
|
@@ -300,8 +305,16 @@ module Kitchen
|
|
300
305
|
config[:serverspec_command]
|
301
306
|
end
|
302
307
|
|
303
|
-
def
|
304
|
-
config[:bundler_path] ? "#{config[:bundler_path]}/" :
|
308
|
+
def bundler_cmd
|
309
|
+
config[:bundler_path] ? "#{config[:bundler_path]}/bundle" : '$(which bundle)'
|
310
|
+
end
|
311
|
+
|
312
|
+
def bundler_local_cmd
|
313
|
+
config[:bundler_path] ? "#{config[:bundler_path]}/bundle" : 'bundle'
|
314
|
+
end
|
315
|
+
|
316
|
+
def rspec_bash_cmd
|
317
|
+
config[:rspec_path] ? "#{config[:rspec_path]}/rspec" : '$(which rspec)'
|
305
318
|
end
|
306
319
|
|
307
320
|
def rspec_path
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kitchen-verifier-serverspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Neill Turner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: test-kitchen
|