deltacloud-client 1.0.0 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. data/Rakefile +6 -46
  2. data/lib/base_object.rb +1 -1
  3. data/lib/client_bucket_methods.rb +2 -2
  4. data/lib/deltacloud.rb +8 -7
  5. metadata +81 -127
  6. data/bin/deltacloudc +0 -243
  7. data/lib/plain_formatter.rb +0 -145
  8. data/specs/buckets_spec.rb +0 -148
  9. data/specs/content_spec.rb +0 -137
  10. data/specs/data/images/img1.yml +0 -4
  11. data/specs/data/images/img2.yml +0 -4
  12. data/specs/data/images/img3.yml +0 -4
  13. data/specs/data/instances/inst0.yml +0 -16
  14. data/specs/data/instances/inst1.yml +0 -9
  15. data/specs/data/instances/inst2.yml +0 -9
  16. data/specs/data/storage_snapshots/snap1.yml +0 -4
  17. data/specs/data/storage_snapshots/snap2.yml +0 -4
  18. data/specs/data/storage_snapshots/snap3.yml +0 -4
  19. data/specs/data/storage_volumes/vol1.yml +0 -7
  20. data/specs/data/storage_volumes/vol2.yml +0 -7
  21. data/specs/data/storage_volumes/vol3.yml +0 -7
  22. data/specs/errors_spec.rb +0 -59
  23. data/specs/fixtures/images/img1.yml +0 -4
  24. data/specs/fixtures/images/img2.yml +0 -4
  25. data/specs/fixtures/images/img3.yml +0 -4
  26. data/specs/fixtures/instances/inst0.yml +0 -16
  27. data/specs/fixtures/instances/inst1.yml +0 -9
  28. data/specs/fixtures/instances/inst2.yml +0 -9
  29. data/specs/fixtures/storage_snapshots/snap1.yml +0 -4
  30. data/specs/fixtures/storage_snapshots/snap2.yml +0 -4
  31. data/specs/fixtures/storage_snapshots/snap3.yml +0 -4
  32. data/specs/fixtures/storage_volumes/vol1.yml +0 -7
  33. data/specs/fixtures/storage_volumes/vol2.yml +0 -7
  34. data/specs/fixtures/storage_volumes/vol3.yml +0 -7
  35. data/specs/hardware_profiles_spec.rb +0 -80
  36. data/specs/images_spec.rb +0 -107
  37. data/specs/initialization_spec.rb +0 -64
  38. data/specs/instance_states_spec.rb +0 -80
  39. data/specs/instances_spec.rb +0 -210
  40. data/specs/keys_spec.rb +0 -97
  41. data/specs/realms_spec.rb +0 -66
  42. data/specs/shared/resources.rb +0 -30
  43. data/specs/spec_helper.rb +0 -53
  44. data/specs/storage_snapshot_spec.rb +0 -81
  45. data/specs/storage_volume_spec.rb +0 -91
