kitchen-docker_cli 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.kitchen.yml +6 -3
- data/CHANGELOG.md +4 -0
- data/README.md +9 -2
- data/circle.yml +15 -0
- data/integration-test/.gitignore +18 -0
- data/integration-test/.kitchen.yml +22 -0
- data/integration-test/Gemfile +3 -0
- data/integration-test/README.md +4 -0
- data/integration-test/chefignore +95 -0
- data/integration-test/metadata.rb +7 -0
- data/integration-test/recipes/default.rb +9 -0
- data/integration-test/test/integration/default/serverspec/default_spec.rb +10 -0
- data/integration-test/test/integration/default/serverspec/spec_helper.rb +3 -0
- data/lib/kitchen/driver/docker_cli.rb +15 -78
- data/lib/kitchen/driver/docker_cli_version.rb +1 -1
- data/lib/kitchen/transport/docker_cli.rb +86 -0
- data/spec/kitchen/driver/docker_cli_spec.rb +0 -187
- metadata +13 -4
- data/test/integration/default/serverspec/default_spec.rb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c9c4456fdccbcadfaf197bfff4bae971e77223a
|
4
|
+
data.tar.gz: 1b87bccb3bbacd66150b6a0e0422777bad742af3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98f996d40938f78ccd4698204874f0f6781764b850ed5919a5e5ea53e9d6016494abe17aa9ee7ab47de5c8c4e57158da63963e41d9b1e5c68df985c6d9417947
|
7
|
+
data.tar.gz: 02c9683adb5a47fee7463391d45edc7200e2900852764dc44292aab47be4689a349a8feba93e93fe320cdc23757ef006832f09e246c82486dd31a7c10e3fb372
|
data/.kitchen.yml
CHANGED
@@ -2,14 +2,17 @@
|
|
2
2
|
driver:
|
3
3
|
name: docker_cli
|
4
4
|
|
5
|
+
transport:
|
6
|
+
name: docker_cli
|
7
|
+
|
5
8
|
driver_config:
|
6
9
|
hostname: example.local
|
7
10
|
|
8
11
|
platforms:
|
9
|
-
- name: ubuntu-12.04
|
10
|
-
- name: ubuntu-14.04
|
12
|
+
# - name: ubuntu-12.04
|
13
|
+
# - name: ubuntu-14.04
|
11
14
|
- name: centos-6.6
|
12
|
-
- name: fedora-20
|
15
|
+
# - name: fedora-20
|
13
16
|
|
14
17
|
suites:
|
15
18
|
- name: default
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,8 @@
|
|
1
|
-
# <a name="title"></a> Kitchen::DockerCli
|
1
|
+
# <a name="title"></a> Kitchen::DockerCli
|
2
|
+
[![Gem Version](https://badge.fury.io/rb/kitchen-docker_cli.svg)](http://badge.fury.io/rb/kitchen-docker_cli)
|
3
|
+
[![Build Status](https://travis-ci.org/marcy-terui/kitchen-docker_cli.svg?branch=master)](https://travis-ci.org/marcy-terui/kitchen-docker_cli) [![Circle CI](https://circleci.com/gh/marcy-terui/kitchen-docker_cli.svg?style=svg)](https://circleci.com/gh/marcy-terui/kitchen-docker_cli)
|
4
|
+
[![Join the chat at https://gitter.im/marcy-terui/kitchen-docker_cli](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/marcy-terui/kitchen-docker_cli?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
5
|
+
|
2
6
|
A Test Kitchen Driver for Docker command line interface.
|
3
7
|
|
4
8
|
This plugin is created with only Docker CLI functions.
|
@@ -35,13 +39,16 @@ bundle install
|
|
35
39
|
|
36
40
|
## <a name="config"></a> Configuration
|
37
41
|
|
38
|
-
At first, put your `.
|
42
|
+
At first, put your `.kitchen(.local).yml` like this.
|
39
43
|
|
40
44
|
```yml
|
41
45
|
---
|
42
46
|
driver:
|
43
47
|
name: docker_cli
|
44
48
|
|
49
|
+
transport:
|
50
|
+
name: docker_cli
|
51
|
+
|
45
52
|
platforms:
|
46
53
|
- name: ubuntu-12.04
|
47
54
|
- name: centos-6.4
|
data/circle.yml
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
---
|
2
|
+
driver:
|
3
|
+
name: docker_cli
|
4
|
+
|
5
|
+
transport:
|
6
|
+
name: docker_cli
|
7
|
+
|
8
|
+
driver_config:
|
9
|
+
hostname: example.local
|
10
|
+
|
11
|
+
provisioner:
|
12
|
+
name: chef_zero
|
13
|
+
|
14
|
+
platforms:
|
15
|
+
- name: ubuntu-12.04
|
16
|
+
- name: centos-6.4
|
17
|
+
|
18
|
+
suites:
|
19
|
+
- name: default
|
20
|
+
run_list:
|
21
|
+
- recipe[integration-test::default]
|
22
|
+
attributes:
|
@@ -0,0 +1,95 @@
|
|
1
|
+
# Put files/directories that should be ignored in this file when uploading
|
2
|
+
# or sharing to the community site.
|
3
|
+
# Lines that start with '# ' are comments.
|
4
|
+
|
5
|
+
# OS generated files #
|
6
|
+
######################
|
7
|
+
.DS_Store
|
8
|
+
Icon?
|
9
|
+
nohup.out
|
10
|
+
ehthumbs.db
|
11
|
+
Thumbs.db
|
12
|
+
|
13
|
+
# SASS #
|
14
|
+
########
|
15
|
+
.sass-cache
|
16
|
+
|
17
|
+
# EDITORS #
|
18
|
+
###########
|
19
|
+
\#*
|
20
|
+
.#*
|
21
|
+
*~
|
22
|
+
*.sw[a-z]
|
23
|
+
*.bak
|
24
|
+
REVISION
|
25
|
+
TAGS*
|
26
|
+
tmtags
|
27
|
+
*_flymake.*
|
28
|
+
*_flymake
|
29
|
+
*.tmproj
|
30
|
+
.project
|
31
|
+
.settings
|
32
|
+
mkmf.log
|
33
|
+
|
34
|
+
## COMPILED ##
|
35
|
+
##############
|
36
|
+
a.out
|
37
|
+
*.o
|
38
|
+
*.pyc
|
39
|
+
*.so
|
40
|
+
*.com
|
41
|
+
*.class
|
42
|
+
*.dll
|
43
|
+
*.exe
|
44
|
+
*/rdoc/
|
45
|
+
|
46
|
+
# Testing #
|
47
|
+
###########
|
48
|
+
.watchr
|
49
|
+
.rspec
|
50
|
+
spec/*
|
51
|
+
spec/fixtures/*
|
52
|
+
test/*
|
53
|
+
features/*
|
54
|
+
Guardfile
|
55
|
+
Procfile
|
56
|
+
|
57
|
+
# SCM #
|
58
|
+
#######
|
59
|
+
.git
|
60
|
+
*/.git
|
61
|
+
.gitignore
|
62
|
+
.gitmodules
|
63
|
+
.gitconfig
|
64
|
+
.gitattributes
|
65
|
+
.svn
|
66
|
+
*/.bzr/*
|
67
|
+
*/.hg/*
|
68
|
+
*/.svn/*
|
69
|
+
|
70
|
+
# Berkshelf #
|
71
|
+
#############
|
72
|
+
Berksfile
|
73
|
+
Berksfile.lock
|
74
|
+
cookbooks/*
|
75
|
+
tmp
|
76
|
+
|
77
|
+
# Cookbooks #
|
78
|
+
#############
|
79
|
+
CONTRIBUTING
|
80
|
+
|
81
|
+
# Strainer #
|
82
|
+
############
|
83
|
+
Colanderfile
|
84
|
+
Strainerfile
|
85
|
+
.colander
|
86
|
+
.strainer
|
87
|
+
|
88
|
+
# Vagrant #
|
89
|
+
###########
|
90
|
+
.vagrant
|
91
|
+
Vagrantfile
|
92
|
+
|
93
|
+
# Travis #
|
94
|
+
##########
|
95
|
+
.travis.yml
|
@@ -31,6 +31,7 @@ module Kitchen
|
|
31
31
|
default_config :command, 'sh -c \'while true; do sleep 1d; done;\''
|
32
32
|
default_config :privileged, false
|
33
33
|
default_config :instance_host_name, false
|
34
|
+
default_config :transport, "docker_cli"
|
34
35
|
|
35
36
|
default_config :image do |driver|
|
36
37
|
driver.default_image
|
@@ -53,72 +54,32 @@ module Kitchen
|
|
53
54
|
end
|
54
55
|
|
55
56
|
def create(state)
|
56
|
-
state[:image] = build unless state[:image]
|
57
|
-
state[:container_id] = run(state
|
57
|
+
state[:image] = build(state) unless state[:image]
|
58
|
+
state[:container_id] = run(state) unless state[:container_id]
|
58
59
|
end
|
59
60
|
|
60
|
-
def
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
execute(docker_exec_command(state[:container_id], provisioner.install_command, :tty => true)) if provisioner.install_command
|
65
|
-
execute(docker_exec_command(state[:container_id], provisioner.init_command, :tty => true)) if provisioner.init_command
|
66
|
-
execute(docker_pre_transfer_command(provisioner, state[:container_id]))
|
67
|
-
run_command(docker_transfer_command(provisioner, state[:container_id]))
|
68
|
-
execute(docker_exec_command(state[:container_id], provisioner.prepare_command, :tty => true)) if provisioner.prepare_command
|
69
|
-
execute(docker_exec_command(state[:container_id], provisioner.run_command, :tty => true)) if provisioner.run_command
|
70
|
-
|
71
|
-
ensure
|
72
|
-
provisioner && provisioner.cleanup_sandbox
|
73
|
-
end
|
74
|
-
|
75
|
-
def setup(state)
|
76
|
-
if busser.setup_cmd
|
77
|
-
execute(docker_exec_command(state[:container_id], busser.setup_cmd, :tty => true))
|
61
|
+
def destroy(state)
|
62
|
+
instance.transport.connection(state) do |conn|
|
63
|
+
conn.run_docker("rm -f #{state[:container_id]}") rescue false
|
78
64
|
end
|
79
65
|
end
|
80
66
|
|
81
|
-
def
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
if busser.run_cmd
|
86
|
-
execute(docker_exec_command(state[:container_id], busser.run_cmd, :tty => true))
|
67
|
+
def build(state)
|
68
|
+
output = ""
|
69
|
+
instance.transport.connection(state) do |conn|
|
70
|
+
output = conn.run_docker(docker_build_command, :input => docker_file)
|
87
71
|
end
|
88
|
-
end
|
89
|
-
|
90
|
-
def destroy(state)
|
91
|
-
execute("rm -f #{state[:container_id]}") rescue false
|
92
|
-
end
|
93
|
-
|
94
|
-
def remote_command(state, cmd)
|
95
|
-
execute(docker_exec_command(state[:container_id], cmd))
|
96
|
-
end
|
97
|
-
|
98
|
-
def login_command(state)
|
99
|
-
args = []
|
100
|
-
args << 'exec'
|
101
|
-
args << '-t'
|
102
|
-
args << '-i'
|
103
|
-
args << state[:container_id]
|
104
|
-
args << '/bin/bash'
|
105
|
-
LoginCommand.new(['docker', *args])
|
106
|
-
end
|
107
|
-
|
108
|
-
def build
|
109
|
-
output = execute(docker_build_command, :input => docker_file)
|
110
72
|
parse_image_id(output)
|
111
73
|
end
|
112
74
|
|
113
|
-
def run(
|
114
|
-
output =
|
75
|
+
def run(state)
|
76
|
+
output = ""
|
77
|
+
instance.transport.connection(state) do |conn|
|
78
|
+
output = conn.run_docker(docker_run_command(state[:image]))
|
79
|
+
end
|
115
80
|
parse_container_id(output)
|
116
81
|
end
|
117
82
|
|
118
|
-
def docker_command(cmd)
|
119
|
-
"docker #{cmd}"
|
120
|
-
end
|
121
|
-
|
122
83
|
def docker_build_command
|
123
84
|
cmd = 'build'
|
124
85
|
cmd << ' --no-cache' if config[:no_cache]
|
@@ -144,26 +105,6 @@ module Kitchen
|
|
144
105
|
cmd << " #{image} #{config[:command]}"
|
145
106
|
end
|
146
107
|
|
147
|
-
def docker_exec_command(container_id, cmd, opt = {})
|
148
|
-
exec_cmd = "exec"
|
149
|
-
exec_cmd << " -t" if opt[:tty]
|
150
|
-
exec_cmd << " -i" if opt[:interactive]
|
151
|
-
# exec_cmd << " <<-EOH\n#{cmd}\nEOH"
|
152
|
-
exec_cmd << " #{container_id} #{cmd}"
|
153
|
-
end
|
154
|
-
|
155
|
-
def docker_pre_transfer_command(provisioner, container_id)
|
156
|
-
cmd = "mkdir -p #{provisioner[:root_path]}"
|
157
|
-
cmd << " && rm -rf #{provisioner[:root_path]}/*"
|
158
|
-
docker_exec_command(container_id, cmd)
|
159
|
-
end
|
160
|
-
|
161
|
-
def docker_transfer_command(provisioner, container_id)
|
162
|
-
remote_cmd = "tar x -C #{provisioner[:root_path]}"
|
163
|
-
local_cmd = "cd #{provisioner.sandbox_path} && tar cf - ./"
|
164
|
-
"#{local_cmd} | #{docker_command(docker_exec_command(container_id, remote_cmd, :interactive => true))}"
|
165
|
-
end
|
166
|
-
|
167
108
|
def parse_image_id(output)
|
168
109
|
unless output.chomp.match(/Successfully built ([0-9a-z]{12})$/)
|
169
110
|
raise ActionFailed, 'Could not parse IMAGE ID.'
|
@@ -199,10 +140,6 @@ module Kitchen
|
|
199
140
|
end
|
200
141
|
end
|
201
142
|
|
202
|
-
def execute(cmd, opts = {})
|
203
|
-
run_command(docker_command(cmd), opts)
|
204
|
-
end
|
205
|
-
|
206
143
|
|
207
144
|
end
|
208
145
|
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# Author:: Masashi Terui (<marcy9114@gmail.com>)
|
4
|
+
#
|
5
|
+
# Copyright (C) 2015, Masashi Terui
|
6
|
+
#
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
# See the License for the specific language governing permissions and
|
17
|
+
# limitations under the License.
|
18
|
+
|
19
|
+
require "kitchen"
|
20
|
+
require 'thor/util'
|
21
|
+
|
22
|
+
module Kitchen
|
23
|
+
module Transport
|
24
|
+
class DockerCli < Kitchen::Transport::Base
|
25
|
+
|
26
|
+
class DockerCliFailed < TransportFailed; end
|
27
|
+
|
28
|
+
kitchen_transport_api_version 1
|
29
|
+
plugin_version Kitchen::VERSION
|
30
|
+
|
31
|
+
default_config :host, nil
|
32
|
+
|
33
|
+
def connection(state, &block)
|
34
|
+
options = config.to_hash.merge(state)
|
35
|
+
@connection = Kitchen::Transport::DockerCli::Connection.new(options, &block)
|
36
|
+
end
|
37
|
+
|
38
|
+
class Connection < Kitchen::Transport::DockerCli::Connection
|
39
|
+
|
40
|
+
include ShellOut
|
41
|
+
|
42
|
+
def login_command
|
43
|
+
args = []
|
44
|
+
args << 'exec'
|
45
|
+
args << '-t'
|
46
|
+
args << '-i'
|
47
|
+
args << @options[:container_id]
|
48
|
+
args << '/bin/bash'
|
49
|
+
LoginCommand.new(binary, args)
|
50
|
+
end
|
51
|
+
|
52
|
+
def execute(command)
|
53
|
+
exec_cmd = docker_exec_command(@options[:container_id], command, :tty => true)
|
54
|
+
run_docker(exec_cmd) if command
|
55
|
+
end
|
56
|
+
|
57
|
+
def run_docker(command, options={})
|
58
|
+
run_command("#{binary} #{command}", options)
|
59
|
+
end
|
60
|
+
|
61
|
+
def upload(locals, remote)
|
62
|
+
cmd = "mkdir -p #{remote} && rm -rf #{remote}/*"
|
63
|
+
execute(cmd)
|
64
|
+
Array(locals).each do |local|
|
65
|
+
remote_cmd = "tar x -C #{remote}"
|
66
|
+
remote_cmd = "#{binary} #{docker_exec_command(@options[:container_id], remote_cmd, :interactive => true)}"
|
67
|
+
local_cmd = "cd #{File.dirname(local)} && tar cf - ./#{File.basename(local)}"
|
68
|
+
run_command("#{local_cmd} | #{remote_cmd}")
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def docker_exec_command(container_id, cmd, opt = {})
|
73
|
+
exec_cmd = "exec"
|
74
|
+
exec_cmd << " -t" if opt[:tty]
|
75
|
+
exec_cmd << " -i" if opt[:interactive]
|
76
|
+
exec_cmd << " #{container_id} #{cmd}"
|
77
|
+
end
|
78
|
+
|
79
|
+
def binary
|
80
|
+
"docker"
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
@@ -68,129 +68,6 @@ describe Kitchen::Driver::DockerCli, "create" do
|
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
|
-
describe Kitchen::Driver::DockerCli, "converge" do
|
72
|
-
|
73
|
-
before do
|
74
|
-
@docker_cli = Kitchen::Driver::DockerCli.new
|
75
|
-
provisioner = double('provisioner')
|
76
|
-
instance = double('instance')
|
77
|
-
provisioner.stub(:create_sandbox)
|
78
|
-
provisioner.stub(:install_command)
|
79
|
-
provisioner.stub(:init_command)
|
80
|
-
provisioner.stub(:prepare_command)
|
81
|
-
provisioner.stub(:run_command)
|
82
|
-
provisioner.stub(:cleanup_sandbox)
|
83
|
-
instance.stub(:provisioner).and_return(provisioner)
|
84
|
-
@docker_cli.stub(:instance).and_return(instance)
|
85
|
-
@docker_cli.stub(:docker_transfer_command)
|
86
|
-
@docker_cli.stub(:docker_pre_transfer_command)
|
87
|
-
@docker_cli.stub(:execute)
|
88
|
-
@docker_cli.stub(:run_command)
|
89
|
-
end
|
90
|
-
|
91
|
-
example do
|
92
|
-
expect { @docker_cli.converge(:container_id => 'abc') }.not_to raise_error
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
describe Kitchen::Driver::DockerCli, "setup" do
|
97
|
-
|
98
|
-
before do
|
99
|
-
@docker_cli = Kitchen::Driver::DockerCli.new
|
100
|
-
busser = double('busser')
|
101
|
-
busser.stub(:setup_cmd).and_return('setup')
|
102
|
-
@docker_cli.stub(:busser).and_return(busser)
|
103
|
-
@docker_cli.stub(:execute)
|
104
|
-
end
|
105
|
-
|
106
|
-
example do
|
107
|
-
expect{ @docker_cli.setup(:container_id => 'abc') }.not_to raise_error
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
describe Kitchen::Driver::DockerCli, "verify" do
|
112
|
-
|
113
|
-
before do
|
114
|
-
@docker_cli = Kitchen::Driver::DockerCli.new
|
115
|
-
busser = double('busser')
|
116
|
-
busser.stub(:sync_cmd).and_return('setup')
|
117
|
-
busser.stub(:run_cmd).and_return('setup')
|
118
|
-
@docker_cli.stub(:busser).and_return(busser)
|
119
|
-
@docker_cli.stub(:execute)
|
120
|
-
end
|
121
|
-
|
122
|
-
example do
|
123
|
-
expect{ @docker_cli.verify(:container_id => 'abc') }.not_to raise_error
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
|
-
describe Kitchen::Driver::DockerCli, "destroy" do
|
128
|
-
|
129
|
-
before do
|
130
|
-
@docker_cli = Kitchen::Driver::DockerCli.new
|
131
|
-
end
|
132
|
-
|
133
|
-
example do
|
134
|
-
expect{ @docker_cli.destroy(:container_id => 'abc') }.not_to raise_error
|
135
|
-
end
|
136
|
-
end
|
137
|
-
|
138
|
-
describe Kitchen::Driver::DockerCli, "remote_command" do
|
139
|
-
|
140
|
-
before do
|
141
|
-
@docker_cli = Kitchen::Driver::DockerCli.new
|
142
|
-
@docker_cli.stub(:execute)
|
143
|
-
end
|
144
|
-
|
145
|
-
example do
|
146
|
-
opt = {:container_id => 'abc'}
|
147
|
-
expect{ @docker_cli.remote_command(opt, "test") }.not_to raise_error
|
148
|
-
end
|
149
|
-
end
|
150
|
-
|
151
|
-
describe Kitchen::Driver::DockerCli, "login_command" do
|
152
|
-
|
153
|
-
before do
|
154
|
-
@docker_cli = Kitchen::Driver::DockerCli.new()
|
155
|
-
end
|
156
|
-
|
157
|
-
example do
|
158
|
-
login_command = @docker_cli.login_command(:container_id => 'abc')
|
159
|
-
cmd, *args = login_command.cmd_array
|
160
|
-
cmd = "#{cmd} #{args.join(" ")}"
|
161
|
-
expect(cmd).to eq "docker exec -t -i abc /bin/bash"
|
162
|
-
end
|
163
|
-
end
|
164
|
-
|
165
|
-
describe Kitchen::Driver::DockerCli, "build" do
|
166
|
-
|
167
|
-
before do
|
168
|
-
@docker_cli = Kitchen::Driver::DockerCli.new
|
169
|
-
@docker_cli.stub(:docker_build_command)
|
170
|
-
@docker_cli.stub(:docker_file)
|
171
|
-
@docker_cli.stub(:parse_image_id)
|
172
|
-
@docker_cli.stub(:execute)
|
173
|
-
end
|
174
|
-
|
175
|
-
example do
|
176
|
-
expect{ @docker_cli.build }.not_to raise_error
|
177
|
-
end
|
178
|
-
end
|
179
|
-
|
180
|
-
describe Kitchen::Driver::DockerCli, "run" do
|
181
|
-
|
182
|
-
before do
|
183
|
-
@docker_cli = Kitchen::Driver::DockerCli.new
|
184
|
-
@docker_cli.stub(:docker_run_command)
|
185
|
-
@docker_cli.stub(:parse_container_id)
|
186
|
-
@docker_cli.stub(:execute)
|
187
|
-
end
|
188
|
-
|
189
|
-
example do
|
190
|
-
expect{ @docker_cli.run('test') }.not_to raise_error
|
191
|
-
end
|
192
|
-
end
|
193
|
-
|
194
71
|
describe Kitchen::Driver::DockerCli, "docker_build_command" do
|
195
72
|
|
196
73
|
before do
|
@@ -232,15 +109,6 @@ describe Kitchen::Driver::DockerCli, "docker_run_command" do
|
|
232
109
|
end
|
233
110
|
end
|
234
111
|
|
235
|
-
context 'instance_host_name' do
|
236
|
-
let(:config) { {:command => '/bin/bash', :instance_host_name => true} }
|
237
|
-
|
238
|
-
example do
|
239
|
-
cmd = "run -d -t -h default-centos-66 test /bin/bash"
|
240
|
-
expect(@docker_cli.docker_run_command('test')).to eq cmd
|
241
|
-
end
|
242
|
-
end
|
243
|
-
|
244
112
|
context 'set configs' do
|
245
113
|
let(:config) do
|
246
114
|
{
|
@@ -353,58 +221,3 @@ describe Kitchen::Driver::DockerCli, "docker_file" do
|
|
353
221
|
end
|
354
222
|
end
|
355
223
|
end
|
356
|
-
|
357
|
-
describe Kitchen::Driver::DockerCli, "docker_command" do
|
358
|
-
|
359
|
-
before do
|
360
|
-
@docker_cli = Kitchen::Driver::DockerCli.new()
|
361
|
-
end
|
362
|
-
|
363
|
-
example do
|
364
|
-
expect(@docker_cli.docker_command('exec')).to eq "docker exec"
|
365
|
-
end
|
366
|
-
end
|
367
|
-
|
368
|
-
describe Kitchen::Driver::DockerCli, "docker_exec_command" do
|
369
|
-
|
370
|
-
before do
|
371
|
-
@docker_cli = Kitchen::Driver::DockerCli.new()
|
372
|
-
end
|
373
|
-
|
374
|
-
example do
|
375
|
-
cmd = 'exec abc /bin/bash'
|
376
|
-
expect(@docker_cli.docker_exec_command('abc','/bin/bash')).to eq cmd
|
377
|
-
end
|
378
|
-
example do
|
379
|
-
cmd = 'exec -t -i abc /bin/bash'
|
380
|
-
opt = {:interactive => true, :tty => true}
|
381
|
-
expect(@docker_cli.docker_exec_command('abc', '/bin/bash', opt)).to eq cmd
|
382
|
-
end
|
383
|
-
end
|
384
|
-
|
385
|
-
describe Kitchen::Driver::DockerCli, "docker_pre_transfer_command" do
|
386
|
-
|
387
|
-
before do
|
388
|
-
@docker_cli = Kitchen::Driver::DockerCli.new()
|
389
|
-
end
|
390
|
-
|
391
|
-
example do
|
392
|
-
provisoner = {:root_path => '/tmp/kitchen'}
|
393
|
-
cmd = "exec abc mkdir -p /tmp/kitchen && rm -rf /tmp/kitchen/*"
|
394
|
-
expect(@docker_cli.docker_pre_transfer_command(provisoner, 'abc')).to eq cmd
|
395
|
-
end
|
396
|
-
end
|
397
|
-
|
398
|
-
describe Kitchen::Driver::DockerCli, "docker_transfer_command" do
|
399
|
-
|
400
|
-
before do
|
401
|
-
@docker_cli = Kitchen::Driver::DockerCli.new()
|
402
|
-
end
|
403
|
-
|
404
|
-
example do
|
405
|
-
provisoner = {:root_path => '/tmp/kitchen'}
|
406
|
-
provisoner.stub(:sandbox_path).and_return('/tmp/sandbox')
|
407
|
-
cmd = "cd /tmp/sandbox && tar cf - ./ | docker exec -i abc tar x -C /tmp/kitchen"
|
408
|
-
expect(@docker_cli.docker_transfer_command(provisoner, 'abc')).to eq cmd
|
409
|
-
end
|
410
|
-
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kitchen-docker_cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masashi Terui
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: test-kitchen
|
@@ -110,12 +110,22 @@ files:
|
|
110
110
|
- LICENSE
|
111
111
|
- README.md
|
112
112
|
- Rakefile
|
113
|
+
- circle.yml
|
114
|
+
- integration-test/.gitignore
|
115
|
+
- integration-test/.kitchen.yml
|
116
|
+
- integration-test/Gemfile
|
117
|
+
- integration-test/README.md
|
118
|
+
- integration-test/chefignore
|
119
|
+
- integration-test/metadata.rb
|
120
|
+
- integration-test/recipes/default.rb
|
121
|
+
- integration-test/test/integration/default/serverspec/default_spec.rb
|
122
|
+
- integration-test/test/integration/default/serverspec/spec_helper.rb
|
113
123
|
- kitchen-docker_cli.gemspec
|
114
124
|
- lib/kitchen/driver/docker_cli.rb
|
115
125
|
- lib/kitchen/driver/docker_cli_version.rb
|
126
|
+
- lib/kitchen/transport/docker_cli.rb
|
116
127
|
- spec/kitchen/driver/docker_cli_spec.rb
|
117
128
|
- spec/spec_helper.rb
|
118
|
-
- test/integration/default/serverspec/default_spec.rb
|
119
129
|
homepage: https://github.com/marcy-terui/kitchen-docker_cli
|
120
130
|
licenses:
|
121
131
|
- Apache 2.0
|
@@ -143,4 +153,3 @@ summary: A Test Kitchen Driver for Docker native CLI
|
|
143
153
|
test_files:
|
144
154
|
- spec/kitchen/driver/docker_cli_spec.rb
|
145
155
|
- spec/spec_helper.rb
|
146
|
-
- test/integration/default/serverspec/default_spec.rb
|