deltacloud-client-vm 1.1.4.2 → 1.1.4.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (191) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +176 -0
  3. data/NOTICE +8 -0
  4. data/README.md +73 -0
  5. data/Rakefile +122 -0
  6. data/deltacloud-client-vm.gemspec +24 -0
  7. data/lib/deltacloud_vm/client.rb +79 -0
  8. data/lib/deltacloud_vm/client/base_error.rb +80 -0
  9. data/lib/deltacloud_vm/client/connection.rb +139 -0
  10. data/lib/deltacloud_vm/client/helpers/model_helper.rb +69 -0
  11. data/lib/deltacloud_vm/client/helpers/property_helper.rb +103 -0
  12. data/lib/deltacloud_vm/client/helpers/xml_helper.rb +33 -0
  13. data/lib/deltacloud_vm/client/methods.rb +33 -0
  14. data/lib/deltacloud_vm/client/methods/address.rb +67 -0
  15. data/lib/deltacloud_vm/client/methods/api.rb +96 -0
  16. data/lib/deltacloud_vm/client/methods/backward_compatiblity.rb +72 -0
  17. data/lib/deltacloud_vm/client/methods/blob.rb +91 -0
  18. data/lib/deltacloud_vm/client/methods/bucket.rb +55 -0
  19. data/lib/deltacloud_vm/client/methods/common.rb +46 -0
  20. data/lib/deltacloud_vm/client/methods/driver.rb +53 -0
  21. data/lib/deltacloud_vm/client/methods/firewall.rb +67 -0
  22. data/lib/deltacloud_vm/client/methods/hardware_profile.rb +41 -0
  23. data/lib/deltacloud_vm/client/methods/image.rb +61 -0
  24. data/lib/deltacloud_vm/client/methods/instance.rb +141 -0
  25. data/lib/deltacloud_vm/client/methods/instance_state.rb +41 -0
  26. data/lib/deltacloud_vm/client/methods/key.rb +58 -0
  27. data/lib/deltacloud_vm/client/methods/load_balancer.rb +96 -0
  28. data/lib/deltacloud_vm/client/methods/metric.rb +54 -0
  29. data/lib/deltacloud_vm/client/methods/realm.rb +42 -0
  30. data/lib/deltacloud_vm/client/methods/storage_snapshot.rb +61 -0
  31. data/lib/deltacloud_vm/client/methods/storage_volume.rb +94 -0
  32. data/lib/deltacloud_vm/client/models.rb +32 -0
  33. data/lib/deltacloud_vm/client/models/address.rb +57 -0
  34. data/lib/deltacloud_vm/client/models/base.rb +153 -0
  35. data/lib/deltacloud_vm/client/models/blob.rb +56 -0
  36. data/lib/deltacloud_vm/client/models/bucket.rb +65 -0
  37. data/lib/deltacloud_vm/client/models/driver.rb +87 -0
  38. data/lib/deltacloud_vm/client/models/firewall.rb +64 -0
  39. data/lib/deltacloud_vm/client/models/hardware_profile.rb +68 -0
  40. data/lib/deltacloud_vm/client/models/image.rb +60 -0
  41. data/lib/deltacloud_vm/client/models/instance.rb +142 -0
  42. data/lib/deltacloud_vm/client/models/instance_address.rb +40 -0
  43. data/lib/deltacloud_vm/client/models/instance_state.rb +52 -0
  44. data/lib/deltacloud_vm/client/models/key.rb +52 -0
  45. data/lib/deltacloud_vm/client/models/load_balancer.rb +55 -0
  46. data/lib/deltacloud_vm/client/models/metric.rb +72 -0
  47. data/lib/deltacloud_vm/client/models/realm.rb +29 -0
  48. data/lib/deltacloud_vm/client/models/storage_snapshot.rb +54 -0
  49. data/lib/deltacloud_vm/client/models/storage_volume.rb +96 -0
  50. data/lib/deltacloud_vm/core_ext.rb +19 -0
  51. data/lib/deltacloud_vm/core_ext/element.rb +32 -0
  52. data/lib/deltacloud_vm/core_ext/fixnum.rb +30 -0
  53. data/lib/deltacloud_vm/core_ext/nil.rb +22 -0
  54. data/lib/deltacloud_vm/core_ext/string.rb +49 -0
  55. data/lib/deltacloud_vm/error_response.rb +93 -0
  56. data/tests/client/client_test.rb +51 -0
  57. data/tests/client/connection_test.rb +77 -0
  58. data/tests/core_ext/element_test.rb +40 -0
  59. data/tests/core_ext/fixnum_test.rb +35 -0
  60. data/tests/core_ext/nil.rb +27 -0
  61. data/tests/core_ext/string_test.rb +47 -0
  62. data/tests/fixtures/instances_cleanup.yml +681 -0
  63. data/tests/fixtures/test_0001_connects_to_Deltacloud_API.yml +60 -0
  64. data/tests/fixtures/test_0001_support_cpu.yml +444 -0
  65. data/tests/fixtures/test_0001_support_original_body.yml +116 -0
  66. data/tests/fixtures/test_0001_supports_addresses.yml +178 -0
  67. data/tests/fixtures/test_0001_supports_api_host.yml +60 -0
  68. data/tests/fixtures/test_0001_supports_attached_.yml +282 -0
  69. data/tests/fixtures/test_0001_supports_blobs.yml +475 -0
  70. data/tests/fixtures/test_0001_supports_bucket.yml +200 -0
  71. data/tests/fixtures/test_0001_supports_buckets.yml +160 -0
  72. data/tests/fixtures/test_0001_supports_drivers.yml +202 -0
  73. data/tests/fixtures/test_0001_supports_firewalls.yml +399 -0
  74. data/tests/fixtures/test_0001_supports_hardware_profiles.yml +262 -0
  75. data/tests/fixtures/test_0001_supports_images.yml +224 -0
  76. data/tests/fixtures/test_0001_supports_instance_states.yml +156 -0
  77. data/tests/fixtures/test_0001_supports_instances.yml +486 -0
  78. data/tests/fixtures/test_0001_supports_keys.yml +198 -0
  79. data/tests/fixtures/test_0001_supports_path.yml +60 -0
  80. data/tests/fixtures/test_0001_supports_realms.yml +152 -0
  81. data/tests/fixtures/test_0001_supports_storage_snapshots.yml +164 -0
  82. data/tests/fixtures/test_0001_supports_storage_volumes.yml +176 -0
  83. data/tests/fixtures/test_0001_supports_to_get_providers.yml +410 -0
  84. data/tests/fixtures/test_0002_support_blob.yml +148 -0
  85. data/tests/fixtures/test_0002_support_instance_state.yml +204 -0
  86. data/tests/fixtures/test_0002_support_memory.yml +444 -0
  87. data/tests/fixtures/test_0002_support_on_Provider.yml +130 -0
  88. data/tests/fixtures/test_0002_supports_api_port.yml +60 -0
  89. data/tests/fixtures/test_0002_supports_api_uri.yml +60 -0
  90. data/tests/fixtures/test_0002_supports_driver.yml +219 -0
  91. data/tests/fixtures/test_0002_supports_extract_xml_body_using_faraday_connection.yml +117 -0
  92. data/tests/fixtures/test_0002_supports_filtering_addresses_by_id_param.yml +156 -0
  93. data/tests/fixtures/test_0002_supports_filtering_buckets_by_id_param.yml +156 -0
  94. data/tests/fixtures/test_0002_supports_filtering_firewalls_by_id_param.yml +207 -0
  95. data/tests/fixtures/test_0002_supports_filtering_hardware_profiles_by_id_param.yml +158 -0
  96. data/tests/fixtures/test_0002_supports_filtering_images_by_id_param.yml +165 -0
  97. data/tests/fixtures/test_0002_supports_filtering_instances_by_id_param.yml +164 -0
  98. data/tests/fixtures/test_0002_supports_filtering_keys_by_id_param.yml +178 -0
  99. data/tests/fixtures/test_0002_supports_filtering_realms_by_id.yml +104 -0
  100. data/tests/fixtures/test_0002_supports_filtering_storage_snapshots_by_id_param.yml +155 -0
  101. data/tests/fixtures/test_0002_supports_filtering_storage_volumes_by_id_param.yml +157 -0
  102. data/tests/fixtures/test_0002_supports_hardware_profiles.yml +262 -0
  103. data/tests/fixtures/test_0002_supports_is_compatible_.yml +116 -0
  104. data/tests/fixtures/test_0002_supports_snapshot_.yml +202 -0
  105. data/tests/fixtures/test_0002_supports_version.yml +60 -0
  106. data/tests/fixtures/test_0003_caches_the_API_entrypoint.yml +60 -0
  107. data/tests/fixtures/test_0003_support_address.yml +197 -0
  108. data/tests/fixtures/test_0003_support_bucket.yml +198 -0
  109. data/tests/fixtures/test_0003_support_create_blob.yml +105 -0
  110. data/tests/fixtures/test_0003_support_create_blob_and_destroy_blob.yml +138 -0
  111. data/tests/fixtures/test_0003_support_firewall.yml +768 -0
  112. data/tests/fixtures/test_0003_support_hardware_profile.yml +199 -0
  113. data/tests/fixtures/test_0003_support_image.yml +207 -0
  114. data/tests/fixtures/test_0003_support_instance.yml +206 -0
  115. data/tests/fixtures/test_0003_support_key.yml +220 -0
  116. data/tests/fixtures/test_0003_support_realm.yml +195 -0
  117. data/tests/fixtures/test_0003_support_storage.yml +444 -0
  118. data/tests/fixtures/test_0003_support_storage_snapshot.yml +196 -0
  119. data/tests/fixtures/test_0003_support_storage_volume.yml +197 -0
  120. data/tests/fixtures/test_0003_support_to_change_driver_with_Client.yml +72 -0
  121. data/tests/fixtures/test_0003_supports_connect.yml +60 -0
  122. data/tests/fixtures/test_0003_supports_extract_xml_body_using_nokogiri_document.yml +117 -0
  123. data/tests/fixtures/test_0003_supports_instance.yml +396 -0
  124. data/tests/fixtures/test_0003_supports_is_compatible_.yml +116 -0
  125. data/tests/fixtures/test_0003_supports_lunch_image.yml +367 -0
  126. data/tests/fixtures/test_0003_supports_providers.yml +102 -0
  127. data/tests/fixtures/test_0003_supports_version.yml +60 -0
  128. data/tests/fixtures/test_0004_support_architecture.yml +444 -0
  129. data/tests/fixtures/test_0004_support_create_address.yml +197 -0
  130. data/tests/fixtures/test_0004_support_create_blob_and_destroy_blob_with_meta_params.yml +139 -0
  131. data/tests/fixtures/test_0004_support_create_bucket.yml +180 -0
  132. data/tests/fixtures/test_0004_support_create_bucket_and_destroy_bucket.yml +180 -0
  133. data/tests/fixtures/test_0004_support_create_firewall_and_destroy_firewall.yml +496 -0
  134. data/tests/fixtures/test_0004_support_create_image_and_destroy_image.yml +1527 -0
  135. data/tests/fixtures/test_0004_support_create_instance.yml +115 -0
  136. data/tests/fixtures/test_0004_support_create_key_and_destroy_key.yml +206 -0
  137. data/tests/fixtures/test_0004_support_create_volume.yml +105 -0
  138. data/tests/fixtures/test_0004_support_create_volume_and_destroy_volume.yml +181 -0
  139. data/tests/fixtures/test_0004_support_to_test_of_valid_DC_connection.yml +60 -0
  140. data/tests/fixtures/test_0004_supports_current_driver.yml +60 -0
  141. data/tests/fixtures/test_0004_supports_extract_xml_body_using_nokogiri_element.yml +117 -0
  142. data/tests/fixtures/test_0004_supports_lunch_image.yml +312 -0
  143. data/tests/fixtures/test_0004_supports_valid_credentials_.yml +215 -0
  144. data/tests/fixtures/test_0004_supports_with_config.yml +129 -0
  145. data/tests/fixtures/test_0005_support_attach_storage_volume.yml +102 -0
  146. data/tests/fixtures/test_0005_support_attach_storage_volume_and_detach_storage_volume.yml +142 -0
  147. data/tests/fixtures/test_0005_support_create_instance_with_hwp_id.yml +115 -0
  148. data/tests/fixtures/test_0005_support_opaque_.yml +152 -0
  149. data/tests/fixtures/test_0005_supports_current_provider.yml +134 -0
  150. data/tests/fixtures/test_0005_supports_id.yml +116 -0
  151. data/tests/fixtures/test_0005_supports_switching_drivers_per_instance.yml +129 -0
  152. data/tests/fixtures/test_0005_supports_use_driver.yml +60 -0
  153. data/tests/fixtures/test_0006_support_create_instance_with_realm_id.yml +115 -0
  154. data/tests/fixtures/test_0006_supports_discovered_.yml +60 -0
  155. data/tests/fixtures/test_0006_supports_supported_collections.yml +60 -0
  156. data/tests/fixtures/test_0006_supports_switching_providers_per_instance.yml +208 -0
  157. data/tests/fixtures/test_0007_support_create_instance_with_name.yml +115 -0
  158. data/tests/fixtures/test_0007_support_switching_provider_without_credentials.yml +208 -0
  159. data/tests/fixtures/test_0007_supports_support_.yml +60 -0
  160. data/tests/fixtures/test_0007_supports_valid_credentials_on_class.yml +370 -0
  161. data/tests/fixtures/test_0008_support_stop_instance.yml +166 -0
  162. data/tests/fixtures/test_0008_supports_must_support_.yml +60 -0
  163. data/tests/fixtures/test_0009_support_start_instance.yml +217 -0
  164. data/tests/fixtures/test_0009_supports_features.yml +60 -0
  165. data/tests/fixtures/test_0010_support_reboot_instance.yml +166 -0
  166. data/tests/fixtures/test_0010_supports_feature_.yml +60 -0
  167. data/tests/helpers/model_test.rb +33 -0
  168. data/tests/helpers/xml_test.rb +56 -0
  169. data/tests/methods/address_test.rb +64 -0
  170. data/tests/methods/api_test.rb +97 -0
  171. data/tests/methods/backward_compatibility_test.rb +87 -0
  172. data/tests/methods/blob_test.rb +64 -0
  173. data/tests/methods/bucket_test.rb +62 -0
  174. data/tests/methods/driver_test.rb +48 -0
  175. data/tests/methods/firewall_test.rb +84 -0
  176. data/tests/methods/hardware_profile_test.rb +53 -0
  177. data/tests/methods/image_test.rb +64 -0
  178. data/tests/methods/instance_state_test.rb +43 -0
  179. data/tests/methods/instance_test.rb +126 -0
  180. data/tests/methods/key_test.rb +63 -0
  181. data/tests/methods/realm_test.rb +50 -0
  182. data/tests/methods/storage_snapshot_test.rb +53 -0
  183. data/tests/methods/storage_volume_test.rb +81 -0
  184. data/tests/models/blob_test.rb +40 -0
  185. data/tests/models/bucket_test.rb +37 -0
  186. data/tests/models/driver_test.rb +42 -0
  187. data/tests/models/hardware_profile_test.rb +80 -0
  188. data/tests/models/image_test.rb +65 -0
  189. data/tests/models/storage_volume_test.rb +52 -0
  190. data/tests/test_helper.rb +64 -0
  191. metadata +191 -2
