kitchen-docker 2.4.0 → 2.5.0
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.
- checksums.yaml +4 -4
- data/.kitchen.yml +44 -46
- data/.travis.yml +13 -7
- data/CHANGELOG.md +9 -0
- data/README.md +41 -5
- data/Rakefile +19 -5
- data/kitchen-docker.gemspec +10 -0
- data/lib/kitchen/driver/docker.rb +41 -11
- data/lib/kitchen/driver/docker_version.rb +1 -1
- data/test/Dockerfile +9 -2
- data/test/integration/capabilities/serverspec/capabilities_drop_spec.rb +21 -4
- data/test/integration/default/serverspec/default_spec.rb +21 -3
- data/test/integration/inspec/inspec_spec.rb +20 -0
- data/test/spec/docker_spec.rb +64 -0
- data/test/spec/spec_helper.rb +32 -0
- metadata +79 -7
- data/test/integration/capabilities/serverspec/spec_helper.rb +0 -3
- data/test/integration/default/serverspec/spec_helper.rb +0 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 75827cd02d9a9ddd56f0c8b7855e972e65d5ee18
|
|
4
|
+
data.tar.gz: 4b6a7af9475fa2eea7ea86baffe7e107b6418b0a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3e56b648c7ea34db0f0e0f79d4caee22cf82d3c63924a908acfa5591b265f9a630f566d6b0af00e229f04d907d4c11964cb4bc7d3c195146ee54a68afac0a365
|
|
7
|
+
data.tar.gz: 603475404366c87800fd38e35e1bdc6be00c8b5a637f6a1d305796df69c966cde0591a8d842b2e402f46868b7eb84e1aaf6bb308e3ca2650fabf554fbed12d31
|
data/.kitchen.yml
CHANGED
|
@@ -1,55 +1,53 @@
|
|
|
1
|
+
<% # Make sure the local copy of the driver is loaded %>
|
|
2
|
+
<% lib = File.expand_path('../lib', __FILE__) %>
|
|
3
|
+
<% $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) %>
|
|
1
4
|
---
|
|
2
5
|
driver:
|
|
3
6
|
name: docker
|
|
4
|
-
provision_command: curl -L
|
|
7
|
+
provision_command: curl -L https://www.chef.io/chef/install.sh | bash
|
|
5
8
|
|
|
6
9
|
provisioner:
|
|
7
10
|
name: dummy
|
|
8
11
|
|
|
9
12
|
platforms:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
platform: ubuntu
|
|
32
|
-
instance_name: db
|
|
33
|
-
publish_all: true
|
|
34
|
-
- name: linked
|
|
35
|
-
driver:
|
|
36
|
-
image: ubuntu:14.04
|
|
37
|
-
platform: ubuntu
|
|
38
|
-
links: "db:db"
|
|
13
|
+
- name: ubuntu-12.04
|
|
14
|
+
- name: ubuntu-14.04
|
|
15
|
+
- name: ubuntu-16.04
|
|
16
|
+
- name: centos-6
|
|
17
|
+
- name: centos-7
|
|
18
|
+
- name: debian
|
|
19
|
+
- name: arch
|
|
20
|
+
driver:
|
|
21
|
+
image: base/archlinux
|
|
22
|
+
provision_command: true
|
|
23
|
+
- name: unknown
|
|
24
|
+
driver:
|
|
25
|
+
image: ubuntu:12.04
|
|
26
|
+
platform: ubuntu
|
|
27
|
+
- name: dockerfile
|
|
28
|
+
driver:
|
|
29
|
+
username: dockerfile
|
|
30
|
+
password: dockerfile
|
|
31
|
+
dockerfile: test/Dockerfile
|
|
32
|
+
run_command: /sbin/init
|
|
33
|
+
|
|
39
34
|
suites:
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
35
|
+
- name: default
|
|
36
|
+
excludes: [arch]
|
|
37
|
+
- name: context
|
|
38
|
+
excludes: [arch]
|
|
39
|
+
driver:
|
|
40
|
+
build_context: false
|
|
41
|
+
- name: capabilities
|
|
42
|
+
excludes: [arch,unknown,centos-7,centos-6,dockerfile]
|
|
43
|
+
driver:
|
|
44
|
+
provision_command:
|
|
45
|
+
- curl -L https://www.chef.io/chef/install.sh | bash
|
|
46
|
+
- apt-get install -y net-tools
|
|
47
|
+
cap_drop:
|
|
48
|
+
- NET_ADMIN
|
|
49
|
+
- name: inspec
|
|
50
|
+
driver:
|
|
51
|
+
provision_command: true
|
|
52
|
+
verifier:
|
|
53
|
+
name: inspec
|
data/.travis.yml
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
|
+
sudo: required
|
|
2
|
+
dist: trusty
|
|
1
3
|
language: ruby
|
|
2
4
|
|
|
3
5
|
rvm:
|
|
4
|
-
- 2.
|
|
5
|
-
-
|
|
6
|
-
-
|
|
7
|
-
- ruby-head
|
|
6
|
+
- "2.1"
|
|
7
|
+
- "2.2"
|
|
8
|
+
- "2.3"
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
services:
|
|
11
|
+
- docker
|
|
12
|
+
|
|
13
|
+
script:
|
|
14
|
+
- docker version
|
|
15
|
+
- kitchen --version
|
|
16
|
+
- rake spec
|
|
17
|
+
- kitchen test -d always
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
# Kitchen-Docker Changelog
|
|
2
|
+
|
|
3
|
+
## 2.5.0
|
|
4
|
+
|
|
5
|
+
* [#209](https://github.com/portertech/kitchen-docker/pulls/209) Fix usage with Kitchen rake tasks.
|
|
6
|
+
* Add `run_options` and `build_options` configuration.
|
|
7
|
+
* [#195](https://github.com/portertech/kitchen-docker/pulls/195) Fix Arch Linux support.
|
|
8
|
+
* Fix shell escaping for build paths and SSH keys.
|
|
9
|
+
|
|
1
10
|
## 2.4.0
|
|
2
11
|
|
|
3
12
|
* [#148](https://github.com/portertech/kitchen-docker/issues/148) Restored support for older versions of Ruby.
|
data/README.md
CHANGED
|
@@ -436,6 +436,40 @@ Examples:
|
|
|
436
436
|
build_context: true
|
|
437
437
|
```
|
|
438
438
|
|
|
439
|
+
### build_options
|
|
440
|
+
|
|
441
|
+
Extra command-line options to pass to `docker build` when creating the image.
|
|
442
|
+
|
|
443
|
+
Examples:
|
|
444
|
+
|
|
445
|
+
```yaml
|
|
446
|
+
build_options: --rm=false
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
```yaml
|
|
450
|
+
build_options:
|
|
451
|
+
rm: false
|
|
452
|
+
build-arg: something
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
### run_options
|
|
456
|
+
|
|
457
|
+
Extra command-line options to pass to `docker run` when starting the container.
|
|
458
|
+
|
|
459
|
+
Examples:
|
|
460
|
+
|
|
461
|
+
```yaml
|
|
462
|
+
run_options: --ip=1.2.3.4
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
```yaml
|
|
466
|
+
run_options:
|
|
467
|
+
tmpfs:
|
|
468
|
+
- /run/lock
|
|
469
|
+
- /tmp
|
|
470
|
+
net: br3
|
|
471
|
+
```
|
|
472
|
+
|
|
439
473
|
## Development
|
|
440
474
|
|
|
441
475
|
* Source hosted at [GitHub][repo]
|
|
@@ -453,7 +487,9 @@ example:
|
|
|
453
487
|
|
|
454
488
|
## Authors
|
|
455
489
|
|
|
456
|
-
Created
|
|
490
|
+
Created by [Sean Porter][author] (<portertech@gmail.com>).
|
|
491
|
+
|
|
492
|
+
Maintained by [Noah Kantrowitz][https://github.com/coderanger].
|
|
457
493
|
|
|
458
494
|
## License
|
|
459
495
|
|
|
@@ -461,14 +497,14 @@ Apache 2.0 (see [LICENSE][license])
|
|
|
461
497
|
|
|
462
498
|
|
|
463
499
|
[author]: https://github.com/portertech
|
|
464
|
-
[issues]: https://github.com/
|
|
465
|
-
[license]: https://github.com/
|
|
466
|
-
[repo]: https://github.com/
|
|
500
|
+
[issues]: https://github.com/test-kitchen/kitchen-docker/issues
|
|
501
|
+
[license]: https://github.com/test-kitchen/kitchen-docker/blob/master/LICENSE
|
|
502
|
+
[repo]: https://github.com/test-kitchen/kitchen-docker
|
|
467
503
|
[docker_installation]: https://docs.docker.com/installation/#installation
|
|
468
504
|
[docker_upstart_issue]: https://github.com/dotcloud/docker/issues/223
|
|
469
505
|
[docker_index]: https://index.docker.io/
|
|
470
506
|
[docker_default_image]: https://index.docker.io/_/base/
|
|
471
507
|
[test_kitchen_docs]: http://kitchen.ci/docs/getting-started/
|
|
472
|
-
[chef_omnibus_dl]:
|
|
508
|
+
[chef_omnibus_dl]: https://downloads.chef.io/chef-client/
|
|
473
509
|
[cpu_shares]: https://docs.fedoraproject.org/en-US/Fedora/17/html/Resource_Management_Guide/sec-cpu.html
|
|
474
510
|
[memory_limit]: https://docs.fedoraproject.org/en-US/Fedora/17/html/Resource_Management_Guide/sec-memory.html
|
data/Rakefile
CHANGED
|
@@ -20,9 +20,23 @@ task :quality => [:cane, :tailor, :stats]
|
|
|
20
20
|
|
|
21
21
|
task :default => [:quality]
|
|
22
22
|
|
|
23
|
-
begin
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
rescue LoadError
|
|
27
|
-
|
|
23
|
+
# begin
|
|
24
|
+
# require 'kitchen/rake_tasks'
|
|
25
|
+
# Kitchen::RakeTasks.new
|
|
26
|
+
# rescue LoadError
|
|
27
|
+
# puts ">>>>> Kitchen gem not loaded, omitting tasks" unless ENV['CI']
|
|
28
|
+
# end
|
|
29
|
+
|
|
30
|
+
# Create the spec task.
|
|
31
|
+
require 'rspec/core/rake_task'
|
|
32
|
+
RSpec::Core::RakeTask.new(:spec, :tag) do |t, args|
|
|
33
|
+
t.rspec_opts = [].tap do |a|
|
|
34
|
+
a << '--color'
|
|
35
|
+
a << "--format #{ENV['CI'] ? 'documentation' : 'Fuubar'}"
|
|
36
|
+
a << '--backtrace' if ENV['VERBOSE'] || ENV['DEBUG']
|
|
37
|
+
a << "--seed #{ENV['SEED']}" if ENV['SEED']
|
|
38
|
+
a << "--tag #{args[:tag]}" if args[:tag]
|
|
39
|
+
a << "--default-path test"
|
|
40
|
+
a << '-I test/spec'
|
|
41
|
+
end.join(' ')
|
|
28
42
|
end
|
data/kitchen-docker.gemspec
CHANGED
|
@@ -23,7 +23,17 @@ Gem::Specification.new do |spec|
|
|
|
23
23
|
spec.add_development_dependency 'bundler'
|
|
24
24
|
spec.add_development_dependency 'rake'
|
|
25
25
|
|
|
26
|
+
# Style checker gems.
|
|
26
27
|
spec.add_development_dependency 'cane'
|
|
27
28
|
spec.add_development_dependency 'tailor'
|
|
28
29
|
spec.add_development_dependency 'countloc'
|
|
30
|
+
|
|
31
|
+
# Unit testing gems.
|
|
32
|
+
spec.add_development_dependency 'rspec', '~> 3.2'
|
|
33
|
+
spec.add_development_dependency 'rspec-its', '~> 1.2'
|
|
34
|
+
spec.add_development_dependency 'fuubar', '~> 2.0'
|
|
35
|
+
spec.add_development_dependency 'simplecov', '~> 0.9'
|
|
36
|
+
|
|
37
|
+
# Integration testing gems.
|
|
38
|
+
spec.add_development_dependency 'kitchen-inspec', '~> 0.14'
|
|
29
39
|
end
|
|
@@ -19,6 +19,8 @@ require 'json'
|
|
|
19
19
|
require 'securerandom'
|
|
20
20
|
require 'uri'
|
|
21
21
|
require 'net/ssh'
|
|
22
|
+
require 'tempfile'
|
|
23
|
+
require 'shellwords'
|
|
22
24
|
require File.join(File.dirname(__FILE__), 'docker', 'erb')
|
|
23
25
|
|
|
24
26
|
module Kitchen
|
|
@@ -51,6 +53,8 @@ module Kitchen
|
|
|
51
53
|
default_config :wait_for_sshd, true
|
|
52
54
|
default_config :private_key, File.join(Dir.pwd, '.kitchen', 'docker_id_rsa')
|
|
53
55
|
default_config :public_key, File.join(Dir.pwd, '.kitchen', 'docker_id_rsa.pub')
|
|
56
|
+
default_config :build_options, nil
|
|
57
|
+
default_config :run_options, nil
|
|
54
58
|
|
|
55
59
|
default_config :use_sudo do |driver|
|
|
56
60
|
!driver.remote_socket?
|
|
@@ -196,11 +200,15 @@ module Kitchen
|
|
|
196
200
|
RUN ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N ''
|
|
197
201
|
eos
|
|
198
202
|
when 'arch'
|
|
203
|
+
# See https://bugs.archlinux.org/task/47052 for why we
|
|
204
|
+
# blank out limits.conf.
|
|
199
205
|
<<-eos
|
|
200
|
-
RUN pacman -
|
|
201
|
-
RUN pacman
|
|
206
|
+
RUN pacman --noconfirm -Sy archlinux-keyring
|
|
207
|
+
RUN pacman-db-upgrade
|
|
208
|
+
RUN pacman --noconfirm -Sy openssl openssh sudo curl
|
|
202
209
|
RUN ssh-keygen -A -t rsa -f /etc/ssh/ssh_host_rsa_key
|
|
203
210
|
RUN ssh-keygen -A -t dsa -f /etc/ssh/ssh_host_dsa_key
|
|
211
|
+
RUN echo >/etc/security/limits.conf
|
|
204
212
|
eos
|
|
205
213
|
when 'gentoo'
|
|
206
214
|
<<-eos
|
|
@@ -231,10 +239,8 @@ module Kitchen
|
|
|
231
239
|
useradd -d #{homedir} -m -s /bin/bash #{username}; \
|
|
232
240
|
fi
|
|
233
241
|
RUN echo #{username}:#{password} | chpasswd
|
|
234
|
-
RUN echo
|
|
235
|
-
RUN
|
|
236
|
-
RUN echo '#{username} ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers.d/#{username}
|
|
237
|
-
RUN chmod 0440 /etc/sudoers.d/#{username}
|
|
242
|
+
RUN echo "#{username} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
|
|
243
|
+
RUN echo "Defaults !requiretty" >> /etc/sudoers
|
|
238
244
|
RUN mkdir -p #{homedir}/.ssh
|
|
239
245
|
RUN chown -R #{username} #{homedir}/.ssh
|
|
240
246
|
RUN chmod 0700 #{homedir}/.ssh
|
|
@@ -246,7 +252,7 @@ module Kitchen
|
|
|
246
252
|
Array(config[:provision_command]).each do |cmd|
|
|
247
253
|
custom << "RUN #{cmd}\n"
|
|
248
254
|
end
|
|
249
|
-
ssh_key = "RUN echo
|
|
255
|
+
ssh_key = "RUN echo #{Shellwords.escape(public_key)} >> #{homedir}/.ssh/authorized_keys"
|
|
250
256
|
# Empty string to ensure the file ends with a newline.
|
|
251
257
|
[from, env_variables, platform, base, custom, ssh_key, ''].join("\n")
|
|
252
258
|
end
|
|
@@ -268,19 +274,21 @@ module Kitchen
|
|
|
268
274
|
end
|
|
269
275
|
end
|
|
270
276
|
raise ActionFailed,
|
|
271
|
-
|
|
277
|
+
'Could not parse Docker build output for image ID'
|
|
272
278
|
end
|
|
273
279
|
|
|
274
280
|
def build_image(state)
|
|
275
281
|
cmd = "build"
|
|
276
282
|
cmd << " --no-cache" unless config[:use_cache]
|
|
283
|
+
extra_build_options = config_to_options(config[:build_options])
|
|
284
|
+
cmd << " #{extra_build_options}" unless extra_build_options.empty?
|
|
277
285
|
dockerfile_contents = dockerfile
|
|
278
286
|
build_context = config[:build_context] ? '.' : '-'
|
|
279
287
|
file = Tempfile.new('Dockerfile-kitchen', Dir.pwd)
|
|
280
288
|
output = begin
|
|
281
289
|
file.write(dockerfile)
|
|
282
290
|
file.close
|
|
283
|
-
docker_command("#{cmd} -f #{file.path} #{build_context}", :input => dockerfile_contents)
|
|
291
|
+
docker_command("#{cmd} -f #{Shellwords.escape(file.path)} #{build_context}", :input => dockerfile_contents)
|
|
284
292
|
ensure
|
|
285
293
|
file.close unless file.closed?
|
|
286
294
|
file.unlink
|
|
@@ -317,6 +325,8 @@ module Kitchen
|
|
|
317
325
|
Array(config[:cap_add]).each {|cap| cmd << " --cap-add=#{cap}"} if config[:cap_add]
|
|
318
326
|
Array(config[:cap_drop]).each {|cap| cmd << " --cap-drop=#{cap}"} if config[:cap_drop]
|
|
319
327
|
Array(config[:security_opt]).each {|opt| cmd << " --security-opt=#{opt}"} if config[:security_opt]
|
|
328
|
+
extra_run_options = config_to_options(config[:run_options])
|
|
329
|
+
cmd << " #{extra_run_options}" unless extra_run_options.empty?
|
|
320
330
|
cmd << " #{image_id} #{config[:run_command]}"
|
|
321
331
|
cmd
|
|
322
332
|
end
|
|
@@ -333,11 +343,11 @@ module Kitchen
|
|
|
333
343
|
|
|
334
344
|
def parse_container_ssh_port(output)
|
|
335
345
|
begin
|
|
336
|
-
|
|
346
|
+
_host, port = output.split(':')
|
|
337
347
|
port.to_i
|
|
338
348
|
rescue
|
|
339
349
|
raise ActionFailed,
|
|
340
|
-
|
|
350
|
+
'Could not parse Docker port output for container SSH port'
|
|
341
351
|
end
|
|
342
352
|
end
|
|
343
353
|
|
|
@@ -361,6 +371,26 @@ module Kitchen
|
|
|
361
371
|
image_id = state[:image_id]
|
|
362
372
|
docker_command("rmi #{image_id}")
|
|
363
373
|
end
|
|
374
|
+
|
|
375
|
+
# Convert the config input for `:build_options` or `:run_options` in to a
|
|
376
|
+
# command line string for use with Docker.
|
|
377
|
+
#
|
|
378
|
+
# @since 2.5.0
|
|
379
|
+
# @param config [nil, String, Array, Hash] Config data to convert.
|
|
380
|
+
# @return [String]
|
|
381
|
+
def config_to_options(config)
|
|
382
|
+
case config
|
|
383
|
+
when nil
|
|
384
|
+
''
|
|
385
|
+
when String
|
|
386
|
+
config
|
|
387
|
+
when Array
|
|
388
|
+
config.map {|c| config_to_options(c) }.join(' ')
|
|
389
|
+
when Hash
|
|
390
|
+
config.map {|k, v| Array(v).map {|c| "--#{k}=#{Shellwords.escape(c)}" }.join(' ') }.join(' ')
|
|
391
|
+
end
|
|
392
|
+
end
|
|
393
|
+
|
|
364
394
|
end
|
|
365
395
|
end
|
|
366
396
|
end
|
data/test/Dockerfile
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
FROM centos:6
|
|
1
|
+
FROM centos:6
|
|
2
2
|
RUN yum clean all
|
|
3
3
|
RUN yum install -y sudo openssh-server openssh-clients which curl htop
|
|
4
4
|
RUN ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
|
|
@@ -7,4 +7,11 @@ RUN mkdir -p /var/run/sshd
|
|
|
7
7
|
RUN useradd -d /home/<%= @username %> -m -s /bin/bash <%= @username %>
|
|
8
8
|
RUN echo <%= "#{@username}:#{@password}" %> | chpasswd
|
|
9
9
|
RUN echo '<%= @username %> ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
|
|
10
|
-
RUN
|
|
10
|
+
RUN mkdir -p /home/<%= @username %>/.ssh
|
|
11
|
+
RUN chown -R <%= @username %> /home/<%= @username %>/.ssh
|
|
12
|
+
RUN chmod 0700 /home/<%= @username %>/.ssh
|
|
13
|
+
RUN touch /home/<%= @username %>/.ssh/authorized_keys
|
|
14
|
+
RUN chown <%= @username %> /home/<%= @username %>/.ssh/authorized_keys
|
|
15
|
+
RUN chmod 0600 /home/<%= @username %>/.ssh/authorized_keys
|
|
16
|
+
RUN curl -L https://www.chef.io/chef/install.sh | bash
|
|
17
|
+
RUN echo '<%= IO.read(@public_key).strip %>' >> /home/<%= @username %>/.ssh/authorized_keys
|
|
@@ -1,6 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
#
|
|
2
|
+
# Copyright 2016, Noah Kantrowitz
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
#
|
|
2
16
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
17
|
+
require 'serverspec'
|
|
18
|
+
set :backend, :exec
|
|
19
|
+
|
|
20
|
+
describe command('/sbin/ifconfig eth0 multicast') do
|
|
21
|
+
its(:exit_status) { is_expected.to_not eq 0 }
|
|
22
|
+
its(:stderr) { is_expected.to match /Operation not permitted/ }
|
|
6
23
|
end
|
|
@@ -1,5 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
#
|
|
2
|
+
# Copyright 2016, Noah Kantrowitz
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
#
|
|
2
16
|
|
|
3
|
-
|
|
4
|
-
|
|
17
|
+
require 'serverspec'
|
|
18
|
+
set :backend, :exec
|
|
19
|
+
|
|
20
|
+
# Just make sure the image launched and is reachable.
|
|
21
|
+
describe command('true') do
|
|
22
|
+
its(:exit_status) { is_expected.to eq 0 }
|
|
5
23
|
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright 2016, Noah Kantrowitz
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
#
|
|
16
|
+
|
|
17
|
+
# Just make sure the image launched and is reachable.
|
|
18
|
+
describe command('true') do
|
|
19
|
+
its(:exit_status) { is_expected.to eq 0 }
|
|
20
|
+
end
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright 2016, Noah Kantrowitz
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
#
|
|
16
|
+
|
|
17
|
+
require 'spec_helper'
|
|
18
|
+
|
|
19
|
+
describe Kitchen::Driver::Docker do
|
|
20
|
+
describe '#config_to_options' do
|
|
21
|
+
let(:config) { }
|
|
22
|
+
subject { described_class.new.send(:config_to_options, config) }
|
|
23
|
+
|
|
24
|
+
context 'with nil' do
|
|
25
|
+
let(:config) { nil }
|
|
26
|
+
it { is_expected.to eq '' }
|
|
27
|
+
end # /context with nil
|
|
28
|
+
|
|
29
|
+
context 'with a string' do
|
|
30
|
+
let(:config) { '--foo' }
|
|
31
|
+
it { is_expected.to eq '--foo' }
|
|
32
|
+
end # /context with a string
|
|
33
|
+
|
|
34
|
+
context 'with a string with spaces' do
|
|
35
|
+
let(:config) { '--foo bar' }
|
|
36
|
+
it { is_expected.to eq '--foo bar' }
|
|
37
|
+
end # /context with a string with spaces
|
|
38
|
+
|
|
39
|
+
context 'with an array of strings' do
|
|
40
|
+
let(:config) { %w{--foo --bar} }
|
|
41
|
+
it { is_expected.to eq '--foo --bar' }
|
|
42
|
+
end # /context with an array of strings
|
|
43
|
+
|
|
44
|
+
context 'with an array of hashes' do
|
|
45
|
+
let(:config) { [{foo: 'bar'}, {other: 'baz'}] }
|
|
46
|
+
it { is_expected.to eq '--foo=bar --other=baz' }
|
|
47
|
+
end # /context with an array of hashes
|
|
48
|
+
|
|
49
|
+
context 'with a hash of strings' do
|
|
50
|
+
let(:config) { {foo: 'bar', other: 'baz'} }
|
|
51
|
+
it { is_expected.to eq '--foo=bar --other=baz' }
|
|
52
|
+
end # /context with a hash of strings
|
|
53
|
+
|
|
54
|
+
context 'with a hash of arrays' do
|
|
55
|
+
let(:config) { {foo: %w{bar baz}} }
|
|
56
|
+
it { is_expected.to eq '--foo=bar --foo=baz' }
|
|
57
|
+
end # /context with a hash of arrays
|
|
58
|
+
|
|
59
|
+
context 'with a hash of strings with spaces' do
|
|
60
|
+
let(:config) { {foo: 'bar two', other: 'baz'} }
|
|
61
|
+
it { is_expected.to eq '--foo=bar\\ two --other=baz' }
|
|
62
|
+
end # /context with a hash of strings with spaces
|
|
63
|
+
end # /describe #config_to_options
|
|
64
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright 2016, Noah Kantrowitz
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
#
|
|
16
|
+
|
|
17
|
+
require 'rake'
|
|
18
|
+
require 'rspec'
|
|
19
|
+
require 'rspec/its'
|
|
20
|
+
require 'kitchen/driver/docker'
|
|
21
|
+
|
|
22
|
+
RSpec.configure do |config|
|
|
23
|
+
# Basic configuraiton
|
|
24
|
+
config.run_all_when_everything_filtered = true
|
|
25
|
+
config.filter_run(:focus)
|
|
26
|
+
|
|
27
|
+
# Run specs in random order to surface order dependencies. If you find an
|
|
28
|
+
# order dependency and want to debug it, you can fix the order by providing
|
|
29
|
+
# the seed, which is printed after each run.
|
|
30
|
+
# --seed 1234
|
|
31
|
+
config.order = 'random'
|
|
32
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: kitchen-docker
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sean Porter
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-
|
|
11
|
+
date: 2016-06-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: test-kitchen
|
|
@@ -94,6 +94,76 @@ dependencies:
|
|
|
94
94
|
- - ">="
|
|
95
95
|
- !ruby/object:Gem::Version
|
|
96
96
|
version: '0'
|
|
97
|
+
- !ruby/object:Gem::Dependency
|
|
98
|
+
name: rspec
|
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
|
100
|
+
requirements:
|
|
101
|
+
- - "~>"
|
|
102
|
+
- !ruby/object:Gem::Version
|
|
103
|
+
version: '3.2'
|
|
104
|
+
type: :development
|
|
105
|
+
prerelease: false
|
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
+
requirements:
|
|
108
|
+
- - "~>"
|
|
109
|
+
- !ruby/object:Gem::Version
|
|
110
|
+
version: '3.2'
|
|
111
|
+
- !ruby/object:Gem::Dependency
|
|
112
|
+
name: rspec-its
|
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
|
114
|
+
requirements:
|
|
115
|
+
- - "~>"
|
|
116
|
+
- !ruby/object:Gem::Version
|
|
117
|
+
version: '1.2'
|
|
118
|
+
type: :development
|
|
119
|
+
prerelease: false
|
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
+
requirements:
|
|
122
|
+
- - "~>"
|
|
123
|
+
- !ruby/object:Gem::Version
|
|
124
|
+
version: '1.2'
|
|
125
|
+
- !ruby/object:Gem::Dependency
|
|
126
|
+
name: fuubar
|
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
|
128
|
+
requirements:
|
|
129
|
+
- - "~>"
|
|
130
|
+
- !ruby/object:Gem::Version
|
|
131
|
+
version: '2.0'
|
|
132
|
+
type: :development
|
|
133
|
+
prerelease: false
|
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
135
|
+
requirements:
|
|
136
|
+
- - "~>"
|
|
137
|
+
- !ruby/object:Gem::Version
|
|
138
|
+
version: '2.0'
|
|
139
|
+
- !ruby/object:Gem::Dependency
|
|
140
|
+
name: simplecov
|
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
|
142
|
+
requirements:
|
|
143
|
+
- - "~>"
|
|
144
|
+
- !ruby/object:Gem::Version
|
|
145
|
+
version: '0.9'
|
|
146
|
+
type: :development
|
|
147
|
+
prerelease: false
|
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
149
|
+
requirements:
|
|
150
|
+
- - "~>"
|
|
151
|
+
- !ruby/object:Gem::Version
|
|
152
|
+
version: '0.9'
|
|
153
|
+
- !ruby/object:Gem::Dependency
|
|
154
|
+
name: kitchen-inspec
|
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
|
156
|
+
requirements:
|
|
157
|
+
- - "~>"
|
|
158
|
+
- !ruby/object:Gem::Version
|
|
159
|
+
version: '0.14'
|
|
160
|
+
type: :development
|
|
161
|
+
prerelease: false
|
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
163
|
+
requirements:
|
|
164
|
+
- - "~>"
|
|
165
|
+
- !ruby/object:Gem::Version
|
|
166
|
+
version: '0.14'
|
|
97
167
|
description: A Docker Driver for Test Kitchen
|
|
98
168
|
email:
|
|
99
169
|
- portertech@gmail.com
|
|
@@ -117,9 +187,10 @@ files:
|
|
|
117
187
|
- lib/kitchen/driver/docker_version.rb
|
|
118
188
|
- test/Dockerfile
|
|
119
189
|
- test/integration/capabilities/serverspec/capabilities_drop_spec.rb
|
|
120
|
-
- test/integration/capabilities/serverspec/spec_helper.rb
|
|
121
190
|
- test/integration/default/serverspec/default_spec.rb
|
|
122
|
-
- test/integration/
|
|
191
|
+
- test/integration/inspec/inspec_spec.rb
|
|
192
|
+
- test/spec/docker_spec.rb
|
|
193
|
+
- test/spec/spec_helper.rb
|
|
123
194
|
homepage: https://github.com/portertech/kitchen-docker
|
|
124
195
|
licenses:
|
|
125
196
|
- Apache 2.0
|
|
@@ -140,13 +211,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
140
211
|
version: '0'
|
|
141
212
|
requirements: []
|
|
142
213
|
rubyforge_project:
|
|
143
|
-
rubygems_version: 2.6.
|
|
214
|
+
rubygems_version: 2.6.4
|
|
144
215
|
signing_key:
|
|
145
216
|
specification_version: 4
|
|
146
217
|
summary: A Docker Driver for Test Kitchen
|
|
147
218
|
test_files:
|
|
148
219
|
- test/Dockerfile
|
|
149
220
|
- test/integration/capabilities/serverspec/capabilities_drop_spec.rb
|
|
150
|
-
- test/integration/capabilities/serverspec/spec_helper.rb
|
|
151
221
|
- test/integration/default/serverspec/default_spec.rb
|
|
152
|
-
- test/integration/
|
|
222
|
+
- test/integration/inspec/inspec_spec.rb
|
|
223
|
+
- test/spec/docker_spec.rb
|
|
224
|
+
- test/spec/spec_helper.rb
|