fog-voxel 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +23 -0
- data/.rubocop.yml +20 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +19 -0
- data/CONTRIBUTING.md +18 -0
- data/CONTRIBUTORS.md +5 -0
- data/Gemfile +4 -0
- data/LICENSE.md +20 -0
- data/README.md +34 -0
- data/Rakefile +18 -0
- data/fog-voxel.gemspec +35 -0
- data/gemfiles/Gemfile.1.9.2- +8 -0
- data/gemfiles/Gemfile.1.9.3+ +7 -0
- data/lib/fog/bin/voxel.rb +29 -0
- data/lib/fog/compute/voxel.rb +127 -0
- data/lib/fog/compute/voxel/image.rb +11 -0
- data/lib/fog/compute/voxel/images.rb +24 -0
- data/lib/fog/compute/voxel/real.rb +6 -0
- data/lib/fog/compute/voxel/real/devices_list.rb +22 -0
- data/lib/fog/compute/voxel/real/devices_power.rb +20 -0
- data/lib/fog/compute/voxel/real/images_list.rb +29 -0
- data/lib/fog/compute/voxel/real/voxcloud_create.rb +20 -0
- data/lib/fog/compute/voxel/real/voxcloud_delete.rb +18 -0
- data/lib/fog/compute/voxel/real/voxcloud_status.rb +22 -0
- data/lib/fog/compute/voxel/server.rb +71 -0
- data/lib/fog/compute/voxel/servers.rb +26 -0
- data/lib/fog/parsers/compute.rb +7 -0
- data/lib/fog/parsers/compute/voxel.rb +14 -0
- data/lib/fog/parsers/compute/voxel/basic.rb +27 -0
- data/lib/fog/parsers/compute/voxel/devices_list.rb +107 -0
- data/lib/fog/parsers/compute/voxel/images_list.rb +55 -0
- data/lib/fog/parsers/compute/voxel/voxcloud_create.rb +36 -0
- data/lib/fog/parsers/compute/voxel/voxcloud_delete.rb +27 -0
- data/lib/fog/parsers/compute/voxel/voxcloud_status.rb +42 -0
- data/lib/fog/voxel.rb +25 -0
- data/lib/fog/voxel/compute.rb +0 -0
- data/lib/fog/voxel/version.rb +5 -0
- data/spec/minitest_helper.rb +31 -0
- data/tests/helper.rb +37 -0
- data/tests/helpers/collection_helper.rb +97 -0
- data/tests/helpers/compute/flavors_helper.rb +32 -0
- data/tests/helpers/compute/server_helper.rb +25 -0
- data/tests/helpers/compute/servers_helper.rb +10 -0
- data/tests/helpers/formats_helper.rb +98 -0
- data/tests/helpers/formats_helper_tests.rb +110 -0
- data/tests/helpers/mock_helper.rb +117 -0
- data/tests/helpers/model_helper.rb +31 -0
- data/tests/helpers/responds_to_helper.rb +11 -0
- data/tests/helpers/schema_validator_tests.rb +107 -0
- data/tests/helpers/succeeds_helper.rb +9 -0
- data/tests/requests/compute/image_tests.rb +52 -0
- data/tests/requests/compute/server_tests.rb +123 -0
- metadata +225 -0
@@ -0,0 +1,110 @@
|
|
1
|
+
Shindo.tests('test_helper', 'meta') do
|
2
|
+
|
3
|
+
tests('comparing welcome data against schema') do
|
4
|
+
data = {:welcome => "Hello" }
|
5
|
+
data_matches_schema(:welcome => String) { data }
|
6
|
+
end
|
7
|
+
|
8
|
+
tests('#data_matches_schema') do
|
9
|
+
tests('when value matches schema expectation') do
|
10
|
+
data_matches_schema({"key" => String}) { {"key" => "Value"} }
|
11
|
+
end
|
12
|
+
|
13
|
+
tests('when values within an array all match schema expectation') do
|
14
|
+
data_matches_schema({"key" => [Integer]}) { {"key" => [1, 2]} }
|
15
|
+
end
|
16
|
+
|
17
|
+
tests('when nested values match schema expectation') do
|
18
|
+
data_matches_schema({"key" => {:nested_key => String}}) { {"key" => {:nested_key => "Value"}} }
|
19
|
+
end
|
20
|
+
|
21
|
+
tests('when collection of values all match schema expectation') do
|
22
|
+
data_matches_schema([{"key" => String}]) { [{"key" => "Value"}, {"key" => "Value"}] }
|
23
|
+
end
|
24
|
+
|
25
|
+
tests('when collection is empty although schema covers optional members') do
|
26
|
+
data_matches_schema([{"key" => String}], {:allow_optional_rules => true}) { [] }
|
27
|
+
end
|
28
|
+
|
29
|
+
tests('when additional keys are passed and not strict') do
|
30
|
+
data_matches_schema({"key" => String}, {:allow_extra_keys => true}) { {"key" => "Value", :extra => "Bonus"} }
|
31
|
+
end
|
32
|
+
|
33
|
+
tests('when value is nil and schema expects NilClass') do
|
34
|
+
data_matches_schema({"key" => NilClass}) { {"key" => nil} }
|
35
|
+
end
|
36
|
+
|
37
|
+
tests('when value and schema match as hashes') do
|
38
|
+
data_matches_schema({}) { {} }
|
39
|
+
end
|
40
|
+
|
41
|
+
tests('when value and schema match as arrays') do
|
42
|
+
data_matches_schema([]) { [] }
|
43
|
+
end
|
44
|
+
|
45
|
+
tests('when value is a Time') do
|
46
|
+
data_matches_schema({"time" => Time}) { {"time" => Time.now} }
|
47
|
+
end
|
48
|
+
|
49
|
+
tests('when key is missing but value should be NilClass (#1477)') do
|
50
|
+
data_matches_schema({"key" => NilClass}, {:allow_optional_rules => true}) { {} }
|
51
|
+
end
|
52
|
+
|
53
|
+
tests('when key is missing but value is nullable (#1477)') do
|
54
|
+
data_matches_schema({"key" => Fog::Nullable::String}, {:allow_optional_rules => true}) { {} }
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
tests('#formats backwards compatible changes') do
|
59
|
+
|
60
|
+
tests('when value matches schema expectation') do
|
61
|
+
formats({"key" => String}) { {"key" => "Value"} }
|
62
|
+
end
|
63
|
+
|
64
|
+
tests('when values within an array all match schema expectation') do
|
65
|
+
formats({"key" => [Integer]}) { {"key" => [1, 2]} }
|
66
|
+
end
|
67
|
+
|
68
|
+
tests('when nested values match schema expectation') do
|
69
|
+
formats({"key" => {:nested_key => String}}) { {"key" => {:nested_key => "Value"}} }
|
70
|
+
end
|
71
|
+
|
72
|
+
tests('when collection of values all match schema expectation') do
|
73
|
+
formats([{"key" => String}]) { [{"key" => "Value"}, {"key" => "Value"}] }
|
74
|
+
end
|
75
|
+
|
76
|
+
tests('when collection is empty although schema covers optional members') do
|
77
|
+
formats([{"key" => String}]) { [] }
|
78
|
+
end
|
79
|
+
|
80
|
+
tests('when additional keys are passed and not strict') do
|
81
|
+
formats({"key" => String}, false) { {"key" => "Value", :extra => "Bonus"} }
|
82
|
+
end
|
83
|
+
|
84
|
+
tests('when value is nil and schema expects NilClass') do
|
85
|
+
formats({"key" => NilClass}) { {"key" => nil} }
|
86
|
+
end
|
87
|
+
|
88
|
+
tests('when value and schema match as hashes') do
|
89
|
+
formats({}) { {} }
|
90
|
+
end
|
91
|
+
|
92
|
+
tests('when value and schema match as arrays') do
|
93
|
+
formats([]) { [] }
|
94
|
+
end
|
95
|
+
|
96
|
+
tests('when value is a Time') do
|
97
|
+
formats({"time" => Time}) { {"time" => Time.now} }
|
98
|
+
end
|
99
|
+
|
100
|
+
tests('when key is missing but value should be NilClass (#1477)') do
|
101
|
+
formats({"key" => NilClass}) { {} }
|
102
|
+
end
|
103
|
+
|
104
|
+
tests('when key is missing but value is nullable (#1477)') do
|
105
|
+
formats({"key" => Fog::Nullable::String}) { {} }
|
106
|
+
end
|
107
|
+
|
108
|
+
end
|
109
|
+
|
110
|
+
end
|
@@ -0,0 +1,117 @@
|
|
1
|
+
# Use so you can run in mock mode from the command line
|
2
|
+
#
|
3
|
+
# FOG_MOCK=true fog
|
4
|
+
|
5
|
+
if ENV["FOG_MOCK"] == "true"
|
6
|
+
Fog.mock!
|
7
|
+
end
|
8
|
+
|
9
|
+
# if in mocked mode, fill in some fake credentials for us
|
10
|
+
if Fog.mock?
|
11
|
+
Fog.credentials = {
|
12
|
+
:aws_access_key_id => 'aws_access_key_id',
|
13
|
+
:aws_secret_access_key => 'aws_secret_access_key',
|
14
|
+
:ia_access_key_id => 'aws_access_key_id',
|
15
|
+
:ia_secret_access_key => 'aws_secret_access_key',
|
16
|
+
:atmos_storage_token => 'atmos_token',
|
17
|
+
:atmos_storage_secret => 'atmos_secret',
|
18
|
+
:atmos_storage_endpoint => 'http://atmos.is.cool:1000/test1.0',
|
19
|
+
:bluebox_api_key => 'bluebox_api_key',
|
20
|
+
:bluebox_customer_id => 'bluebox_customer_id',
|
21
|
+
:brightbox_client_id => 'brightbox_client_id',
|
22
|
+
:brightbox_secret => 'brightbox_secret',
|
23
|
+
:cloudstack_disk_offering_id => '',
|
24
|
+
:cloudstack_host => 'http://cloudstack.example.org',
|
25
|
+
:cloudstack_network_ids => '',
|
26
|
+
:cloudstack_service_offering_id => '4437ac6c-9fe3-477a-57ec-60a5a45896a4',
|
27
|
+
:cloudstack_template_id => '8a31cf9c-f248-0588-256e-9dbf58785216',
|
28
|
+
:cloudstack_zone_id => 'c554c592-e09c-9df5-7688-4a32754a4305',
|
29
|
+
:clodo_api_key => 'clodo_api_key',
|
30
|
+
:clodo_username => 'clodo_username',
|
31
|
+
:digitalocean_api_key => 'digitalocean_api_key',
|
32
|
+
:digitalocean_client_id => 'digitalocean_client_id',
|
33
|
+
:dnsimple_email => 'dnsimple_email',
|
34
|
+
:dnsimple_password => 'dnsimple_password',
|
35
|
+
:dnsmadeeasy_api_key => 'dnsmadeeasy_api_key',
|
36
|
+
:dnsmadeeasy_secret_key => 'dnsmadeeasy_secret_key',
|
37
|
+
:ecloud_username => 'ecloud_username',
|
38
|
+
:ecloud_password => 'ecloud_password',
|
39
|
+
:ecloud_versions_uri => 'http://ecloud.versions.uri',
|
40
|
+
:glesys_username => 'glesys_username',
|
41
|
+
:glesys_api_key => 'glesys_api_key',
|
42
|
+
:go_grid_api_key => 'go_grid_api_key',
|
43
|
+
:go_grid_shared_secret => 'go_grid_shared_secret',
|
44
|
+
:google_storage_access_key_id => 'google_storage_access_key_id',
|
45
|
+
:google_storage_secret_access_key => 'google_storage_secret_access_key',
|
46
|
+
:google_project => 'google_project_name',
|
47
|
+
:google_client_email => 'fake@developer.gserviceaccount.com',
|
48
|
+
:google_key_location => '~/fake.p12',
|
49
|
+
:hp_access_key => 'hp_access_key',
|
50
|
+
:hp_secret_key => 'hp_secret_key',
|
51
|
+
:hp_tenant_id => 'hp_tenant_id',
|
52
|
+
:hp_avl_zone => 'hp_avl_zone',
|
53
|
+
:os_account_meta_temp_url_key => 'os_account_meta_temp_url_key',
|
54
|
+
:ibm_username => 'ibm_username',
|
55
|
+
:ibm_password => 'ibm_password',
|
56
|
+
:joyent_username => "joyentuser",
|
57
|
+
:joyent_password => "joyentpass",
|
58
|
+
:linode_api_key => 'linode_api_key',
|
59
|
+
:local_root => '~/.fog',
|
60
|
+
:bare_metal_cloud_password => 'bare_metal_cloud_password',
|
61
|
+
:bare_metal_cloud_username => 'bare_metal_cloud_username',
|
62
|
+
:ninefold_compute_key => 'ninefold_compute_key',
|
63
|
+
:ninefold_compute_secret => 'ninefold_compute_secret',
|
64
|
+
:ninefold_storage_secret => 'ninefold_storage_secret',
|
65
|
+
:ninefold_storage_token => 'ninefold_storage_token',
|
66
|
+
# :public_key_path => '~/.ssh/id_rsa.pub',
|
67
|
+
# :private_key_path => '~/.ssh/id_rsa',
|
68
|
+
:opennebula_endpoint => 'http://opennebula:2633/RPC2',
|
69
|
+
:opennebula_username => 'oneadmin',
|
70
|
+
:opennebula_password => 'oneadmin',
|
71
|
+
:openstack_api_key => 'openstack_api_key',
|
72
|
+
:openstack_username => 'openstack_username',
|
73
|
+
:openstack_tenant => 'openstack_tenant',
|
74
|
+
:openstack_auth_url => 'http://openstack:35357/v2.0/tokens',
|
75
|
+
:ovirt_url => 'http://ovirt:8080/api',
|
76
|
+
:ovirt_username => 'admin@internal',
|
77
|
+
:ovirt_password => '123123',
|
78
|
+
:profitbricks_username => 'profitbricks_username',
|
79
|
+
:profitbricks_password => 'profitbricks_password',
|
80
|
+
:libvirt_uri => 'qemu://libvirt/system',
|
81
|
+
:rackspace_api_key => 'rackspace_api_key',
|
82
|
+
:rackspace_region => 'dfw',
|
83
|
+
:rackspace_username => 'rackspace_username',
|
84
|
+
:riakcs_access_key_id => 'riakcs_access_key_id',
|
85
|
+
:riakcs_secret_access_key => 'riakcs_secret_access_key',
|
86
|
+
:sakuracloud_api_token => 'sakuracloud_api_token',
|
87
|
+
:sakuracloud_api_token_secret => 'sakuracloud_api_token_secret',
|
88
|
+
:storm_on_demand_username => 'storm_on_demand_username',
|
89
|
+
:storm_on_demand_password => 'storm_on_demand_password',
|
90
|
+
:vcloud_host => 'vcloud_host',
|
91
|
+
:vcloud_password => 'vcloud_password',
|
92
|
+
:vcloud_username => 'vcloud_username',
|
93
|
+
:vcloud_director_host => 'vcloud-director-host',
|
94
|
+
:vcloud_director_password => 'vcloud_director_password',
|
95
|
+
:vcloud_director_username => 'vcd_user@vcd_org_name',
|
96
|
+
:voxel_api_key => 'voxel_api_key',
|
97
|
+
:voxel_api_secret => 'voxel_api_secret',
|
98
|
+
:zerigo_email => 'zerigo_email',
|
99
|
+
:zerigo_token => 'zerigo_token',
|
100
|
+
:dynect_customer => 'dynect_customer',
|
101
|
+
:dynect_username => 'dynect_username',
|
102
|
+
:dynect_password => 'dynect_password',
|
103
|
+
:vsphere_server => 'virtualcenter.lan',
|
104
|
+
:vsphere_username => 'apiuser',
|
105
|
+
:vsphere_password => 'apipassword',
|
106
|
+
:vsphere_expected_pubkey_hash => 'abcdef1234567890',
|
107
|
+
:libvirt_uri => 'qemu:///system',
|
108
|
+
:libvirt_username => 'root',
|
109
|
+
:libvirt_password => 'password',
|
110
|
+
:cloudsigma_username => 'csuname',
|
111
|
+
:cloudsigma_password => 'cspass',
|
112
|
+
:docker_username => 'docker-fan',
|
113
|
+
:docker_password => 'i<3docker',
|
114
|
+
:docker_email => 'dockerfan@gmail.com',
|
115
|
+
:docker_url => 'unix://var/run/docker.sock'
|
116
|
+
}.merge(Fog.credentials)
|
117
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
def model_tests(collection, params = {}, mocks_implemented = true)
|
2
|
+
tests('success') do
|
3
|
+
|
4
|
+
@instance = collection.new(params)
|
5
|
+
|
6
|
+
tests("#save").succeeds do
|
7
|
+
pending if Fog.mocking? && !mocks_implemented
|
8
|
+
@instance.save
|
9
|
+
end
|
10
|
+
|
11
|
+
if block_given?
|
12
|
+
yield(@instance)
|
13
|
+
end
|
14
|
+
|
15
|
+
tests("#destroy").succeeds do
|
16
|
+
pending if Fog.mocking? && !mocks_implemented
|
17
|
+
@instance.destroy
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
# Generates a unique identifier with a random differentiator.
|
24
|
+
# Useful when rapidly re-running tests, so we don't have to wait
|
25
|
+
# serveral minutes for deleted objects to disappear from the API
|
26
|
+
# E.g. 'fog-test-1234'
|
27
|
+
def uniq_id(base_name = 'fog-test')
|
28
|
+
# random_differentiator
|
29
|
+
suffix = rand(65536).to_s(16).rjust(4, '0')
|
30
|
+
[base_name, suffix] * '-'
|
31
|
+
end
|
@@ -0,0 +1,107 @@
|
|
1
|
+
Shindo.tests('Fog::Schema::DataValidator', 'meta') do
|
2
|
+
|
3
|
+
validator = Fog::Schema::DataValidator.new
|
4
|
+
|
5
|
+
tests('#validate') do
|
6
|
+
|
7
|
+
tests('returns true') do
|
8
|
+
|
9
|
+
returns(true, 'when value matches schema expectation') do
|
10
|
+
validator.validate({"key" => "Value"}, {"key" => String})
|
11
|
+
end
|
12
|
+
|
13
|
+
returns(true, 'when values within an array all match schema expectation') do
|
14
|
+
validator.validate({"key" => [1, 2]}, {"key" => [Integer]})
|
15
|
+
end
|
16
|
+
|
17
|
+
returns(true, 'when nested values match schema expectation') do
|
18
|
+
validator.validate({"key" => {:nested_key => "Value"}}, {"key" => {:nested_key => String}})
|
19
|
+
end
|
20
|
+
|
21
|
+
returns(true, 'when collection of values all match schema expectation') do
|
22
|
+
validator.validate([{"key" => "Value"}, {"key" => "Value"}], [{"key" => String}])
|
23
|
+
end
|
24
|
+
|
25
|
+
returns(true, 'when collection is empty although schema covers optional members') do
|
26
|
+
validator.validate([], [{"key" => String}])
|
27
|
+
end
|
28
|
+
|
29
|
+
returns(true, 'when additional keys are passed and not strict') do
|
30
|
+
validator.validate({"key" => "Value", :extra => "Bonus"}, {"key" => String}, {:allow_extra_keys => true})
|
31
|
+
end
|
32
|
+
|
33
|
+
returns(true, 'when value is nil and schema expects NilClass') do
|
34
|
+
validator.validate({"key" => nil}, {"key" => NilClass})
|
35
|
+
end
|
36
|
+
|
37
|
+
returns(true, 'when value and schema match as hashes') do
|
38
|
+
validator.validate({}, {})
|
39
|
+
end
|
40
|
+
|
41
|
+
returns(true, 'when value and schema match as arrays') do
|
42
|
+
validator.validate([], [])
|
43
|
+
end
|
44
|
+
|
45
|
+
returns(true, 'when value is a Time') do
|
46
|
+
validator.validate({"time" => Time.now}, {"time" => Time})
|
47
|
+
end
|
48
|
+
|
49
|
+
returns(true, 'when key is missing but value should be NilClass (#1477)') do
|
50
|
+
validator.validate({}, {"key" => NilClass}, {:allow_optional_rules => true})
|
51
|
+
end
|
52
|
+
|
53
|
+
returns(true, 'when key is missing but value is nullable (#1477)') do
|
54
|
+
validator.validate({}, {"key" => Fog::Nullable::String}, {:allow_optional_rules => true})
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
tests('returns false') do
|
60
|
+
|
61
|
+
returns(false, 'when value does not match schema expectation') do
|
62
|
+
validator.validate({"key" => nil}, {"key" => String})
|
63
|
+
end
|
64
|
+
|
65
|
+
returns(false, 'when key formats do not match') do
|
66
|
+
validator.validate({"key" => "Value"}, {:key => String})
|
67
|
+
end
|
68
|
+
|
69
|
+
returns(false, 'when additional keys are passed and strict') do
|
70
|
+
validator.validate({"key" => "Missing"}, {})
|
71
|
+
end
|
72
|
+
|
73
|
+
returns(false, 'when some keys do not appear') do
|
74
|
+
validator.validate({}, {"key" => String})
|
75
|
+
end
|
76
|
+
|
77
|
+
returns(false, 'when collection contains a member that does not match schema') do
|
78
|
+
validator.validate([{"key" => "Value"}, {"key" => 5}], [{"key" => String}])
|
79
|
+
end
|
80
|
+
|
81
|
+
returns(false, 'when collection has multiple schema patterns') do
|
82
|
+
validator.validate([{"key" => "Value"}], [{"key" => Integer}, {"key" => String}])
|
83
|
+
end
|
84
|
+
|
85
|
+
returns(false, 'when hash and array are compared') do
|
86
|
+
validator.validate({}, [])
|
87
|
+
end
|
88
|
+
|
89
|
+
returns(false, 'when array and hash are compared') do
|
90
|
+
validator.validate([], {})
|
91
|
+
end
|
92
|
+
|
93
|
+
returns(false, 'when a hash is expected but another data type is found') do
|
94
|
+
validator.validate({"key" => {:nested_key => []}}, {"key" => {:nested_key => {}}})
|
95
|
+
end
|
96
|
+
|
97
|
+
returns(false, 'when key is missing but value should be NilClass (#1477)') do
|
98
|
+
validator.validate({}, {"key" => NilClass}, {:allow_optional_rules => false})
|
99
|
+
end
|
100
|
+
|
101
|
+
returns(false, 'when key is missing but value is nullable (#1477)') do
|
102
|
+
validator.validate({}, {"key" => Fog::Nullable::String}, {:allow_optional_rules => false})
|
103
|
+
end
|
104
|
+
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
Shindo.tests('Fog::Compute[:voxel] | image requests', ['voxel']) do
|
2
|
+
|
3
|
+
@images_format = {
|
4
|
+
'images' => [{
|
5
|
+
'id' => Integer,
|
6
|
+
'summary' => String
|
7
|
+
}],
|
8
|
+
'stat' => String
|
9
|
+
}
|
10
|
+
|
11
|
+
@image_format = {
|
12
|
+
'images' => [{
|
13
|
+
'description' => String,
|
14
|
+
'id' => Integer,
|
15
|
+
'filesystem' => {
|
16
|
+
'size' => Integer,
|
17
|
+
'type' => String,
|
18
|
+
'units' => String,
|
19
|
+
},
|
20
|
+
'operating_system' => {
|
21
|
+
'admin_username' => String,
|
22
|
+
'architecture' => Integer,
|
23
|
+
'family' => String,
|
24
|
+
'product_family' => String,
|
25
|
+
'product_version' => String,
|
26
|
+
'version' => String
|
27
|
+
},
|
28
|
+
'summary' => String
|
29
|
+
}],
|
30
|
+
'stat' => String
|
31
|
+
}
|
32
|
+
|
33
|
+
tests('success') do
|
34
|
+
tests('#images_list').formats(@images_format) do
|
35
|
+
pending if Fog.mocking?
|
36
|
+
Fog::Compute[:voxel].images_list.body
|
37
|
+
end
|
38
|
+
|
39
|
+
tests('#images_list(1)').formats(@image_format) do
|
40
|
+
pending if Fog.mocking?
|
41
|
+
Fog::Compute[:voxel].images_list(1).body
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
tests('failure') do
|
46
|
+
tests('#images_list(0)').raises(Fog::Compute::Voxel::Error) do
|
47
|
+
pending if Fog.mocking?
|
48
|
+
Fog::Compute[:voxel].images_list(0).body
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
@@ -0,0 +1,123 @@
|
|
1
|
+
Shindo.tests('Fog::Compute[:voxel] | server requests', ['voxel']) do
|
2
|
+
|
3
|
+
@server_format = {
|
4
|
+
'device' => {
|
5
|
+
'id' => String,
|
6
|
+
'last_update' => Time
|
7
|
+
},
|
8
|
+
'stat' => String
|
9
|
+
}
|
10
|
+
|
11
|
+
@devices_format = {
|
12
|
+
'devices' => [{
|
13
|
+
'access_methods' => [],
|
14
|
+
'description' => String,
|
15
|
+
'drives' => [{
|
16
|
+
'position' => Fog::Nullable::String,
|
17
|
+
'size' => Integer
|
18
|
+
}],
|
19
|
+
'id' => String,
|
20
|
+
'ipassignments' => [{
|
21
|
+
'description' => String,
|
22
|
+
'id' => String,
|
23
|
+
'type' => String,
|
24
|
+
'value' => String
|
25
|
+
}],
|
26
|
+
'label' => String,
|
27
|
+
'location' => {
|
28
|
+
'cage' => {
|
29
|
+
'id' => String,
|
30
|
+
'value' => String
|
31
|
+
},
|
32
|
+
'facility' => {
|
33
|
+
'code' => String,
|
34
|
+
'id' => String,
|
35
|
+
'value' => String
|
36
|
+
},
|
37
|
+
'position' => Fog::Nullable::String,
|
38
|
+
'rack' => {
|
39
|
+
'id' => String,
|
40
|
+
'value' => String
|
41
|
+
},
|
42
|
+
'row' => {
|
43
|
+
'id' => String,
|
44
|
+
'value' => String
|
45
|
+
},
|
46
|
+
'zone' => {
|
47
|
+
'id' => String,
|
48
|
+
'value' => String
|
49
|
+
}
|
50
|
+
},
|
51
|
+
'memory' => { 'size' => Integer },
|
52
|
+
'model' => {
|
53
|
+
'id' => String,
|
54
|
+
'value' => String
|
55
|
+
},
|
56
|
+
'operating_system' => {
|
57
|
+
'architecture' => Integer,
|
58
|
+
'name' => String
|
59
|
+
},
|
60
|
+
'power_consumption' => String,
|
61
|
+
'processor' => {
|
62
|
+
'cores' => Integer
|
63
|
+
},
|
64
|
+
'status' => String,
|
65
|
+
'type' => {
|
66
|
+
'id' => String,
|
67
|
+
'value' => String
|
68
|
+
},
|
69
|
+
}],
|
70
|
+
'stat' => String,
|
71
|
+
}
|
72
|
+
|
73
|
+
tests('success') do
|
74
|
+
|
75
|
+
@server_id = nil
|
76
|
+
@name = "fog.#{Time.now.to_i}"
|
77
|
+
|
78
|
+
tests("#voxcloud_create( :hostname => '#{@name}', :disk_size => 10, :processing_cores => 1, :image_id => 55, :facility => 'LDJ1' )").formats(@server_format) do
|
79
|
+
pending if Fog.mocking?
|
80
|
+
data = Fog::Compute[:voxel].voxcloud_create( :hostname => @name, :disk_size => 10, :processing_cores => 1, :image_id => 55, :facility => "LDJ1" ).body
|
81
|
+
@server_id = data['device']['id']
|
82
|
+
data
|
83
|
+
end
|
84
|
+
|
85
|
+
unless Fog.mocking?
|
86
|
+
Fog::Compute[:voxel].servers.get(@server_id).wait_for { ready? }
|
87
|
+
end
|
88
|
+
|
89
|
+
tests('#devices_list').formats(@devices_format) do
|
90
|
+
pending if Fog.mocking?
|
91
|
+
Fog::Compute[:voxel].devices_list.body
|
92
|
+
end
|
93
|
+
|
94
|
+
tests('#devices_list(@server_id)').formats(@devices_format) do
|
95
|
+
pending if Fog.mocking?
|
96
|
+
Fog::Compute[:voxel].devices_list(@server_id).body
|
97
|
+
end
|
98
|
+
|
99
|
+
tests("#voxcloud_delete(#{@server_id})").succeeds do
|
100
|
+
pending if Fog.mocking?
|
101
|
+
Fog::Compute[:voxel].voxcloud_delete(@server_id)
|
102
|
+
end
|
103
|
+
|
104
|
+
end
|
105
|
+
|
106
|
+
tests('failure') do
|
107
|
+
tests('#voxcloud_delete(0)').raises(Fog::Compute::Voxel::Error) do
|
108
|
+
pending if Fog.mocking?
|
109
|
+
Fog::Compute[:voxel].voxcloud_delete(0)
|
110
|
+
end
|
111
|
+
|
112
|
+
tests('#voxcloud_status(0)').raises(Fog::Compute::Voxel::Error) do
|
113
|
+
pending if Fog.mocking?
|
114
|
+
Fog::Compute[:voxel].voxcloud_status(0)
|
115
|
+
end
|
116
|
+
|
117
|
+
tests('#devices_list(0)').raises(Fog::Compute::Voxel::Error) do
|
118
|
+
pending if Fog.mocking?
|
119
|
+
Fog::Compute[:voxel].devices_list(0)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
end
|