kitchen-docker_cli 0.7.1 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 578fd12a2895cf8cce53b02cc1dffb35f6e43e87
4
- data.tar.gz: 03d454b75385391c889b8db2e815704672f68892
3
+ metadata.gz: 67692c61b4cd109d6454fa31f8d25e28f70bc901
4
+ data.tar.gz: 19e7c9629cafc3a90ee405ca1d4167f692fde894
5
5
  SHA512:
6
- metadata.gz: d6ede05041d8b80d95653ff24e401c031b5b5aa24206dffeedb6b64d4fe584aa07669eea4ebd93b155d5e899b4b4f8ec81f1a0089a1ba81b75504de53e1b19d7
7
- data.tar.gz: a3eaded6a5e0cf8a1d007bef4110622c574580b1e241b1623c4520fd24c4909b69de28debefc3ad084cae92b6da31b49dad9f7850ca6378c143f4aa99be6342c
6
+ metadata.gz: 6dfe3bd361b618bb3579d11a909ce37b208a3d29c35a63a19e4bbb6b4e0c24d516acddff8415190fa74d91f74654ecba5ba313b25b163f69b74b9900272b1e6a
7
+ data.tar.gz: e5e58fd795a5416547c295de30e032642aa81aa72bf32d59ad772d18c779ddc19686add4b05f15ab70da1ce626870339c980fd4bf930a609522f53935c9dc5c6
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.8.0
2
+
3
+ * Add `instance_host_name` option
4
+
1
5
  ## 0.7.1
2
6
 
3
7
  * Fix error on `fedora`
data/README.md CHANGED
@@ -174,6 +174,17 @@ Examples:
174
174
  hostname: example.local
175
175
  ```
176
176
 
177
+ ### instance_host_name
178
+ Use instance name to hostname.
179
+
180
+ The default value is `false`.
181
+
182
+ Examples:
183
+
184
+ ```yml
185
+ instance_host_name: true
186
+ ```
187
+
177
188
  ### link
178
189
 
179
190
  Set `container_name`(and alias) of other container(s) that connect from the suite container.
@@ -30,6 +30,7 @@ module Kitchen
30
30
  default_config :no_cache, false
31
31
  default_config :command, 'sh -c \'while true; do sleep 1d; done;\''
32
32
  default_config :privileged, false
33
+ default_config :instance_host_name, false
33
34
 
34
35
  default_config :image do |driver|
35
36
  driver.default_image
@@ -132,7 +133,11 @@ module Kitchen
132
133
  cmd << " -c #{config[:cpu_shares]}" if config[:cpu_shares]
133
134
  cmd << ' --privileged' if config[:privileged]
134
135
  cmd << " --net #{config[:network]}" if config[:network]
135
- cmd << " -h #{config[:hostname]}" if config[:hostname]
136
+ if config[:hostname]
137
+ cmd << " -h #{config[:hostname]}"
138
+ elsif config[:instance_host_name]
139
+ cmd << " -h #{instance.name}"
140
+ end
136
141
  Array(config[:publish]).each { |pub| cmd << " -p #{pub}" }
137
142
  Array(config[:volume]).each { |vol| cmd << " -v #{vol}" }
138
143
  Array(config[:link]).each { |link| cmd << " --link #{link}" }
@@ -21,6 +21,6 @@ module Kitchen
21
21
  module Driver
22
22
 
23
23
  # Version string for DockerCli Kitchen driver
24
- DOCKER_CLI_VERSION = '0.7.1'
24
+ DOCKER_CLI_VERSION = '0.8.0'
25
25
  end
26
26
  end
@@ -218,6 +218,9 @@ describe Kitchen::Driver::DockerCli, "docker_run_command" do
218
218
 
219
219
  before do
220
220
  @docker_cli = Kitchen::Driver::DockerCli.new(config)
221
+ instance = double('instance')
222
+ instance.stub(:name).and_return("default-centos-66")
223
+ @docker_cli.stub(:instance).and_return(instance)
221
224
  end
222
225
 
223
226
  context 'default' do
@@ -229,6 +232,15 @@ describe Kitchen::Driver::DockerCli, "docker_run_command" do
229
232
  end
230
233
  end
231
234
 
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
+
232
244
  context 'set configs' do
233
245
  let(:config) do
234
246
  {
@@ -242,7 +254,8 @@ describe Kitchen::Driver::DockerCli, "docker_run_command" do
242
254
  :memory_limit => '256m',
243
255
  :cpu_shares => 512,
244
256
  :network => 'none',
245
- :hostname => 'example.local'
257
+ :hostname => 'example.local',
258
+ :instance_host_name => true
246
259
  }
247
260
  end
248
261
 
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.7.1
4
+ version: 0.8.0
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-03-02 00:00:00.000000000 Z
11
+ date: 2015-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-kitchen