@@ -0,0 +1,37 @@
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
+ require_relative '../test_helper'
17
+
18
+ describe DeltacloudVM::Client::StorageVolume do
19
+
20
+ before do
21
+ VCR.insert_cassette(__name__)
22
+ @client = new_client
23
+ end
24
+
25
+ after do
26
+ VCR.eject_cassette
27
+ end
28
+
29
+ it 'supports #blobs' do
30
+ b = @client.bucket('bucket1')
31
+ b.must_respond_to :blobs
32
+ b.blobs.wont_be_empty
33
+ b.blobs.first.must_be_instance_of DeltacloudVM::Client::Blob
34
+ end
35
+
36
+
37
+ end
@@ -0,0 +1,42 @@
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
+ require_relative '../test_helper'
17
+
18
+ describe DeltacloudVM::Client::Driver do
19
+
20
+ before do
21
+ VCR.insert_cassette(__name__)
22
+ @client = new_client
23
+ end
24
+
25
+ after do
26
+ VCR.eject_cassette
27
+ end
28
+
29
+ it 'supports #[] to get providers' do
30
+ @client.driver(:ec2).must_respond_to '[]'
31
+ @client.driver(:ec2)['eu-west-1'].wont_be_nil
32
+ @client.driver(:ec2)['eu-west-1'].must_be_instance_of DeltacloudVM::Client::Driver::Provider
33
+ @client.driver(:ec2)['eu-west-1'].entrypoints.wont_be_empty
34
+ @client.driver(:ec2)['foo'].must_be_nil
35
+ end
36
+
37
+ it 'support #[] on Provider' do
38
+ drv = @client.driver(:ec2)
39
+ drv['eu-west-1']['s3'].wont_be_empty
40
+ end
41
+
42
+ end
@@ -0,0 +1,80 @@
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
+ require_relative '../test_helper'
17
+
18
+ describe DeltacloudVM::Client::HardwareProfile do
19
+
20
+ before do
21
+ VCR.insert_cassette(__name__)
22
+ @client = new_client
23
+ end
24
+
25
+ after do
26
+ VCR.eject_cassette
27
+ end
28
+
29
+ it 'support #cpu' do
30
+ @client.hardware_profile('m1-small').must_respond_to :cpu
31
+ @client.hardware_profile('m1-small').cpu.wont_be_nil
32
+ @client.hardware_profile('m1-small').cpu.must_respond_to :default
33
+ @client.hardware_profile('m1-small').cpu.default.wont_be_empty
34
+ @client.hardware_profile('m1-small').cpu.must_respond_to :kind
35
+ @client.hardware_profile('m1-small').cpu.kind.wont_be_empty
36
+ @client.hardware_profile('m1-small').cpu.must_respond_to :unit
37
+ @client.hardware_profile('m1-small').cpu.unit.wont_be_empty
38
+ end
39
+
40
+ it 'support #memory' do
41
+ @client.hardware_profile('m1-small').must_respond_to :memory
42
+ @client.hardware_profile('m1-small').memory.wont_be_nil
43
+ @client.hardware_profile('m1-small').memory.must_respond_to :default
44
+ @client.hardware_profile('m1-small').memory.default.wont_be_empty
45
+ @client.hardware_profile('m1-small').memory.must_respond_to :kind
46
+ @client.hardware_profile('m1-small').memory.kind.wont_be_empty
47
+ @client.hardware_profile('m1-small').memory.must_respond_to :unit
48
+ @client.hardware_profile('m1-small').memory.unit.wont_be_empty
49
+ end
50
+
51
+ it 'support #storage' do
52
+ @client.hardware_profile('m1-small').must_respond_to :storage
53
+ @client.hardware_profile('m1-small').storage.wont_be_nil
54
+ @client.hardware_profile('m1-small').storage.must_respond_to :default
55
+ @client.hardware_profile('m1-small').storage.default.wont_be_empty
56
+ @client.hardware_profile('m1-small').storage.must_respond_to :kind
57
+ @client.hardware_profile('m1-small').storage.kind.wont_be_empty
58
+ @client.hardware_profile('m1-small').storage.must_respond_to :unit
59
+ @client.hardware_profile('m1-small').storage.unit.wont_be_empty
60
+ end
61
+
62
+ it 'support #architecture' do
63
+ @client.hardware_profile('m1-small').must_respond_to :architecture
64
+ @client.hardware_profile('m1-small').architecture.wont_be_nil
65
+ @client.hardware_profile('m1-small').architecture.must_respond_to :default
66
+ @client.hardware_profile('m1-small').architecture.default.wont_be_empty
67
+ @client.hardware_profile('m1-small').architecture.must_respond_to :kind
68
+ @client.hardware_profile('m1-small').architecture.kind.wont_be_empty
69
+ @client.hardware_profile('m1-small').architecture.must_respond_to :unit
70
+ @client.hardware_profile('m1-small').architecture.unit.wont_be_empty
71
+ end
72
+
73
+ it 'support #opaque?' do
74
+ @client.hardware_profile('opaque').opaque?.must_equal true
75
+ @client.hardware_profile('m1-small').opaque?.must_equal false
76
+ end
77
+
78
+
79
+
80
+ end
@@ -0,0 +1,65 @@
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
+ require_relative '../test_helper'
17
+
18
+ describe DeltacloudVM::Client::Image do
19
+
20
+ before do
21
+ VCR.insert_cassette(__name__)
22
+ @client = new_client
23
+ end
24
+
25
+ after do
26
+ VCR.eject_cassette
27
+ end
28
+
29
+ it 'support #original_body' do
30
+ img = @client.image('img1')
31
+ img.original_body.must_be_instance_of Faraday::Response
32
+ end
33
+
34
+ it 'supports #hardware_profiles' do
35
+ img = @client.image('img1')
36
+ img.must_respond_to :hardware_profiles
37
+ img.hardware_profiles.wont_be_empty
38
+ img.hardware_profiles.first.must_be_instance_of DeltacloudVM::Client::HardwareProfile
39
+ end
40
+
41
+ it 'supports #is_compatible?' do
42
+ img = @client.image('img1')
43
+ img.must_respond_to 'is_compatible?'
44
+ img.is_compatible?('m1-small').must_equal true
45
+ img.is_compatible?('m1-large').must_equal true
46
+ end
47
+
48
+ it 'supports #lunch_image' do
49
+ img = @client.image('img1')
50
+ img.must_respond_to :launch
51
+ inst = img.launch(:hwp_id => 'm1-large')
52
+ inst.must_be_instance_of DeltacloudVM::Client::Instance
53
+ inst.hardware_profile_id.must_equal 'm1-large'
54
+ inst.stop!
55
+ inst.destroy!
56
+ end
57
+
58
+ it 'supports #id' do
59
+ img = @client.image('img1')
60
+ lambda { img.id.must_equal 'img1' }.must_output nil, "[DEPRECATION] `id` is deprecated because of a possible conflict with Object#id. Use `_id` instead.\n"
61
+ img.must_respond_to :url
62
+ img.url.must_equal 'http://localhost:3001/api/images/img1'
63
+ end
64
+
65
+ end
@@ -0,0 +1,52 @@
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
+ require_relative '../test_helper'
17
+
18
+ describe DeltacloudVM::Client::StorageVolume do
19
+
20
+ before do
21
+ VCR.insert_cassette(__name__)
22
+ @client = new_client
23
+ end
24
+
25
+ after do
26
+ VCR.eject_cassette
27
+ end
28
+
29
+ it 'supports #attached?' do
30
+ vol = @client.storage_volume('vol1')
31
+ vol.attached?.must_equal false
32
+ vol.attach('inst1')
33
+ vol.attached?.must_equal true
34
+ vol.detach!
35
+ end
36
+
37
+ it 'supports #snapshot!' do
38
+ vol = @client.storage_volume('vol1')
39
+ vol.snapshot!.must_be_instance_of DeltacloudVM::Client::StorageSnapshot
40
+ end
41
+
42
+ it 'supports #instance' do
43
+ vol = @client.storage_volume('vol2')
44
+ vol.attached?.must_equal false
45
+ vol.attach('inst1')
46
+ vol.attached?.must_equal true
47
+ vol.instance.must_be_instance_of DeltacloudVM::Client::Instance
48
+ vol.instance._id.must_equal 'inst1'
49
+ vol.detach!
50
+ end
51
+
52
+ end
@@ -0,0 +1,64 @@
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
+ require 'bundler/setup'
17
+ Bundler.require(:default, :development)
18
+
19
+ require 'require_relative' if RUBY_VERSION < '1.9'
20
+
21
+ Turn.config.format = :dot
22
+
23
+ if ENV['COVERAGE']
24
+ require 'simplecov'
25
+ SimpleCov.command_name 'tests:units'
26
+ SimpleCov.start do
27
+ add_group "Models", "lib/deltacloud_vm/client/models"
28
+ add_group "Methods", "lib/deltacloud_vm/client/methods"
29
+ add_group "Helpers", "lib/deltacloud_vm/client/helpers"
30
+ add_group "Extensions", "lib/deltacloud_vm/core_ext"
31
+ add_filter "tests/"
32
+ end
33
+ end
34
+
35
+ require 'minitest/autorun'
36
+ #
37
+ # Change this at will
38
+ #
39
+ DELTACLOUD_URL = ENV['API_URL'] || 'http://localhost:3001/api'
40
+ DELTACLOUD_USER = 'mockuser'
41
+ DELTACLOUD_PASSWORD = 'mockpassword'
42
+
43
+ def new_client
44
+ DeltacloudVM::Client(DELTACLOUD_URL, DELTACLOUD_USER, DELTACLOUD_PASSWORD)
45
+ end
46
+
47
+ unless ENV['NO_VCR']
48
+ require 'vcr'
49
+ VCR.configure do |c|
50
+ c.hook_into :faraday
51
+ c.cassette_library_dir = File.join(File.dirname(__FILE__), 'fixtures')
52
+ c.default_cassette_options = { :record => :new_episodes }
53
+ end
54
+ end
55
+
56
+ require_relative './../lib/deltacloud_vm/client'
57
+
58
+ def cleanup_instances(inst_arr)
59
+ inst_arr.each do |i|
60
+ i.reload!
61
+ i.stop! unless i.is_stopped?
62
+ i.destroy!
63
+ end
64
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deltacloud-client-vm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4.2
4
+ version: 1.1.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jiri Kaipr
@@ -114,7 +114,196 @@ email:
114
114
  executables: []
