kitchen-verifier-serverspec 0.4.3 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +83 -2
- data/lib/kitchen/verifier/serverspec.rb +2 -1
- 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: 9986fb251543c01fe72b4f357912dff6782ef249
|
4
|
+
data.tar.gz: db06fc7b908cf0c7724160d47bf9b8b0444523ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b121bb267bfc80b3b2855c9826f8d453a9c130c2619dcb6804ac6940dfc555dce7d463b9b568c42313e238ab5fc363ced2f3a0544be8b6a2504c12d69784b7d
|
7
|
+
data.tar.gz: 5ae8e9870d5dbfad4b8aa7f8a65826fb6adcfbfff605afc8d50ba9ea7ff8948502877933a8f2c0c93f754c3244a6ba86980fd50c3bb5c8c15da1c7ac5464f1d3
|
data/README.md
CHANGED
@@ -38,6 +38,14 @@ this allows extra dependencies to be specified and the version of serverspec spe
|
|
38
38
|
|
39
39
|
## Usage
|
40
40
|
|
41
|
+
There are three ways to run verifier serverspec:
|
42
|
+
* Remotely directly on the server running serverspec in exec mode
|
43
|
+
* Remotely directly on the server running serverspec in ssh mode
|
44
|
+
* Locally on your workstation running serverspec in ssh mode
|
45
|
+
|
46
|
+
## Remotely directly on server running serverspec in exec mode
|
47
|
+
|
48
|
+
This allow testing directly on the server. Typicaly used in conjunction with ansible using local connection.
|
41
49
|
|
42
50
|
An example of the verifier serverspec options in your `.kitchen.yml` file:
|
43
51
|
|
@@ -54,7 +62,32 @@ suites:
|
|
54
62
|
|
55
63
|
See example [https://github.com/neillturner/puppet_repo](https://github.com/neillturner/puppet_repo)
|
56
64
|
|
57
|
-
|
65
|
+
```yaml
|
66
|
+
verifier:
|
67
|
+
name: serverspec
|
68
|
+
|
69
|
+
suites:
|
70
|
+
- name: base
|
71
|
+
verifier:
|
72
|
+
patterns:
|
73
|
+
- roles/tomcat/spec/tomcat_spec.rb
|
74
|
+
bundler_path: '/usr/local/bin'
|
75
|
+
rspec_path: '/usr/local/bin'
|
76
|
+
```
|
77
|
+
|
78
|
+
See example [https://github.com/neillturner/ansible_repo](https://github.com/neillturner/ansible_repo)
|
79
|
+
|
80
|
+
The spec/spec_helper.rb should contain
|
81
|
+
|
82
|
+
```
|
83
|
+
require 'serverspec'
|
84
|
+
set :backend, :exec
|
85
|
+
```
|
86
|
+
|
87
|
+
|
88
|
+
## Remotely directly on the server running serverspec in ssh mode
|
89
|
+
|
90
|
+
This allow testing of multiple remote servers. Typicaly used in conjunction with ansible using ssh connection.
|
58
91
|
|
59
92
|
```yaml
|
60
93
|
verifier:
|
@@ -73,7 +106,31 @@ suites:
|
|
73
106
|
SSH_KEY: 'spec/tomcat_private_key.pem'
|
74
107
|
```
|
75
108
|
|
76
|
-
|
109
|
+
The spec/spec_helper.rb should contain
|
110
|
+
|
111
|
+
```
|
112
|
+
require 'rubygems'
|
113
|
+
require 'bundler/setup'
|
114
|
+
|
115
|
+
require 'serverspec'
|
116
|
+
require 'pathname'
|
117
|
+
require 'net/ssh'
|
118
|
+
|
119
|
+
RSpec.configure do |config|
|
120
|
+
set :host, ENV['TARGET_HOST']
|
121
|
+
# ssh options at http://net-ssh.github.io/ssh/v1/chapter-2.html
|
122
|
+
# ssh via password, set :version to :debug for debugging
|
123
|
+
#set :ssh_options, :user => ENV['LOGIN_USER'], :paranoid => false, :verbose => :info, :password => ENV['LOGIN_PASSWORD'] if ENV['LOGIN_PASSWORD']
|
124
|
+
# ssh via ssh key
|
125
|
+
set :ssh_options, :user => ENV['LOGIN_USER'], :paranoid => false, :verbose => :error, :host_key => 'ssh-rsa', :keys => [ ENV['SSH_KEY'] ] if ENV['SSH_KEY']
|
126
|
+
set :backend, :ssh
|
127
|
+
set :request_pty, true
|
128
|
+
end
|
129
|
+
```
|
130
|
+
|
131
|
+
## Locally on your workstation running serverspec in ssh mode
|
132
|
+
|
133
|
+
This allows you not to have to install ruby and serverspec on the server being configured as serverspec is run on your workstation in ssh mode.
|
77
134
|
|
78
135
|
```yaml
|
79
136
|
verifier:
|
@@ -95,6 +152,29 @@ suites:
|
|
95
152
|
SSH_KEY: 'c:/repository/puppet_repo/private_key.pem'
|
96
153
|
```
|
97
154
|
|
155
|
+
The spec/spec_helper.rb should contain
|
156
|
+
|
157
|
+
```
|
158
|
+
require 'rubygems'
|
159
|
+
require 'bundler/setup'
|
160
|
+
|
161
|
+
require 'serverspec'
|
162
|
+
require 'pathname'
|
163
|
+
require 'net/ssh'
|
164
|
+
|
165
|
+
RSpec.configure do |config|
|
166
|
+
set :host, ENV['TARGET_HOST']
|
167
|
+
# ssh options at http://net-ssh.github.io/ssh/v1/chapter-2.html
|
168
|
+
# ssh via password, set :version to :debug for debugging
|
169
|
+
#set :ssh_options, :user => ENV['LOGIN_USER'], :paranoid => false, :verbose => :info, :password => ENV['LOGIN_PASSWORD'] if ENV['LOGIN_PASSWORD']
|
170
|
+
# ssh via ssh key
|
171
|
+
set :ssh_options, :user => ENV['LOGIN_USER'], :paranoid => false, :verbose => :error, :host_key => 'ssh-rsa', :keys => [ ENV['SSH_KEY'] ] if ENV['SSH_KEY']
|
172
|
+
set :backend, :ssh
|
173
|
+
set :request_pty, true
|
174
|
+
end
|
175
|
+
```
|
176
|
+
|
177
|
+
|
98
178
|
# Custom Runners
|
99
179
|
|
100
180
|
Custon runners can be defined and run to provide further customization.
|
@@ -142,6 +222,7 @@ remove_default_path | false | remove the default_path after successful serverspe
|
|
142
222
|
http_proxy | nil | use http proxy when installing ruby, serverspec and running serverspec
|
143
223
|
https_proxy | nil | use https proxy when installing puppet, ruby, serverspec and running serverspec
|
144
224
|
sudo | nil | use sudo to run commands
|
225
|
+
sudo_command | 'sudo -E -H' | sudo command to run when sudo set to true
|
145
226
|
env_vars | {} | environment variable to set for rspec
|
146
227
|
bundler_path | nil | path for bundler command
|
147
228
|
rspec_path | nil | path for rspec command
|
@@ -30,6 +30,7 @@ module Kitchen
|
|
30
30
|
default_config :shellout_opts, {}
|
31
31
|
default_config :live_stream, $stdout
|
32
32
|
default_config :remote_exec, true
|
33
|
+
default_config :sudo_command, 'sudo -E -H'
|
33
34
|
default_config :format, 'documentation'
|
34
35
|
default_config :color, true
|
35
36
|
default_config :default_path, '/tmp/kitchen'
|
@@ -184,7 +185,7 @@ module Kitchen
|
|
184
185
|
|
185
186
|
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
186
187
|
def install_serverspec
|
187
|
-
bundler_cmd = "#{bundler_path}
|
188
|
+
bundler_cmd = "#{bundler_path}bundle"
|
188
189
|
if config[:remote_exec]
|
189
190
|
<<-INSTALL
|
190
191
|
#{test_serverspec_installed}
|
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.4
|
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-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: test-kitchen
|