bbrowning-deltacloud-client 0.0.6.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,77 @@
1
+ #
2
+ # Copyright (C) 2009 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
+
20
+ require 'specs/spec_helper'
21
+
22
+ describe "storage snapshot" do
23
+
24
+ it_should_behave_like "all resources"
25
+
26
+ it "allow retrieval of all storage volumes owned by the current user" do
27
+ client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
28
+ client.connect do |client|
29
+ storage_snapshots = client.storage_snapshots
30
+ storage_snapshots.should_not be_nil
31
+ storage_snapshots.should_not be_empty
32
+ ids = storage_snapshots.collect{|e| e.id}
33
+ ids.size.should eql( 2 )
34
+ ids.should include( 'snap2' )
35
+ ids.should include( 'snap3' )
36
+ end
37
+ end
38
+
39
+ it "should allow fetching of storage volume by id" do
40
+ client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
41
+ client.connect do |client|
42
+ storage_snapshot = client.storage_snapshot( 'snap2' )
43
+ storage_snapshot.should_not be_nil
44
+ storage_snapshot.id.should eql( 'snap2' )
45
+ storage_snapshot.storage_volume.capacity.should eql( 1.0 )
46
+ storage_snapshot.storage_volume.id.should eql( 'vol2' )
47
+ end
48
+ end
49
+
50
+ it "should allow fetching of storage volume by URI" do
51
+ client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
52
+ client.connect do |client|
53
+ storage_snapshot = client.fetch_storage_snapshot( API_URL + '/storage_snapshots/snap2' )
54
+ storage_snapshot.should_not be_nil
55
+ storage_snapshot.id.should eql( 'snap2' )
56
+ storage_snapshot.storage_volume.capacity.should eql( 1.0 )
57
+ storage_snapshot.storage_volume.id.should eql( 'vol2' )
58
+ end
59
+ end
60
+
61
+ it "should return nil for unknown storage volume by ID" do
62
+ client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
63
+ client.connect do |client|
64
+ storage_snapshot = client.storage_snapshot( "bogus" )
65
+ storage_snapshot.should be_nil
66
+ end
67
+ end
68
+
69
+ it "should return nil for unknown storage volume by URI" do
70
+ client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
71
+ client.connect do |client|
72
+ storage_snapshot = client.fetch_storage_snapshot( API_URL + '/storage_snapshots/bogus' )
73
+ storage_snapshot.should be_nil
74
+ end
75
+ end
76
+
77
+ end
@@ -0,0 +1,89 @@
1
+ #
2
+ # Copyright (C) 2009 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
+
20
+ require 'specs/spec_helper'
21
+
22
+ describe "storage volumes" do
23
+
24
+ it_should_behave_like "all resources"
25
+
26
+ it "allow retrieval of all storage volumes owned by the current user" do
27
+ client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
28
+ client.connect do |client|
29
+ storage_volumes = client.storage_volumes
30
+ storage_volumes.should_not be_nil
31
+ storage_volumes.should_not be_empty
32
+ ids = storage_volumes.collect{|e| e.id}
33
+ ids.size.should eql( 2 )
34
+ ids.should include( 'vol2' )
35
+ ids.should include( 'vol3' )
36
+ end
37
+ end
38
+
39
+ it "should allow fetching of storage volume by id" do
40
+ client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
41
+ client.connect do |client|
42
+ storage_volume = client.storage_volume( 'vol3' )
43
+ storage_volume.id.should eql( 'vol3' )
44
+ storage_volume.uri.should eql( API_URL + '/storage_volumes/vol3' )
45
+ storage_volume.state.should eql( 'IN-USE' )
46
+ storage_volume.capacity.should eql( 1.0 )
47
+ storage_volume.device.should eql( '/dev/sda1' )
48
+ storage_volume.instance.should_not be_nil
49
+ storage_volume.instance.id.should eql( 'inst1' )
50
+ ip = storage_volume.instance
51
+ ip.hardware_profile.architecture.value.should eql( 'i386' )
52
+ end
53
+ end
54
+
55
+ it "should allow fetching of storage volume by URI" do
56
+ client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
57
+ client.connect do |client|
58
+ storage_volume = client.fetch_storage_volume( API_URL + '/storage_volumes/vol3' )
59
+ storage_volume.should_not be_nil
60
+ storage_volume.id.should eql( 'vol3' )
61
+ storage_volume.uri.should eql( API_URL + '/storage_volumes/vol3' )
62
+ storage_volume.state.should eql( 'IN-USE' )
63
+ storage_volume.capacity.should eql( 1.0 )
64
+ storage_volume.device.should eql( '/dev/sda1' )
65
+ storage_volume.instance.should_not be_nil
66
+ storage_volume.instance.id.should eql( 'inst1' )
67
+ ip = storage_volume.instance
68
+ ip.hardware_profile.architecture.value.should eql( 'i386' )
69
+ end
70
+ end
71
+
72
+ it "should return nil for unknown storage volume by ID" do
73
+ client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
74
+ client.connect do |client|
75
+ storage_volume = client.storage_volume( 'bogus' )
76
+ storage_volume.should be_nil
77
+ end
78
+ end
79
+
80
+ it "should return nil for unknown storage volume by URI" do
81
+ client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
82
+ client.connect do |client|
83
+ storage_volume = client.fetch_storage_volume( API_URL + '/storage_volumes/bogus' )
84
+ storage_volume.should be_nil
85
+ end
86
+ end
87
+
88
+
89
+ end
metadata ADDED
@@ -0,0 +1,164 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bbrowning-deltacloud-client
3
+ version: !ruby/object:Gem::Version
4
+ hash: 85
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 6
10
+ - 1
11
+ version: 0.0.6.1
12
+ platform: ruby
13
+ authors:
14
+ - Red Hat, Inc.
15
+ autorequire:
16
+ bindir: bin
17
+ cert_chain: []
18
+
19
+ date: 2010-07-25 00:00:00 -04:00
20
+ default_executable: deltacloudc
21
+ dependencies:
22
+ - !ruby/object:Gem::Dependency
23
+ name: rest-client
24
+ prerelease: false
25
+ requirement: &id001 !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ">="
29
+ - !ruby/object:Gem::Version
30
+ hash: 3
31
+ segments:
32
+ - 1
33
+ - 4
34
+ - 2
35
+ version: 1.4.2
36
+ type: :runtime
37
+ version_requirements: *id001
38
+ - !ruby/object:Gem::Dependency
39
+ name: hpricot
40
+ prerelease: false
41
+ requirement: &id002 !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ hash: 59
47
+ segments:
48
+ - 0
49
+ - 8
50
+ - 2
51
+ version: 0.8.2
52
+ type: :runtime
53
+ version_requirements: *id002
54
+ - !ruby/object:Gem::Dependency
55
+ name: rspec
56
+ prerelease: false
57
+ requirement: &id003 !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ hash: 27
63
+ segments:
64
+ - 1
65
+ - 3
66
+ - 0
67
+ version: 1.3.0
68
+ type: :development
69
+ version_requirements: *id003
70
+ description: Deltacloud REST Client for API
71
+ email: deltacloud-users@lists.fedorahosted.org
72
+ executables:
73
+ - deltacloudc
74
+ extensions: []
75
+
76
+ extra_rdoc_files:
77
+ - COPYING
78
+ files:
79
+ - Rakefile
80
+ - lib/documentation.rb
81
+ - lib/plain_formatter.rb
82
+ - lib/deltacloud.rb
83
+ - init.rb
84
+ - bin/deltacloudc
85
+ - COPYING
86
+ - specs/shared/resources.rb
87
+ - specs/realms_spec.rb
88
+ - specs/images_spec.rb
89
+ - specs/storage_snapshot_spec.rb
90
+ - specs/spec_helper.rb
91
+ - specs/instance_states_spec.rb
92
+ - specs/hardware_profiles_spec.rb
93
+ - specs/storage_volume_spec.rb
94
+ - specs/fixtures/instances/inst1.yml
95
+ - specs/fixtures/instances/inst2.yml
96
+ - specs/fixtures/instances/inst0.yml
97
+ - specs/fixtures/storage_volumes/vol1.yml
98
+ - specs/fixtures/storage_volumes/vol3.yml
99
+ - specs/fixtures/storage_volumes/vol2.yml
100
+ - specs/fixtures/storage_snapshots/snap3.yml
101
+ - specs/fixtures/storage_snapshots/snap1.yml
102
+ - specs/fixtures/storage_snapshots/snap2.yml
103
+ - specs/fixtures/images/img2.yml
104
+ - specs/fixtures/images/img1.yml
105
+ - specs/fixtures/images/img3.yml
106
+ - specs/instances_spec.rb
107
+ - specs/initialization_spec.rb
108
+ has_rdoc: true
109
+ homepage: http://www.deltacloud.org
110
+ licenses: []
111
+
112
+ post_install_message:
113
+ rdoc_options: []
114
+
115
+ require_paths:
116
+ - lib
117
+ required_ruby_version: !ruby/object:Gem::Requirement
118
+ none: false
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ hash: 3
123
+ segments:
124
+ - 0
125
+ version: "0"
126
+ required_rubygems_version: !ruby/object:Gem::Requirement
127
+ none: false
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ hash: 3
132
+ segments:
133
+ - 0
134
+ version: "0"
135
+ requirements: []
136
+
137
+ rubyforge_project:
138
+ rubygems_version: 1.3.7
139
+ signing_key:
140
+ specification_version: 3
141
+ summary: Deltacloud REST Client
142
+ test_files:
143
+ - specs/shared/resources.rb
144
+ - specs/realms_spec.rb
145
+ - specs/images_spec.rb
146
+ - specs/storage_snapshot_spec.rb
147
+ - specs/spec_helper.rb
148
+ - specs/instance_states_spec.rb
149
+ - specs/hardware_profiles_spec.rb
150
+ - specs/storage_volume_spec.rb
151
+ - specs/fixtures/instances/inst1.yml
152
+ - specs/fixtures/instances/inst2.yml
153
+ - specs/fixtures/instances/inst0.yml
154
+ - specs/fixtures/storage_volumes/vol1.yml
155
+ - specs/fixtures/storage_volumes/vol3.yml
156
+ - specs/fixtures/storage_volumes/vol2.yml
157
+ - specs/fixtures/storage_snapshots/snap3.yml
158
+ - specs/fixtures/storage_snapshots/snap1.yml
159
+ - specs/fixtures/storage_snapshots/snap2.yml
160
+ - specs/fixtures/images/img2.yml
161
+ - specs/fixtures/images/img1.yml
162
+ - specs/fixtures/images/img3.yml
163
+ - specs/instances_spec.rb
164
+ - specs/initialization_spec.rb