@@ -1,145 +0,0 @@
1
- # Licensed to the Apache Software Foundation (ASF) under one or more
2
- # contributor license agreements. See the NOTICE file distributed with
3
- # this work for additional information regarding copyright ownership. The
4
- # ASF licenses this file to you under the Apache License, Version 2.0 (the
5
- # "License"); you may not use this file except in compliance with the
6
- # License. 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, WITHOUT
12
- # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
- # License for the specific language governing permissions and limitations
14
- # under the License.
15
-
16
- module DeltaCloud
17
- module PlainFormatter
18
- module FormatObject
19
-
20
- class Base
21
- def initialize(obj)
22
- @obj = obj
23
- end
24
- end
25
-
26
- class Key < Base
27
- def format
28
- sprintf("%-10s | %-60s",
29
- @obj.id[0,10],
30
- @obj.fingerprint
31
- )
32
- end
33
- end
34
-
35
- class Image < Base
36
- def format
37
- sprintf("%-10s | %-20s | %-6s | %-20s | %15s",
38
- @obj.id[0,10],
39
- @obj.name ? @obj.name[0, 20]: 'unknown',
40
- @obj.architecture[0,6],
41
- @obj.description[0,20],
42
- @obj.owner_id[0,15]
43
- )
44
- end
45
- end
46
-
47
- class Realm < Base
48
- def format
49
- sprintf("%-10s | %-15s | %-5s | %10s GB",
50
- @obj.id[0, 10],
51
- @obj.name[0, 15],
52
- @obj.state[0,5],
53
- @obj.limit.to_s[0,10]
54
- )
55
- end
56
- end
57
-
58
- class HardwareProfile < Base
59
- def format
60
- architecture = @obj.architecture ? @obj.architecture.value[0,6] : 'opaque'
61
- memory = @obj.memory ? @obj.memory.value.to_s[0,10] : 'opaque'
62
- storage = @obj.storage ? @obj.storage.value.to_s[0,10] : 'opaque'
63
- sprintf("%-15s | %-6s | %10s | %10s ", @obj.id[0, 15],
64
- architecture , memory, storage)
65
- end
66
- end
67
-
68
- class Instance < Base
69
- def format
70
- sprintf("%-15s | %-15s | %-15s | %10s | %32s | %32s",
71
- @obj.id ? @obj.id.to_s[0,15] : '-',
72
- @obj.name ? @obj.name.to_s[0,15] : 'unknown',
73
- @obj.image.name ? @obj.image.name.to_s[0,15] : 'unknown',
74
- @obj.state ? @obj.state.to_s[0,10] : 'unknown',
75
- @obj.public_addresses.collect { |a| a[:address] }.join(',')[0,32],
76
- @obj.private_addresses.collect { |a| a[:address] }.join(',')[0,32]
77
- )
78
- end
79
- end
80
-
81
- class StorageVolume < Base
82
- def format
83
- sprintf("%-10s | %15s GB | %-10s | %-10s | %-15s",
84
- @obj.id[0,10],
85
- @obj.capacity ? @obj.capacity.to_s[0,15] : 'unknown',
86
- @obj.device ? @obj.device[0,10] : 'unknown',
87
- @obj.respond_to?('state') ? @obj.state[0,10] : 'unknown',
88
- @obj.instance ? @obj.instance.name[0,15] : 'unknown'
89
- )
90
- end
91
- end
92
-
93
- class StorageSnapshot < Base
94
- def format
95
- sprintf("%-10s | %-15s | %-6s | %15s",
96
- @obj.id[0,10],
97
- @obj.storage_volume.respond_to?('name') ? @obj.storage_volume.name[0, 15] : 'unknown',
98
- @obj.state ? @obj.state[0,10] : 'unknown',
99
- @obj.created ? @obj.created[0,19] : 'unknown'
100
- )
101
- end
102
- end
103
-
104
- class Bucket < Base
105
- def format
106
- sprintf("%-s | %-s | %-s | %-s",
107
- @obj.id,
108
- @obj.name,
109
- @obj.size ? @obj.size : "0",
110
- @obj.instance_variables.include?("@blob_list") ? @obj.blob_list : ""
111
- )
112
- end
113
- end
114
-
115
- class Blob < Base
116
- def format
117
- sprintf("%-s | %-s | %-d | %-s | %-s | %-s " ,
118
- @obj.id,
119
- @obj.bucket,
120
- @obj.content_length,
121
- @obj.content_type,
122
- @obj.last_modified,
123
- @obj.user_metadata
124
- )
125
- end
126
- end
127
-
128
- class Driver < Base
129
- def format
130
- sprintf("%-15s | %-15s | %-s",
131
- @obj.id,
132
- @obj.name,
133
- @obj.url)
134
- end
135
- end
136
- end
137
-
138
- def format(obj)
139
- object_name = obj.class.name.classify.gsub(/^DeltaCloud::API::(\w+)::/, '')
140
- format_class = DeltaCloud::PlainFormatter::FormatObject.const_get(object_name)
141
- format_class.new(obj).format
142
- end
143
-
144
- end
145
- end
@@ -1,148 +0,0 @@
1
- #
2
- # Copyright (C) 2009-2011 Red Hat, Inc.
3
- #
4
- # Licensed to the Apache Software Foundation (ASF) under one or more
5
- # contributor license agreements. See the NOTICE file distributed with
6
- # this work for additional information regarding copyright ownership. The
7
- # ASF licenses this file to you under the Apache License, Version 2.0 (the
8
- # "License"); you may not use this file except in compliance with the
9
- # License. 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, WITHOUT
15
- # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16
- # License for the specific language governing permissions and limitations
17
- # under the License.
18
-
19
- require 'specs/spec_helper'
20
-
21
- describe "buckets" do
22
-
23
- it_should_behave_like "all resources"
24
-
25
- it "should allow retrieval of all buckets" do
26
- [API_URL, API_URL_REDIRECT].each do |entry_point|
27
- DeltaCloud.new( API_NAME, API_PASSWORD, entry_point ) do |client|
28
- buckets = client.buckets
29
- buckets.should_not be_empty
30
- buckets.each do |bucket|
31
- bucket.uri.should_not be_nil
32
- bucket.uri.should be_a( String )
33
- bucket.name.should_not be_nil
34
- bucket.name.should be_a(String)
35
- end
36
- end
37
- end
38
- end
39
-
40
- it "should allow retrieval of a named bucket" do
41
- DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
42
- bucket = client.bucket("bucket1")
43
- bucket.should_not be_nil
44
- bucket.uri.should eql(API_URL + "/buckets/bucket1")
45
- bucket.size.should eql(3.0)
46
- bucket.name.should_not be_nil
47
- bucket.name.should be_a(String)
48
- blob_list = bucket.blob_list.split(", ")
49
- blob_list.size.should eql(bucket.size.to_i)
50
- end
51
- end
52
-
53
- end
54
-
55
- describe "Operations on buckets" do
56
-
57
- it "should allow creation of a new bucket" do
58
- DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
59
- new_bucket = client.create_bucket({'id' => "my_new_bucket"})
60
- new_bucket.should_not be_nil
61
- new_bucket.uri.should eql(API_URL + "/buckets/my_new_bucket")
62
- new_bucket.name.should_not be_nil
63
- new_bucket.name.should be_a(String)
64
- new_bucket.name.should eql("my_new_bucket")
65
- end
66
- end
67
-
68
- it "should allow deletion of an existing bucket" do
69
- DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
70
- new_bucket = client.bucket("my_new_bucket")
71
- new_bucket.should_not be_nil
72
- new_bucket.name.should eql("my_new_bucket")
73
- lambda{
74
- client.destroy_bucket({'id' => "my_new_bucket"})
75
- }.should_not raise_error
76
- end
77
- end
78
-
79
- it "should throw error if you delete a non existing bucket" do
80
- DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
81
- lambda{
82
- client.destroy_bucket({'id' => "i_dont_exist"})
83
- }.should raise_error
84
- end
85
- end
86
-
87
- end
88
-
89
- describe "Blobs" do
90
-
91
- it "should allow retrieval of a bucket's blobs" do
92
- DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
93
- bucket = client.bucket("bucket1")
94
- bucket.should_not be_nil
95
- blob_list = bucket.blob_list.split(", ")
96
- blob_list.size.should eql(bucket.size.to_i)
97
- blob_list.each do |b_id|
98
- blob = client.blob({"bucket" => bucket.name, :id => b_id})
99
- puts blob.inspect
100
- blob.bucket.should_not be_nil
101
- blob.bucket.should be_a(String)
102
- blob.bucket.should eql(bucket.name)
103
- blob.content_length.should_not be_nil
104
- blob.content_length.should be_a(Float)
105
- blob.content_length.should >= 0
106
- blob_data = client.blob_data({"bucket" => bucket.name, :id => b_id})
107
- blob_data.size.to_f.should == blob.content_length
108
- blob.last_modified.should_not be_nil
109
- end
110
- end
111
- end
112
-
113
- end
114
-
115
- describe "Operations on blobs" do
116
-
117
- it "should successfully create a new blob" do
118
- DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
119
- blob_data = File.new("./blob_data_file", "w+")
120
-
121
- blob_data.write("this is some blob data \n")
122
- blob_data.rewind
123
- some_new_blob = client.create_blob({:id => "some_new_blob",
124
- 'bucket' => "bucket1",
125
- 'file_path' => blob_data.path})
126
- some_new_blob.should_not be_nil
127
- some_new_blob.content_length.should_not be_nil
128
- some_new_blob.content_length.should eql(24.0)
129
- File.delete(blob_data.path)
130
- end
131
- end
132
-
133
- it "should allow deletion of an existing blob" do
134
- DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
135
- lambda{
136
- client.destroy_blob({:id=>"some_new_blob", 'bucket'=>"bucket1"})
137
- }.should_not raise_error
138
- end
139
- end
140
-
141
- it "should throw error if you delete a non existing blob" do
142
- DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
143
- lambda{
144
- client.destroy_blob({:id=>"no_such_blob", 'bucket'=>"bucket1"})
145
- }.should raise_error
146
- end
147
- end
148
- end
@@ -1,137 +0,0 @@
1
- #
2
- # Copyright (C) 2009-2011 Red Hat, Inc.
3
- #
4
- # Licensed to the Apache Software Foundation (ASF) under one or more
5
- # contributor license agreements. See the NOTICE file distributed with
6
- # this work for additional information regarding copyright ownership. The
7
- # ASF licenses this file to you under the Apache License, Version 2.0 (the
8
- # "License"); you may not use this file except in compliance with the
9
- # License. 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, WITHOUT
15
- # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16
- # License for the specific language governing permissions and limitations
17
- # under the License.
18
-
19
- require 'specs/spec_helper'
20
-
21
- def client
22
- RestClient::Resource.new(API_URL)
23
- end
24
-
25
- def headers(header)
26
- encoded_credentials = ["#{API_NAME}:#{API_PASSWORD}"].pack("m0").gsub(/\n/,'')
27
- { :authorization => "Basic " + encoded_credentials }.merge(header)
28
- end
29
-
30
- describe "return JSON" do
31
-
32
- it 'should return JSON when using application/json, */*' do
33
- header_hash = {
34
- # FIXME: There is a bug in rack-accept that cause to respond with HTML
35
- # to the configuration below.
36
- #
37
- # 'Accept' => "application/json, */*"
38
- 'Accept' => "application/json"
39
- }
40
- client.get(header_hash) do |response, request, &block|
41
- response.code.should == 200
42
- response.headers[:content_type].should =~ /^application\/json/
43
- end
44
- end
45
-
46
- it 'should return JSON when using just application/json' do
47
- header_hash = {
48
- 'Accept' => "application/json"
49
- }
50
- client.get(header_hash) do |response, request, &block|
51
- response.code.should == 200
52
- response.headers[:content_type].should =~ /^application\/json/
53
- end
54
- end
55
-
56
- end
57
-
58
- describe "return HTML in different browsers" do
59
-
60
- it "wants XML using format parameter" do
61
- client.get(:params => { 'format' => 'xml' }, 'Accept' => 'application/xhtml+xml') do |response, request, &block|
62
- response.code.should == 200
63
- response.headers[:content_type].should =~ /^application\/xml/
64
- end
65
- end
66
-
67
- it "raise 406 error on wrong accept" do
68
- client['hardware_profiles'].get('Accept' => 'image/png;q=1') do |response, request, &block|
69
- response.code.should == 406
70
- end
71
- end
72
-
73
- it "wants HTML using format parameter and accept set to XML" do
74
- client.get(:params => { 'format' => 'html'}, 'Accept' => 'application/xml') do |response, request, &block|
75
- response.code.should == 200
76
- response.headers[:content_type].should =~ /^text\/html/
77
- end
78
- end
79
-
80
- # FIXME: This return 406 for some reason on GIT sinatra
81
- # it "wants a PNG image" do
82
- # client['instance_states'].get('Accept' => 'image/png') do |response, request, &block|
83
- # response.code.should == 200
84
- # response.headers[:content_type].should =~ /^image\/png/
85
- # end
86
- # end
87
-
88
- it "doesn't have accept header" do
89
- client.get('Accept' => '') do |response, request, &block|
90
- response.code.should == 200
91
- response.headers[:content_type].should =~ /^application\/xml/
92
- end
93
- end
94
-
95
- it "can handle unknown formats" do
96
- client.get('Accept' => 'format/unknown') do |response, request, &block|
97
- response.code.should == 406
98
- end
99
- end
100
-
101
- it "wants explicitly XML" do
102
- client.get('Accept' => 'application/xml') do |response, request, &block|
103
- response.code.should == 200
104
- response.headers[:content_type].should =~ /^application\/xml/
105
- end
106
- end
107
-
108
- it "Internet Explorer" do
109
- header_hash = {
110
- 'Accept' => "image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, */*",
111
- 'User-agent' => "Mozilla/5.0 (Windows; U; MSIE 9.0; Windows NT 9.0; en-US)"
112
- }
113
- client.get(header_hash) do |response, request, &block|
114
- response.code.should == 200
115
- response.headers[:content_type].should =~ /^text\/html/
116
- end
117
- end
118
-
119
- it "Mozilla Firefox" do
120
- client.get('Accept' => "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8") do |response, request, &block|
121
- response.code.should == 200
122
- response.headers[:content_type].should =~ /^text\/html/
123
- end
124
- end
125
-
126
- it "Opera" do
127
- header_hash = {
128
- 'Accept' => "text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1",
129
- 'User-agent' => "Opera/9.80 (X11; Linux i686; U; ru) Presto/2.8.131 Version/11.11"
130
- }
131
- client.get(header_hash) do |response, request, &block|
132
- response.code.should == 200
133
- response.headers[:content_type].should =~ /^text\/html/
134
- end
135
- end
136
-
137
- end
@@ -1,4 +0,0 @@
1
- :description: Fedora 10
2
- :owner_id: fedoraproject
3
- :architecture: x86_64
4
- :id: img1
@@ -1,4 +0,0 @@
1
- :description: Fedora 10
2
- :owner_id: fedoraproject
3
- :architecture: i386
4
- :id: img2
@@ -1,4 +0,0 @@
1
- :description: JBoss
2
- :owner_id: mockuser
3
- :architecture: i386
4
- :id: img3
@@ -1,16 +0,0 @@
1
- ---
2
- :realm_id: us
3
- :public_addresses:
4
- - img1.inst0.public.com
5
- :state: RUNNING
6
- :name: "Mock Instance With Profile Change"
7
- :private_addresses:
8
- - img1.inst0.private.com
9
- :image_id: img1
10
- :instance_profile: !ruby/object:InstanceProfile
11
- id: m1-large
12
- memory: "12288"
13
- :owner_id: mockuser
14
- :actions:
15
- - :reboot
16
- - :stop
@@ -1,9 +0,0 @@
1
- :name: MockUserInstance
2
- :state: RUNNING
3
- :image_id: img3
4
- :owner_id: mockuser
5
- :public_addresses: [ img3.inst1.public.com ]
6
- :private_addresses: [ img3.inst1.private.com ]
7
- :realm_id: us
8
- :instance_profile: !ruby/object:InstanceProfile
9
- id: m1-small
@@ -1,9 +0,0 @@
1
- :name: AnotherInstance
2
- :state: RUNNING
3
- :image_id: img1
4
- :owner_id: anotheruser
5
- :public_addresses: [ img1.inst2.public.com ]
6
- :private_addresses: [ img1.inst2.private.com ]
7
- :realm_id: us
8
- :instance_profile: !ruby/object:InstanceProfile
9
- id: m1-large
@@ -1,4 +0,0 @@
1
- :owner_id: fedoraproject
2
- :created: Wed Jul 29 18:15:24 UTC 2009
3
- :state: COMPLETED
4
- :storage_volume_id: vol1
@@ -1,4 +0,0 @@
1
- :owner_id: mockuser
2
- :created: Wed Jul 29 18:15:24 UTC 2009
3
- :state: COMPLETED
4
- :storage_volume_id: vol2
@@ -1,4 +0,0 @@
1
- :owner_id: mockuser
2
- :created: Wed Jul 29 18:15:24 UTC 2009
3
- :state: COMPLETED
4
- :storage_volume_id: vol2
@@ -1,7 +0,0 @@
1
- :owner_id: fedoraproject
2
- :created: Thu Jul 30 14:35:11 UTC 2009
3
- :state: AVAILABLE
4
- :capacity: 1
5
- :realm_id: us
6
- :device:
7
- :instance_id:
@@ -1,7 +0,0 @@
1
- :owner_id: mockuser
2
- :created: Thu Jul 30 14:35:11 UTC 2009
3
- :state: AVAILABLE
4
- :capacity: 1
5
- :device:
6
- :realm_id: us
7
- :instance_id:
@@ -1,7 +0,0 @@
1
- :owner_id: mockuser
2
- :created: Thu Jul 30 14:35:11 UTC 2009
3
- :state: IN-USE
4
- :capacity: 1
5
- :realm_id: us
6
- :device: /dev/sda1
7
- :instance_id: inst1
data/specs/errors_spec.rb DELETED
@@ -1,59 +0,0 @@
1
- #
2
- # Copyright (C) 2009-2011 Red Hat, Inc.
3
- #
4
- # Licensed to the Apache Software Foundation (ASF) under one or more
5
- # contributor license agreements. See the NOTICE file distributed with
6
- # this work for additional information regarding copyright ownership. The
7
- # ASF licenses this file to you under the Apache License, Version 2.0 (the
8
- # "License"); you may not use this file except in compliance with the
9
- # License. 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, WITHOUT
15
- # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16
- # License for the specific language governing permissions and limitations
17
- # under the License.
18
-
19
- require 'specs/spec_helper'
20
-
21
- describe "server error handler" do
22
-
23
- it_should_behave_like "all resources"
24
-
25
- it 'should capture HTTP 500 error as DeltacloudError' do
26
- DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
27
- expect { client.realm('500') }.should raise_error(DeltaCloud::HTTPError::DeltacloudError)
28
- end
29
- end
30
-
31
- it 'should capture HTTP 502 error as ProviderError' do
32
- DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
33
- expect { client.realm('502') }.should raise_error(DeltaCloud::HTTPError::ProviderError)
34
- end
35
- end
36
-
37
- it 'should capture HTTP 501 error as NotImplemented' do
38
- DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
39
- expect { client.realm('501') }.should raise_error(DeltaCloud::HTTPError::NotImplemented)
40
- end
41
- end
42
-
43
- it 'should capture HTTP 504 error as ProviderTimeout' do
44
- DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
45
- expect { client.realm('504') }.should raise_error(DeltaCloud::HTTPError::ProviderTimeout)
46
- end
47
- end
48
-
49
- end
50
-
51
- describe "client error handler" do
52
-
53
- it 'should capture HTTP 404 error as NotFound' do
54
- DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
55
- expect { client.realm('non-existing-realm') }.should raise_error(DeltaCloud::HTTPError::NotFound)
56
- end
57
- end
58
-
59
- end
@@ -1,4 +0,0 @@
1
- :description: Fedora 10
2
- :owner_id: fedoraproject
3
- :architecture: x86_64
4
- :id: img1
@@ -1,4 +0,0 @@
1
- :description: Fedora 10
2
- :owner_id: fedoraproject
3
- :architecture: i386
4
- :id: img2
@@ -1,4 +0,0 @@
1
- :description: JBoss
2
- :owner_id: mockuser
3
- :architecture: i386
4
- :id: img3
@@ -1,16 +0,0 @@
1
- ---
2
- :realm_id: us
3
- :public_addresses:
4
- - img1.inst0.public.com
5
- :state: RUNNING
6
- :name: "Mock Instance With Profile Change"
7
- :private_addresses:
8
- - img1.inst0.private.com
9
- :image_id: img1
10
- :instance_profile: !ruby/object:InstanceProfile
11
- id: m1-large
12
- memory: "12288"
13
- :owner_id: mockuser
14
- :actions:
15
- - :reboot
16
- - :stop
@@ -1,9 +0,0 @@
1
- :name: MockUserInstance
2
- :state: RUNNING
3
- :image_id: img3
4
- :owner_id: mockuser
5
- :public_addresses: [ img3.inst1.public.com ]
6
- :private_addresses: [ img3.inst1.private.com ]
7
- :realm_id: us
8
- :instance_profile: !ruby/object:InstanceProfile
9
- id: m1-small
@@ -1,9 +0,0 @@
1
- :name: AnotherInstance
2
- :state: RUNNING
3
- :image_id: img1
4
- :owner_id: anotheruser
5
- :public_addresses: [ img1.inst2.public.com ]
6
- :private_addresses: [ img1.inst2.private.com ]
7
- :realm_id: us
8
- :instance_profile: !ruby/object:InstanceProfile
9
- id: m1-large
@@ -1,4 +0,0 @@
1
- :owner_id: fedoraproject
2
- :created: Wed Jul 29 18:15:24 UTC 2009
3
- :state: COMPLETED
4
- :storage_volume_id: vol1
@@ -1,4 +0,0 @@
1
- :owner_id: mockuser
2
- :created: Wed Jul 29 18:15:24 UTC 2009
3
- :state: COMPLETED
4
- :storage_volume_id: vol2
@@ -1,4 +0,0 @@
1
- :owner_id: mockuser
2
- :created: Wed Jul 29 18:15:24 UTC 2009
3
- :state: COMPLETED
4
- :storage_volume_id: vol2
@@ -1,7 +0,0 @@
1
- :owner_id: fedoraproject
2
- :created: Thu Jul 30 14:35:11 UTC 2009
3
- :state: AVAILABLE
4
- :capacity: 1
5
- :realm_id: us
6
- :device:
7
- :instance_id: