test-kitchen 1.0.0.beta.3 → 1.0.0.beta.4

Sign up to get free protection for your applications and to get access to all the features.
data/lib/kitchen/ssh.rb CHANGED
@@ -93,6 +93,7 @@ module Kitchen
93
93
  args = %W{ -o UserKnownHostsFile=/dev/null }
94
94
  args += %W{ -o StrictHostKeyChecking=no }
95
95
  args += %W{ -o LogLevel=#{logger.debug? ? "VERBOSE" : "ERROR"} }
96
+ args += %W{ -o ForwardAgent=#{options[:forward_agent] ? "yes" : "no"} } if options.key? :forward_agent
96
97
  Array(options[:keys]).each { |ssh_key| args += %W{ -i #{ssh_key}} }
97
98
  args += %W{ -p #{port}}
98
99
  args += %W{ #{username}@#{hostname}}
data/lib/kitchen/suite.rb CHANGED
@@ -30,6 +30,9 @@ module Kitchen
30
30
  # @return [Array] Array of names of excluded platforms
31
31
  attr_reader :excludes
32
32
 
33
+ # @return [Hash] suite specific driver_config hash
34
+ attr_reader :driver_config
35
+
33
36
  # Constructs a new suite.
34
37
  #
35
38
  # @param [Hash] options configuration for a new suite
@@ -41,6 +44,7 @@ module Kitchen
41
44
 
42
45
  @name = options.delete(:name)
43
46
  @excludes = Array(options[:excludes])
47
+ @driver_config = options.delete(:driver_config) || {}
44
48
  @data = options
45
49
  end
46
50
 
@@ -81,6 +85,19 @@ module Kitchen
81
85
  def nodes_path
82
86
  data[:nodes_path]
83
87
  end
88
+
89
+ # @return [String] local path to the suite's environments, or nil if one does
90
+ # not exist
91
+ def environments_path
92
+ data[:environments_path]
93
+ end
94
+
95
+ # @return [String] the suite's environment, or nil if one does
96
+ # not exist
97
+ def environment
98
+ data[:environment]
99
+ end
100
+
84
101
  end
85
102
 
86
103
  # Extra suite methods used for accessing Puppet data such as a manifest.
@@ -35,7 +35,6 @@ module Kitchen
35
35
  def initialize(*args)
36
36
  super
37
37
  @config = Kitchen::Config.new
38
- @config.supervised = false
39
38
  Kitchen.logger = Kitchen.default_file_logger
40
39
  yield self if block_given?
41
40
  define
data/lib/kitchen/util.rb CHANGED
@@ -98,5 +98,125 @@ module Kitchen
98
98
  seconds = (total - (minutes * 60))
99
99
  "(%dm%.2fs)" % [minutes, seconds]
100
100
  end
101
+
102
+ # Returns a set of Bourne Shell (AKA /bin/sh) compatible helper
103
+ # functions. This function is usually called inline in a string that
104
+ # will be executed remotely on a test instance.
105
+ #
106
+ # @return [String] a string representation of useful helper functions
107
+ def self.shell_helpers
108
+ # use Bourne (/bin/sh) as Bash does not exist on all Unix flavors
109
+ <<-HELPERS
110
+ # Check whether a command exists - returns 0 if it does, 1 if it does not
111
+ exists() {
112
+ if command -v $1 >/dev/null 2>&1
113
+ then
114
+ return 0
115
+ else
116
+ return 1
117
+ fi
118
+ }
119
+
120
+ # do_wget URL FILENAME
121
+ do_wget() {
122
+ echo "trying wget..."
123
+ wget -O "$2" "$1" 2>/tmp/stderr
124
+ # check for bad return status
125
+ test $? -ne 0 && return 1
126
+ # check for 404 or empty file
127
+ grep "ERROR 404" /tmp/stderr 2>&1 >/dev/null
128
+ if test $? -eq 0 || test ! -s "$2"; then
129
+ return 1
130
+ fi
131
+ return 0
132
+ }
133
+
134
+ # do_curl URL FILENAME
135
+ do_curl() {
136
+ echo "trying curl..."
137
+ curl -L "$1" > "$2"
138
+ # check for bad return status
139
+ [ $? -ne 0 ] && return 1
140
+ # check for bad output or empty file
141
+ grep "The specified key does not exist." "$2" 2>&1 >/dev/null
142
+ if test $? -eq 0 || test ! -s "$2"; then
143
+ return 1
144
+ fi
145
+ return 0
146
+ }
147
+
148
+ # do_fetch URL FILENAME
149
+ do_fetch() {
150
+ echo "trying fetch..."
151
+ fetch -o "$2" "$1" 2>/tmp/stderr
152
+ # check for bad return status
153
+ test $? -ne 0 && return 1
154
+ return 0
155
+ }
156
+
157
+ # do_curl URL FILENAME
158
+ do_perl() {
159
+ echo "trying perl..."
160
+ perl -e "use LWP::Simple; getprint($ARGV[0]);" "$1" > "$2"
161
+ # check for bad return status
162
+ test $? -ne 0 && return 1
163
+ # check for bad output or empty file
164
+ # grep "The specified key does not exist." "$2" 2>&1 >/dev/null
165
+ # if test $? -eq 0 || test ! -s "$2"; then
166
+ # unable_to_retrieve_package
167
+ # fi
168
+ return 0
169
+ }
170
+
171
+ # do_curl URL FILENAME
172
+ do_python() {
173
+ echo "trying python..."
174
+ python -c "import sys,urllib2 ; sys.stdout.write(urllib2.urlopen(sys.argv[1]).read())" "$1" > "$2"
175
+ # check for bad return status
176
+ test $? -ne 0 && return 1
177
+ # check for bad output or empty file
178
+ #grep "The specified key does not exist." "$2" 2>&1 >/dev/null
179
+ #if test $? -eq 0 || test ! -s "$2"; then
180
+ # unable_to_retrieve_package
181
+ #fi
182
+ return 0
183
+ }
184
+
185
+ # do_download URL FILENAME
186
+ do_download() {
187
+ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
188
+ export PATH
189
+
190
+ echo "downloading $1"
191
+ echo " to file $2"
192
+
193
+ # we try all of these until we get success.
194
+ # perl, in particular may be present but LWP::Simple may not be installed
195
+
196
+ if exists wget; then
197
+ do_wget $1 $2 && return 0
198
+ fi
199
+
200
+ if exists curl; then
201
+ do_curl $1 $2 && return 0
202
+ fi
203
+
204
+ if exists fetch; then
205
+ do_fetch $1 $2 && return 0
206
+ fi
207
+
208
+ if exists perl; then
209
+ do_perl $1 $2 && return 0
210
+ fi
211
+
212
+ if exists python; then
213
+ do_python $1 $2 && return 0
214
+ fi
215
+
216
+ echo ">>>>>> wget, curl, fetch, perl or python not found on this instance."
217
+ return 16
218
+ }
219
+ HELPERS
220
+ end
101
221
  end
102
222
  end
@@ -18,5 +18,5 @@
18
18
 
19
19
  module Kitchen
20
20
 
21
- VERSION = "1.0.0.beta.3"
21
+ VERSION = "1.0.0.beta.4"
22
22
  end
@@ -47,10 +47,6 @@ describe Kitchen::Instance do
47
47
 
48
48
  let(:instance) { Kitchen::Instance.new(opts) }
49
49
 
50
- before do
51
- Celluloid.logger = Logger.new(StringIO.new)
52
- end
53
-
54
50
  it "raises an ArgumentError if suite is missing" do
55
51
  opts.delete(:suite)
56
52
  proc { Kitchen::Instance.new(opts) }.must_raise Kitchen::ClientError
data/test-kitchen.gemspec CHANGED
@@ -7,41 +7,38 @@ Gem::Specification.new do |gem|
7
7
  gem.name = "test-kitchen"
8
8
  gem.version = Kitchen::VERSION
9
9
  gem.license = 'Apache 2.0'
10
- gem.authors = ["Fletcher Nichol"]
11
- gem.email = ["fnichol@nichol.ca"]
10
+ gem.authors = ['Fletcher Nichol']
11
+ gem.email = ['fnichol@nichol.ca']
12
12
  gem.description = %q{A Chef convergence integration test harness}
13
13
  gem.summary = gem.description
14
- gem.homepage = "https://github.com/opscode/test-kitchen"
14
+ gem.homepage = 'https://github.com/opscode/test-kitchen'
15
15
 
16
16
  gem.files = `git ls-files`.split($/)
17
17
  gem.executables = %w(kitchen)
18
18
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
19
- gem.require_paths = ["lib"]
19
+ gem.require_paths = ['lib']
20
20
 
21
- gem.required_ruby_version = ">= 1.9.1"
21
+ gem.required_ruby_version = '>= 1.9.1'
22
22
 
23
- gem.add_dependency 'celluloid'
24
- gem.add_dependency 'thor'
25
- gem.add_dependency 'pry'
26
- gem.add_dependency 'net-ssh'
27
- gem.add_dependency 'net-scp'
28
- gem.add_dependency 'mixlib-shellout'
29
- gem.add_dependency 'safe_yaml', '~> 0.9.5'
23
+ gem.add_dependency 'mixlib-shellout', '~> 1.2'
24
+ gem.add_dependency 'net-scp', '~> 1.1'
25
+ gem.add_dependency 'net-ssh', '~> 2.7'
26
+ gem.add_dependency 'safe_yaml', '~> 0.9'
27
+ gem.add_dependency 'thor', '~> 0.18'
28
+ gem.add_dependency 'buff-ignore', '~> 1.1'
30
29
 
31
- gem.add_development_dependency 'bundler', '~> 1.3'
30
+ gem.add_development_dependency 'bundler', '~> 1.3'
32
31
  gem.add_development_dependency 'rake'
33
32
 
34
- gem.add_development_dependency 'minitest', '~> 4.7'
35
- gem.add_development_dependency 'mocha'
36
- gem.add_development_dependency 'fakefs'
37
- gem.add_development_dependency 'guard-minitest'
38
- gem.add_development_dependency 'aruba', '~> 0.5'
39
- gem.add_development_dependency 'guard-cucumber'
33
+ gem.add_development_dependency 'aruba', '~> 0.5'
34
+ gem.add_development_dependency 'fakefs', '~> 0.4'
35
+ gem.add_development_dependency 'minitest', '~> 4.7'
36
+ gem.add_development_dependency 'mocha', '~> 0.14'
40
37
 
41
- gem.add_development_dependency 'yard'
42
- gem.add_development_dependency 'maruku'
43
- gem.add_development_dependency 'cane'
44
- gem.add_development_dependency 'tailor'
45
- gem.add_development_dependency 'simplecov'
46
- gem.add_development_dependency 'countloc'
38
+ gem.add_development_dependency 'cane', '~> 2.6'
39
+ gem.add_development_dependency 'countloc', '~> 0.4'
40
+ gem.add_development_dependency 'maruku', '~> 0.6'
41
+ gem.add_development_dependency 'simplecov', '~> 0.7'
42
+ gem.add_development_dependency 'tailor', '~> 1.2'
43
+ gem.add_development_dependency 'yard', '~> 0.8'
47
44
  end
metadata CHANGED
@@ -1,113 +1,99 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test-kitchen
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.beta.3
4
+ version: 1.0.0.beta.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fletcher Nichol
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-29 00:00:00.000000000 Z
11
+ date: 2013-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: celluloid
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - '>='
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - '>='
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: thor
14
+ name: mixlib-shellout
29
15
  requirement: !ruby/object:Gem::Requirement
30
16
  requirements:
31
- - - '>='
17
+ - - ~>
32
18
  - !ruby/object:Gem::Version
33
- version: '0'
19
+ version: '1.2'
34
20
  type: :runtime
35
21
  prerelease: false
36
22
  version_requirements: !ruby/object:Gem::Requirement
37
23
  requirements:
38
- - - '>='
24
+ - - ~>
39
25
  - !ruby/object:Gem::Version
40
- version: '0'
26
+ version: '1.2'
41
27
  - !ruby/object:Gem::Dependency
42
- name: pry
28
+ name: net-scp
43
29
  requirement: !ruby/object:Gem::Requirement
44
30
  requirements:
45
- - - '>='
31
+ - - ~>
46
32
  - !ruby/object:Gem::Version
47
- version: '0'
33
+ version: '1.1'
48
34
  type: :runtime
49
35
  prerelease: false
50
36
  version_requirements: !ruby/object:Gem::Requirement
51
37
  requirements:
52
- - - '>='
38
+ - - ~>
53
39
  - !ruby/object:Gem::Version
54
- version: '0'
40
+ version: '1.1'
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: net-ssh
57
43
  requirement: !ruby/object:Gem::Requirement
58
44
  requirements:
59
- - - '>='
45
+ - - ~>
60
46
  - !ruby/object:Gem::Version
61
- version: '0'
47
+ version: '2.7'
62
48
  type: :runtime
63
49
  prerelease: false
64
50
  version_requirements: !ruby/object:Gem::Requirement
65
51
  requirements:
66
- - - '>='
52
+ - - ~>
67
53
  - !ruby/object:Gem::Version
68
- version: '0'
54
+ version: '2.7'
69
55
  - !ruby/object:Gem::Dependency
70
- name: net-scp
56
+ name: safe_yaml
71
57
  requirement: !ruby/object:Gem::Requirement
72
58
  requirements:
73
- - - '>='
59
+ - - ~>
74
60
  - !ruby/object:Gem::Version
75
- version: '0'
61
+ version: '0.9'
76
62
  type: :runtime
77
63
  prerelease: false
78
64
  version_requirements: !ruby/object:Gem::Requirement
79
65
  requirements:
80
- - - '>='
66
+ - - ~>
81
67
  - !ruby/object:Gem::Version
82
- version: '0'
68
+ version: '0.9'
83
69
  - !ruby/object:Gem::Dependency
84
- name: mixlib-shellout
70
+ name: thor
85
71
  requirement: !ruby/object:Gem::Requirement
86
72
  requirements:
87
- - - '>='
73
+ - - ~>
88
74
  - !ruby/object:Gem::Version
89
- version: '0'
75
+ version: '0.18'
90
76
  type: :runtime
91
77
  prerelease: false
92
78
  version_requirements: !ruby/object:Gem::Requirement
93
79
  requirements:
94
- - - '>='
80
+ - - ~>
95
81
  - !ruby/object:Gem::Version
96
- version: '0'
82
+ version: '0.18'
97
83
  - !ruby/object:Gem::Dependency
98
- name: safe_yaml
84
+ name: buff-ignore
99
85
  requirement: !ruby/object:Gem::Requirement
100
86
  requirements:
101
87
  - - ~>
102
88
  - !ruby/object:Gem::Version
103
- version: 0.9.5
89
+ version: '1.1'
104
90
  type: :runtime
105
91
  prerelease: false
106
92
  version_requirements: !ruby/object:Gem::Requirement
107
93
  requirements:
108
94
  - - ~>
109
95
  - !ruby/object:Gem::Version
110
- version: 0.9.5
96
+ version: '1.1'
111
97
  - !ruby/object:Gem::Dependency
112
98
  name: bundler
113
99
  requirement: !ruby/object:Gem::Requirement
@@ -137,173 +123,145 @@ dependencies:
137
123
  - !ruby/object:Gem::Version
138
124
  version: '0'
139
125
  - !ruby/object:Gem::Dependency
140
- name: minitest
126
+ name: aruba
141
127
  requirement: !ruby/object:Gem::Requirement
142
128
  requirements:
143
129
  - - ~>
144
130
  - !ruby/object:Gem::Version
145
- version: '4.7'
131
+ version: '0.5'
146
132
  type: :development
147
133
  prerelease: false
148
134
  version_requirements: !ruby/object:Gem::Requirement
149
135
  requirements:
150
136
  - - ~>
151
137
  - !ruby/object:Gem::Version
152
- version: '4.7'
153
- - !ruby/object:Gem::Dependency
154
- name: mocha
155
- requirement: !ruby/object:Gem::Requirement
156
- requirements:
157
- - - '>='
158
- - !ruby/object:Gem::Version
159
- version: '0'
160
- type: :development
161
- prerelease: false
162
- version_requirements: !ruby/object:Gem::Requirement
163
- requirements:
164
- - - '>='
165
- - !ruby/object:Gem::Version
166
- version: '0'
138
+ version: '0.5'
167
139
  - !ruby/object:Gem::Dependency
168
140
  name: fakefs
169
141
  requirement: !ruby/object:Gem::Requirement
170
142
  requirements:
171
- - - '>='
143
+ - - ~>
172
144
  - !ruby/object:Gem::Version
173
- version: '0'
145
+ version: '0.4'
174
146
  type: :development
175
147
  prerelease: false
176
148
  version_requirements: !ruby/object:Gem::Requirement
177
149
  requirements:
178
- - - '>='
150
+ - - ~>
179
151
  - !ruby/object:Gem::Version
180
- version: '0'
152
+ version: '0.4'
181
153
  - !ruby/object:Gem::Dependency
182
- name: guard-minitest
154
+ name: minitest
183
155
  requirement: !ruby/object:Gem::Requirement
184
156
  requirements:
185
- - - '>='
157
+ - - ~>
186
158
  - !ruby/object:Gem::Version
187
- version: '0'
159
+ version: '4.7'
188
160
  type: :development
189
161
  prerelease: false
190
162
  version_requirements: !ruby/object:Gem::Requirement
191
163
  requirements:
192
- - - '>='
164
+ - - ~>
193
165
  - !ruby/object:Gem::Version
194
- version: '0'
166
+ version: '4.7'
195
167
  - !ruby/object:Gem::Dependency
196
- name: aruba
168
+ name: mocha
197
169
  requirement: !ruby/object:Gem::Requirement
198
170
  requirements:
199
171
  - - ~>
200
172
  - !ruby/object:Gem::Version
201
- version: '0.5'
173
+ version: '0.14'
202
174
  type: :development
203
175
  prerelease: false
204
176
  version_requirements: !ruby/object:Gem::Requirement
205
177
  requirements:
206
178
  - - ~>
207
179
  - !ruby/object:Gem::Version
208
- version: '0.5'
180
+ version: '0.14'
209
181
  - !ruby/object:Gem::Dependency
210
- name: guard-cucumber
182
+ name: cane
211
183
  requirement: !ruby/object:Gem::Requirement
212
184
  requirements:
213
- - - '>='
185
+ - - ~>
214
186
  - !ruby/object:Gem::Version
215
- version: '0'
187
+ version: '2.6'
216
188
  type: :development
217
189
  prerelease: false
218
190
  version_requirements: !ruby/object:Gem::Requirement
219
191
  requirements:
220
- - - '>='
192
+ - - ~>
221
193
  - !ruby/object:Gem::Version
222
- version: '0'
194
+ version: '2.6'
223
195
  - !ruby/object:Gem::Dependency
224
- name: yard
196
+ name: countloc
225
197
  requirement: !ruby/object:Gem::Requirement
226
198
  requirements:
227
- - - '>='
199
+ - - ~>
228
200
  - !ruby/object:Gem::Version
229
- version: '0'
201
+ version: '0.4'
230
202
  type: :development
231
203
  prerelease: false
232
204
  version_requirements: !ruby/object:Gem::Requirement
233
205
  requirements:
234
- - - '>='
206
+ - - ~>
235
207
  - !ruby/object:Gem::Version
236
- version: '0'
208
+ version: '0.4'
237
209
  - !ruby/object:Gem::Dependency
238
210
  name: maruku
239
211
  requirement: !ruby/object:Gem::Requirement
240
212
  requirements:
241
- - - '>='
213
+ - - ~>
242
214
  - !ruby/object:Gem::Version
243
- version: '0'
215
+ version: '0.6'
244
216
  type: :development
245
217
  prerelease: false
246
218
  version_requirements: !ruby/object:Gem::Requirement
247
219
  requirements:
248
- - - '>='
220
+ - - ~>
249
221
  - !ruby/object:Gem::Version
250
- version: '0'
222
+ version: '0.6'
251
223
  - !ruby/object:Gem::Dependency
252
- name: cane
224
+ name: simplecov
253
225
  requirement: !ruby/object:Gem::Requirement
254
226
  requirements:
255
- - - '>='
227
+ - - ~>
256
228
  - !ruby/object:Gem::Version
257
- version: '0'
229
+ version: '0.7'
258
230
  type: :development
259
231
  prerelease: false
260
232
  version_requirements: !ruby/object:Gem::Requirement
261
233
  requirements:
262
- - - '>='
234
+ - - ~>
263
235
  - !ruby/object:Gem::Version
264
- version: '0'
236
+ version: '0.7'
265
237
  - !ruby/object:Gem::Dependency
266
238
  name: tailor
267
239
  requirement: !ruby/object:Gem::Requirement
268
240
  requirements:
269
- - - '>='
270
- - !ruby/object:Gem::Version
271
- version: '0'
272
- type: :development
273
- prerelease: false
274
- version_requirements: !ruby/object:Gem::Requirement
275
- requirements:
276
- - - '>='
277
- - !ruby/object:Gem::Version
278
- version: '0'
279
- - !ruby/object:Gem::Dependency
280
- name: simplecov
281
- requirement: !ruby/object:Gem::Requirement
282
- requirements:
283
- - - '>='
241
+ - - ~>
284
242
  - !ruby/object:Gem::Version
285
- version: '0'
243
+ version: '1.2'
286
244
  type: :development
287
245
  prerelease: false
288
246
  version_requirements: !ruby/object:Gem::Requirement
289
247
  requirements:
290
- - - '>='
248
+ - - ~>
291
249
  - !ruby/object:Gem::Version
292
- version: '0'
250
+ version: '1.2'
293
251
  - !ruby/object:Gem::Dependency
294
- name: countloc
252
+ name: yard
295
253
  requirement: !ruby/object:Gem::Requirement
296
254
  requirements:
297
- - - '>='
255
+ - - ~>
298
256
  - !ruby/object:Gem::Version
299
- version: '0'
257
+ version: '0.8'
300
258
  type: :development
301
259
  prerelease: false
302
260
  version_requirements: !ruby/object:Gem::Requirement
303
261
  requirements:
304
- - - '>='
262
+ - - ~>
305
263
  - !ruby/object:Gem::Version
306
- version: '0'
264
+ version: '0.8'
307
265
  description: A Chef convergence integration test harness
308
266
  email:
309
267
  - fnichol@nichol.ca
@@ -338,17 +296,16 @@ files:
338
296
  - lib/kitchen/driver.rb
339
297
  - lib/kitchen/driver/base.rb
340
298
  - lib/kitchen/driver/dummy.rb
299
+ - lib/kitchen/driver/proxy.rb
341
300
  - lib/kitchen/driver/ssh_base.rb
342
301
  - lib/kitchen/errors.rb
343
302
  - lib/kitchen/generator/driver_create.rb
344
303
  - lib/kitchen/generator/init.rb
345
304
  - lib/kitchen/instance.rb
346
- - lib/kitchen/instance_actor.rb
347
305
  - lib/kitchen/loader/yaml.rb
348
306
  - lib/kitchen/logger.rb
349
307
  - lib/kitchen/logging.rb
350
308
  - lib/kitchen/login_command.rb
351
- - lib/kitchen/manager.rb
352
309
  - lib/kitchen/metadata_chopper.rb
353
310
  - lib/kitchen/platform.rb
354
311
  - lib/kitchen/provisioner.rb