kitchen-docker 0.1.3 → 0.2.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.
data/README.md CHANGED
@@ -14,6 +14,24 @@ A Test Kitchen Driver for Docker.
14
14
 
15
15
  Please read the [Driver usage][driver_usage] page for more details.
16
16
 
17
+ Example `.kitchen.local.yml`:
18
+
19
+ ```
20
+ ---
21
+ driver_plugin: docker
22
+
23
+ platforms:
24
+ - name: ubuntu
25
+ run_list:
26
+ - recipe[apt]
27
+ - name: centos
28
+ driver_config:
29
+ image: "centos"
30
+ platform: "rhel"
31
+ run_list:
32
+ - recipe[yum]
33
+ ```
34
+
17
35
  ## <a name="config"></a> Configuration
18
36
 
19
37
  ### <a name="config-image"></a> image
@@ -49,6 +67,23 @@ installed. There are several different behaviors available:
49
67
 
50
68
  The default value is `true`.
51
69
 
70
+ ### <a name="config-forward"></a> forward
71
+
72
+ Suite container port(s) to forward to the host machine. You cannot
73
+ specify the host port in the mappings, Docker does this for you.
74
+
75
+ Examples:
76
+
77
+ ```
78
+ forward: 8080
79
+ ```
80
+
81
+ ```
82
+ forward:
83
+ - 22
84
+ - 80
85
+ ```
86
+
52
87
  ## <a name="development"></a> Development
53
88
 
54
89
  * Source hosted at [GitHub][repo]
@@ -93,7 +93,9 @@ module Kitchen
93
93
 
94
94
  def parse_image_id(output)
95
95
  output.each_line do |line|
96
- return line.split(/\s+/).last if line =~ /image id/i
96
+ if line =~ /image id|build successful|successfully built/i
97
+ return line.split(/\s+/).last
98
+ end
97
99
  end
98
100
  raise ActionFailed,
99
101
  'Could not parse Docker build output for image ID'
@@ -126,8 +128,9 @@ module Kitchen
126
128
 
127
129
  def parse_container_ip(output)
128
130
  begin
129
- info = JSON.parse(output)
130
- info['NetworkSettings']['IpAddress']
131
+ info = Array(JSON.parse(output)).first
132
+ settings = info['NetworkSettings']
133
+ settings['IpAddress'] || settings['IPAddress']
131
134
  rescue
132
135
  raise ActionFailed,
133
136
  'Could not parse Docker inspect output for container IP address'
@@ -147,6 +150,7 @@ module Kitchen
147
150
 
148
151
  def rm_container(state)
149
152
  container_id = state[:container_id]
153
+ run_command("docker stop #{container_id}")
150
154
  run_command("docker rm #{container_id}")
151
155
  end
152
156
 
@@ -21,6 +21,6 @@ module Kitchen
21
21
  module Driver
22
22
 
23
23
  # Version string for Docker Kitchen driver
24
- DOCKER_VERSION = "0.1.3"
24
+ DOCKER_VERSION = "0.2.0"
25
25
  end
26
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-docker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-16 00:00:00.000000000 Z
12
+ date: 2013-06-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  requirement: !ruby/object:Gem::Requirement
@@ -137,7 +137,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
137
137
  requirements:
138
138
  - - ! '>='
139
139
  - !ruby/object:Gem::Version
140
- hash: -3577795496291438005
140
+ hash: 1909028313139145736
141
141
  version: '0'
142
142
  segments:
143
143
  - 0
@@ -146,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
146
146
  requirements:
147
147
  - - ! '>='
148
148
  - !ruby/object:Gem::Version
149
- hash: -3577795496291438005
149
+ hash: 1909028313139145736
150
150
  version: '0'
151
151
  segments:
152
152
  - 0