115
115
  extensions: []
116
116
  extra_rdoc_files: []
117
- files: []
117
+ files:
118
+ - LICENSE
119
+ - NOTICE
120
+ - README.md
121
+ - Rakefile
122
+ - deltacloud-client-vm.gemspec
123
+ - lib/deltacloud_vm/client.rb
124
+ - lib/deltacloud_vm/client/base_error.rb
125
+ - lib/deltacloud_vm/client/connection.rb
126
+ - lib/deltacloud_vm/client/helpers/model_helper.rb
127
+ - lib/deltacloud_vm/client/helpers/property_helper.rb
128
+ - lib/deltacloud_vm/client/helpers/xml_helper.rb
129
+ - lib/deltacloud_vm/client/methods.rb
130
+ - lib/deltacloud_vm/client/methods/address.rb
131
+ - lib/deltacloud_vm/client/methods/api.rb
132
+ - lib/deltacloud_vm/client/methods/backward_compatiblity.rb
133
+ - lib/deltacloud_vm/client/methods/blob.rb
134
+ - lib/deltacloud_vm/client/methods/bucket.rb
135
+ - lib/deltacloud_vm/client/methods/common.rb
136
+ - lib/deltacloud_vm/client/methods/driver.rb
137
+ - lib/deltacloud_vm/client/methods/firewall.rb
138
+ - lib/deltacloud_vm/client/methods/hardware_profile.rb
139
+ - lib/deltacloud_vm/client/methods/image.rb
140
+ - lib/deltacloud_vm/client/methods/instance.rb
141
+ - lib/deltacloud_vm/client/methods/instance_state.rb
142
+ - lib/deltacloud_vm/client/methods/key.rb
143
+ - lib/deltacloud_vm/client/methods/load_balancer.rb
144
+ - lib/deltacloud_vm/client/methods/metric.rb
145
+ - lib/deltacloud_vm/client/methods/realm.rb
146
+ - lib/deltacloud_vm/client/methods/storage_snapshot.rb
147
+ - lib/deltacloud_vm/client/methods/storage_volume.rb
148
+ - lib/deltacloud_vm/client/models.rb
149
+ - lib/deltacloud_vm/client/models/address.rb
150
+ - lib/deltacloud_vm/client/models/base.rb
151
+ - lib/deltacloud_vm/client/models/blob.rb
152
+ - lib/deltacloud_vm/client/models/bucket.rb
153
+ - lib/deltacloud_vm/client/models/driver.rb
154
+ - lib/deltacloud_vm/client/models/firewall.rb
155
+ - lib/deltacloud_vm/client/models/hardware_profile.rb
156
+ - lib/deltacloud_vm/client/models/image.rb
157
+ - lib/deltacloud_vm/client/models/instance.rb
158
+ - lib/deltacloud_vm/client/models/instance_address.rb
159
+ - lib/deltacloud_vm/client/models/instance_state.rb
160
+ - lib/deltacloud_vm/client/models/key.rb
161
+ - lib/deltacloud_vm/client/models/load_balancer.rb
162
+ - lib/deltacloud_vm/client/models/metric.rb
163
+ - lib/deltacloud_vm/client/models/realm.rb
164
+ - lib/deltacloud_vm/client/models/storage_snapshot.rb
165
+ - lib/deltacloud_vm/client/models/storage_volume.rb
166
+ - lib/deltacloud_vm/core_ext.rb
167
+ - lib/deltacloud_vm/core_ext/element.rb
168
+ - lib/deltacloud_vm/core_ext/fixnum.rb
169
+ - lib/deltacloud_vm/core_ext/nil.rb
170
+ - lib/deltacloud_vm/core_ext/string.rb
171
+ - lib/deltacloud_vm/error_response.rb
172
+ - tests/client/client_test.rb
173
+ - tests/client/connection_test.rb
174
+ - tests/core_ext/element_test.rb
175
+ - tests/core_ext/fixnum_test.rb
176
+ - tests/core_ext/nil.rb
177
+ - tests/core_ext/string_test.rb
178
+ - tests/fixtures/instances_cleanup.yml
179
+ - tests/fixtures/test_0001_connects_to_Deltacloud_API.yml
180
+ - tests/fixtures/test_0001_support_cpu.yml
181
+ - tests/fixtures/test_0001_support_original_body.yml
182
+ - tests/fixtures/test_0001_supports_addresses.yml
183
+ - tests/fixtures/test_0001_supports_api_host.yml
184
+ - tests/fixtures/test_0001_supports_attached_.yml
185
+ - tests/fixtures/test_0001_supports_blobs.yml
186
+ - tests/fixtures/test_0001_supports_bucket.yml
187
+ - tests/fixtures/test_0001_supports_buckets.yml
188
+ - tests/fixtures/test_0001_supports_drivers.yml
189
+ - tests/fixtures/test_0001_supports_firewalls.yml
190
+ - tests/fixtures/test_0001_supports_hardware_profiles.yml
191
+ - tests/fixtures/test_0001_supports_images.yml
192
+ - tests/fixtures/test_0001_supports_instance_states.yml
193
+ - tests/fixtures/test_0001_supports_instances.yml
194
+ - tests/fixtures/test_0001_supports_keys.yml
195
+ - tests/fixtures/test_0001_supports_path.yml
196
+ - tests/fixtures/test_0001_supports_realms.yml
197
+ - tests/fixtures/test_0001_supports_storage_snapshots.yml
198
+ - tests/fixtures/test_0001_supports_storage_volumes.yml
199
+ - tests/fixtures/test_0001_supports_to_get_providers.yml
200
+ - tests/fixtures/test_0002_support_blob.yml
201
+ - tests/fixtures/test_0002_support_instance_state.yml
202
+ - tests/fixtures/test_0002_support_memory.yml
203
+ - tests/fixtures/test_0002_support_on_Provider.yml
204
+ - tests/fixtures/test_0002_supports_api_port.yml
205
+ - tests/fixtures/test_0002_supports_api_uri.yml
206
+ - tests/fixtures/test_0002_supports_driver.yml
207
+ - tests/fixtures/test_0002_supports_extract_xml_body_using_faraday_connection.yml
208
+ - tests/fixtures/test_0002_supports_filtering_addresses_by_id_param.yml
209
+ - tests/fixtures/test_0002_supports_filtering_buckets_by_id_param.yml
210
+ - tests/fixtures/test_0002_supports_filtering_firewalls_by_id_param.yml
211
+ - tests/fixtures/test_0002_supports_filtering_hardware_profiles_by_id_param.yml
212
+ - tests/fixtures/test_0002_supports_filtering_images_by_id_param.yml
213
+ - tests/fixtures/test_0002_supports_filtering_instances_by_id_param.yml
214
+ - tests/fixtures/test_0002_supports_filtering_keys_by_id_param.yml
215
+ - tests/fixtures/test_0002_supports_filtering_realms_by_id.yml
216
+ - tests/fixtures/test_0002_supports_filtering_storage_snapshots_by_id_param.yml
217
+ - tests/fixtures/test_0002_supports_filtering_storage_volumes_by_id_param.yml
218
+ - tests/fixtures/test_0002_supports_hardware_profiles.yml
219
+ - tests/fixtures/test_0002_supports_is_compatible_.yml
220
+ - tests/fixtures/test_0002_supports_snapshot_.yml
221
+ - tests/fixtures/test_0002_supports_version.yml
222
+ - tests/fixtures/test_0003_caches_the_API_entrypoint.yml
223
+ - tests/fixtures/test_0003_support_address.yml
224
+ - tests/fixtures/test_0003_support_bucket.yml
225
+ - tests/fixtures/test_0003_support_create_blob.yml
226
+ - tests/fixtures/test_0003_support_create_blob_and_destroy_blob.yml
227
+ - tests/fixtures/test_0003_support_firewall.yml
228
+ - tests/fixtures/test_0003_support_hardware_profile.yml
229
+ - tests/fixtures/test_0003_support_image.yml
230
+ - tests/fixtures/test_0003_support_instance.yml
231
+ - tests/fixtures/test_0003_support_key.yml
232
+ - tests/fixtures/test_0003_support_realm.yml
233
+ - tests/fixtures/test_0003_support_storage.yml
234
+ - tests/fixtures/test_0003_support_storage_snapshot.yml
235
+ - tests/fixtures/test_0003_support_storage_volume.yml
236
+ - tests/fixtures/test_0003_support_to_change_driver_with_Client.yml
237
+ - tests/fixtures/test_0003_supports_connect.yml
238
+ - tests/fixtures/test_0003_supports_extract_xml_body_using_nokogiri_document.yml
239
+ - tests/fixtures/test_0003_supports_instance.yml
240
+ - tests/fixtures/test_0003_supports_is_compatible_.yml
241
+ - tests/fixtures/test_0003_supports_lunch_image.yml
242
+ - tests/fixtures/test_0003_supports_providers.yml
243
+ - tests/fixtures/test_0003_supports_version.yml
244
+ - tests/fixtures/test_0004_support_architecture.yml
245
+ - tests/fixtures/test_0004_support_create_address.yml
246
+ - tests/fixtures/test_0004_support_create_blob_and_destroy_blob_with_meta_params.yml
247
+ - tests/fixtures/test_0004_support_create_bucket.yml
248
+ - tests/fixtures/test_0004_support_create_bucket_and_destroy_bucket.yml
249
+ - tests/fixtures/test_0004_support_create_firewall_and_destroy_firewall.yml
250
+ - tests/fixtures/test_0004_support_create_image_and_destroy_image.yml
251
+ - tests/fixtures/test_0004_support_create_instance.yml
252
+ - tests/fixtures/test_0004_support_create_key_and_destroy_key.yml
253
+ - tests/fixtures/test_0004_support_create_volume.yml
254
+ - tests/fixtures/test_0004_support_create_volume_and_destroy_volume.yml
255
+ - tests/fixtures/test_0004_support_to_test_of_valid_DC_connection.yml
256
+ - tests/fixtures/test_0004_supports_current_driver.yml
257
+ - tests/fixtures/test_0004_supports_extract_xml_body_using_nokogiri_element.yml
258
+ - tests/fixtures/test_0004_supports_lunch_image.yml
259
+ - tests/fixtures/test_0004_supports_valid_credentials_.yml
260
+ - tests/fixtures/test_0004_supports_with_config.yml
261
+ - tests/fixtures/test_0005_support_attach_storage_volume.yml
262
+ - tests/fixtures/test_0005_support_attach_storage_volume_and_detach_storage_volume.yml
263
+ - tests/fixtures/test_0005_support_create_instance_with_hwp_id.yml
264
+ - tests/fixtures/test_0005_support_opaque_.yml
265
+ - tests/fixtures/test_0005_supports_current_provider.yml
266
+ - tests/fixtures/test_0005_supports_id.yml
267
+ - tests/fixtures/test_0005_supports_switching_drivers_per_instance.yml
268
+ - tests/fixtures/test_0005_supports_use_driver.yml
269
+ - tests/fixtures/test_0006_support_create_instance_with_realm_id.yml
270
+ - tests/fixtures/test_0006_supports_discovered_.yml
271
+ - tests/fixtures/test_0006_supports_supported_collections.yml
272
+ - tests/fixtures/test_0006_supports_switching_providers_per_instance.yml
273
+ - tests/fixtures/test_0007_support_create_instance_with_name.yml
274
+ - tests/fixtures/test_0007_support_switching_provider_without_credentials.yml
275
+ - tests/fixtures/test_0007_supports_support_.yml
276
+ - tests/fixtures/test_0007_supports_valid_credentials_on_class.yml
277
+ - tests/fixtures/test_0008_support_stop_instance.yml
278
+ - tests/fixtures/test_0008_supports_must_support_.yml
279
+ - tests/fixtures/test_0009_support_start_instance.yml
280
+ - tests/fixtures/test_0009_supports_features.yml
281
+ - tests/fixtures/test_0010_support_reboot_instance.yml
282
+ - tests/fixtures/test_0010_supports_feature_.yml
283
+ - tests/helpers/model_test.rb
284
+ - tests/helpers/xml_test.rb
285
+ - tests/methods/address_test.rb
286
+ - tests/methods/api_test.rb
287
+ - tests/methods/backward_compatibility_test.rb
288
+ - tests/methods/blob_test.rb
289
+ - tests/methods/bucket_test.rb
290
+ - tests/methods/driver_test.rb
291
+ - tests/methods/firewall_test.rb
292
+ - tests/methods/hardware_profile_test.rb
293
+ - tests/methods/image_test.rb
294
+ - tests/methods/instance_state_test.rb
295
+ - tests/methods/instance_test.rb
296
+ - tests/methods/key_test.rb
297
+ - tests/methods/realm_test.rb
298
+ - tests/methods/storage_snapshot_test.rb
299
+ - tests/methods/storage_volume_test.rb
300
+ - tests/models/blob_test.rb
301
+ - tests/models/bucket_test.rb
302
+ - tests/models/driver_test.rb
303
+ - tests/models/hardware_profile_test.rb
304
+ - tests/models/image_test.rb
305
+ - tests/models/storage_volume_test.rb
306
+ - tests/test_helper.rb
118
307
  homepage: https://github.com/virtualmaster/virtualmaster-cli
119
308
  licenses: []
120
309
  metadata: {}