docker-client 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -30,7 +30,9 @@ class Docker::Resource::Container < Docker::Resource::Base
30
30
  # inspect is a Ruby internal method that should not be overwritten
31
31
  # therefore we use show as it displays the container details
32
32
  def show(container_id)
33
- @connection.get("/containers/#{container_id}/json").body_as_json
33
+ response = @connection.get("/containers/#{container_id}/json")
34
+ raise_if_container_not_found(response.status)
35
+ response.body_as_json
34
36
  end
35
37
 
36
38
  def changes(container_id)
@@ -138,4 +140,3 @@ end
138
140
 
139
141
 
140
142
 
141
-
@@ -1,3 +1,3 @@
1
1
  module Docker
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -0,0 +1,27 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://10.0.5.5:4243/containers/invalid_id/json
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 404
13
+ message: Not Found
14
+ headers:
15
+ Content-Type:
16
+ - text/plain; charset=utf-8
17
+ Date:
18
+ - Thu, 13 Jun 2013 18:47:07 GMT
19
+ Transfer-Encoding:
20
+ - chunked
21
+ body:
22
+ encoding: ASCII-8BIT
23
+ string: |
24
+ No such container: invalid_id
25
+ http_version:
26
+ recorded_at: Thu, 13 Jun 2013 18:47:07 GMT
27
+ recorded_with: VCR 2.5.0
@@ -99,6 +99,12 @@ describe Docker::Resource::Container do
99
99
  details.should be_kind_of(Hash)
100
100
  details['Id'].should include(@c)
101
101
  end
102
+
103
+ it "raises an exception for an unknown container" do
104
+ expect {
105
+ subject.show('invalid_id')
106
+ }.to raise_error(Docker::Error::ContainerNotFound)
107
+ end
102
108
  end
103
109
 
104
110
  describe "changes", :vcr do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docker-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
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-06-10 00:00:00.000000000 Z
12
+ date: 2013-06-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -262,6 +262,7 @@ files:
262
262
  - spec/cassettes/Docker_Resource_Container/remove/raises_an_exception_with_an_invalid_container.yml
263
263
  - spec/cassettes/Docker_Resource_Container/restarts/raises_an_exception_for_an_unknown_container.yml
264
264
  - spec/cassettes/Docker_Resource_Container/restarts/the_container.yml
265
+ - spec/cassettes/Docker_Resource_Container/shows/raises_an_exception_for_an_unknown_container.yml
265
266
  - spec/cassettes/Docker_Resource_Container/shows/the_low_level_details.yml
266
267
  - spec/cassettes/Docker_Resource_Container/start/brings_a_container_into_state_running.yml
267
268
  - spec/cassettes/Docker_Resource_Container/start/raises_an_exception_for_an_unknown_container.yml
@@ -364,6 +365,7 @@ test_files:
364
365
  - spec/cassettes/Docker_Resource_Container/remove/raises_an_exception_with_an_invalid_container.yml
365
366
  - spec/cassettes/Docker_Resource_Container/restarts/raises_an_exception_for_an_unknown_container.yml
366
367
  - spec/cassettes/Docker_Resource_Container/restarts/the_container.yml
368
+ - spec/cassettes/Docker_Resource_Container/shows/raises_an_exception_for_an_unknown_container.yml
367
369
  - spec/cassettes/Docker_Resource_Container/shows/the_low_level_details.yml
368
370
  - spec/cassettes/Docker_Resource_Container/start/brings_a_container_into_state_running.yml
369
371
  - spec/cassettes/Docker_Resource_Container/start/raises_an_exception_for_an_unknown_container.yml