1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[ibm] Remove trailing whitespace

This commit is contained in:
Decklin Foster 2012-02-13 10:51:03 -05:00
parent eb8ff11cc9
commit 1b44269e00
13 changed files with 161 additions and 153 deletions

View file

@ -1,10 +1,10 @@
Shindo.tests('Fog::Compute[:ibm] | image', ['ibm']) do
@image_id = "20015393"
@image_id = "20015393"
@image = Fog::Compute[:ibm].images.get(@image_id)
tests('success') do
end
end
end

View file

@ -1,23 +1,23 @@
Shindo.tests('Fog::Compute[:ibm] | key', ['ibm']) do
tests('success') do
@key_name = "fog test key"
@key = nil
tests("Fog::Compute::IBM::Key.new('#{@key_name}')") do
@key = Fog::Compute[:ibm].keys.new({:name => @key_name})
returns(true) { @key.save }
end
tests("Fog::Compute::IBM::Key#instances") do
returns([]) { @key.instances }
end
tests('Fog::Compute::IBM::Key#destroy') do
returns(true) { @key.destroy }
end
end
end
end

View file

@ -1,35 +1,35 @@
Shindo.tests('Fog::Compute[:ibm] | keys', ['ibm']) do
tests('success') do
@key_name = "fog test key"
@key = nil
tests("Fog::Compute[:ibm].keys.create('#{@key_name}')") do
@key = Fog::Compute[:ibm].keys.create(@key_name)
returns(@key_name) { @key.name }
end
tests('Fog::Compute[:ibm].keys') do
returns(true) { Fog::Compute[:ibm].keys.length > 0 }
end
tests("Fog::Compute[:ibm].keys.default = '#{@key_name}'") do
returns(@key_name) { Fog::Compute[:ibm].keys.default = @key_name }
end
tests("Fog::Compute[:ibm].keys.default") do
@key = Fog::Compute[:ibm].keys.get(@key_name)
returns(@key.name) { Fog::Compute[:ibm].keys.default.name }
end
tests("Fog::Compute[:ibm].keys.get('#{@key_name}')") do
key = Fog::Compute[:ibm].keys.get(@key_name)
returns(@key_name) { key.name }
end
@key.destroy
end
end
end

View file

@ -1,18 +1,18 @@
Shindo.tests('Fog::Compute[:ibm] | locations', ['ibm']) do
tests('success') do
@location_id = "101"
tests('Fog::Compute[:ibm].locations') do
returns(true) { Fog::Compute[:ibm].locations.length > 0 }
end
tests('Fog::Compute[:ibm].locations.get("#{@location_id}")') do
@location = Fog::Compute[:ibm].locations.get(@location_id)
returns(@location_id) { @location.id }
returns(@location_id) { @location.id }
end
end
end
end

View file

@ -1,16 +1,16 @@
Shindo.tests('Fog::Compute[:ibm] | server', ['ibm']) do
tests('success') do
# TODO: Fix this for non-mock tests
@server = nil
@instance_id = nil
@name = "Fog Test Instance"
@image_id = "20015393"
@instance_type = "BRZ32.1/2048/60*175"
@location_id = "101"
@key_name = "test"
tests('Fog::Compute::IBM::Server.new') do
@server = Fog::Compute[:ibm].servers.new(
:name => @name,
@ -21,7 +21,7 @@ Shindo.tests('Fog::Compute[:ibm] | server', ['ibm']) do
)
returns(@name) { @server.name }
end
tests('Fog::Compute::IBM::Server#save') do
returns(true) { @server.save }
returns(String) { @server.id.class }
@ -32,7 +32,7 @@ Shindo.tests('Fog::Compute[:ibm] | server', ['ibm']) do
Fog::Compute[:ibm].servers.get(@instance_id).wait_for { ready? }
@server = Fog::Compute[:ibm].servers.last
end
tests('Fog::Compute::IBM::Server#id') do
returns(@instance_id) { @server.id }
end
@ -44,7 +44,7 @@ Shindo.tests('Fog::Compute[:ibm] | server', ['ibm']) do
tests('Fog::Compute::IBM::Server#status') do
returns("Active") { @server.status }
end
tests('Fog::Compute::IBM::Server#reboot') do
returns(true) { @server.reboot }
end
@ -54,11 +54,11 @@ Shindo.tests('Fog::Compute[:ibm] | server', ['ibm']) do
returns(true) { @server.rename(name) }
returns(name) { @server.name }
end
tests('Fog::Compute::IBM::Server#image') do
returns(@image_id) { @server.image.id }
end
tests('Fog::Compute::IBM::Server#to_image') do
data = @server.to_image(:name => @server.name)
returns(@server.name) { data['name'] }
@ -68,11 +68,11 @@ Shindo.tests('Fog::Compute[:ibm] | server', ['ibm']) do
tests('Fog::Compute::IBM::Server#expire!') do
returns(true) { @server.expire! }
end
tests('Fog::Compute::IBM::Server#destroy') do
returns(true) { @server.destroy }
end
end
end
end

View file

@ -1,19 +1,19 @@
Shindo.tests('Fog::Compute[:ibm] | servers', ['ibm']) do
tests('success') do
@instance_id = Fog::Compute[:ibm].create_instance.body["instances"][0]["id"]
@server = nil
tests('Fog::Compute[:ibm].servers') do
returns(1) { Fog::Compute[:ibm].servers.length }
end
tests('Fog::Compute[:ibm].servers.get("#{@instance_id}")') do
@server = Fog::Compute[:ibm].servers.get(@instance_id)
returns(@instance_id) { @server.id }
returns(@instance_id) { @server.id }
end
end
end
end

View file

@ -1,15 +1,15 @@
Shindo.tests('Fog::Compute[:ibm] | volume', ['ibm']) do
tests('success') do
@volume = nil
@volume_id = nil
@name = "fog test volume"
@name = "fog test volume"
@format = "raw"
@location_id = "101"
@size = "256"
@offering_id = "20001208"
tests('Fog::Compute::IBM::Volume.new') do
@volume = Fog::Compute[:ibm].volumes.new(
:name => @name,
@ -20,13 +20,13 @@ Shindo.tests('Fog::Compute[:ibm] | volume', ['ibm']) do
)
returns(@name) { @volume.name }
end
tests('Fog::Compute::IBM::Volume#save') do
returns(true) { @volume.save }
returns(String) { @volume.id.class }
@volume_id = @volume.id
end
tests("Fog::Compute::IBM::Volume#instance") do
returns(nil) { @volume.instance }
end
@ -34,7 +34,7 @@ Shindo.tests('Fog::Compute[:ibm] | volume', ['ibm']) do
tests("Fog::Compute::IBM::Volume#location") do
returns(Fog::Compute::IBM::Location) { @volume.location.class }
end
tests('Fog::Compute::IBM::Volume#id') do
returns(@volume_id) { @volume.id }
end
@ -53,7 +53,7 @@ Shindo.tests('Fog::Compute[:ibm] | volume', ['ibm']) do
tests('Fog::Compute::IBM::Volume#destroy') do
returns(true) { @volume.destroy }
end
end
end
end

View file

@ -1,10 +1,10 @@
Shindo.tests('Fog::Compute[:ibm] | address requests', ['ibm']) do
@address_format = {
"state" => Integer,
"offeringId"=> String,
"location" => String,
"ip" => String,
"state" => Integer,
"offeringId"=> String,
"location" => String,
"ip" => String,
"id" => String,
"mode" => Integer,
"hostname" => String,
@ -19,23 +19,23 @@ Shindo.tests('Fog::Compute[:ibm] | address requests', ['ibm']) do
@address_id = nil
@location_id = "101"
@offering_id = "20001223"
tests('success') do
tests("#create_address('#{@location_id}')").formats(@create_address_format) do
data = Fog::Compute[:ibm].create_address(@location_id).body
@address_id = data['id']
data
end
tests("#list_addresses").formats(@list_address_format) do
Fog::Compute[:ibm].list_addresses.body
end
tests("#delete_address('#{@address_id}')") do
returns(true) { Fog::Compute[:ibm].delete_address(@address_id).body['success'] }
end
end
end
end

View file

@ -14,17 +14,17 @@ Shindo.tests('Fog::Compute[:ibm] | image requests', ['ibm']) do
'description' => String,
'supportedInstanceTypes' => Array,
'manifest' => String,
'documentation' => String
'documentation' => String
}
# TODO: Actually check this format
@product_code_format = {
'detail' => String,
'label' => String,
'price' => @price_format,
'id' => String
'id' => String
}
# TODO: Actually check this format
@price_format = {
'rate' => Float,
@ -33,7 +33,7 @@ Shindo.tests('Fog::Compute[:ibm] | image requests', ['ibm']) do
'currencyCode' => String,
'pricePerQuantity' => Integer
}
@images_format = {
'images' => [ @image_format ]
}
@ -61,41 +61,41 @@ Shindo.tests('Fog::Compute[:ibm] | image requests', ['ibm']) do
tests('success') do
tests("#list_images").formats(@images_format) do
Fog::Compute[:ibm].list_images.body
end
tests('#get_image').formats(@image_format) do
Fog::Compute[:ibm].get_image("20015393").body
end
tests('#create_image').formats(@create_image_format) do
response = Fog::Compute[:ibm].create_instance(
@name,
@image_id,
@instance_type,
@location,
@public_key,
@name,
@image_id,
@instance_type,
@location,
@public_key,
@options
).body
@instance_id = response['instances'][0]['id']
data = Fog::Compute[:ibm].create_image(@instance_id, @image_name, "").body
@id = data['id']
data
data
end
tests('#clone_image') do
data = Fog::Compute[:ibm].clone_image(@image_id, "fog test clone image", "").body
@cloned_id = data['ImageID']
returns(String) { data['ImageID'].class }
end
tests('#delete_image') do
returns(true) { Fog::Compute[:ibm].delete_image(@id).body['success'] }
returns(true) { Fog::Compute[:ibm].delete_image(@cloned_id).body['success'] }
tests('#delete_image') do
returns(true) { Fog::Compute[:ibm].delete_image(@id).body['success'] }
returns(true) { Fog::Compute[:ibm].delete_image(@cloned_id).body['success'] }
end
end
end
end

View file

@ -1,5 +1,5 @@
Shindo.tests('Fog::Compute[:ibm] | instance requests', ['ibm']) do
@instance_format = {
'name' => String,
'location' => String,
@ -25,11 +25,11 @@ Shindo.tests('Fog::Compute[:ibm] | instance requests', ['ibm']) do
'expirationTime'=> Integer,
'owner' => String
}
@instances_format = {
'instances' => [ @instance_format ]
}
tests('success') do
@instance_id = nil
@ -38,7 +38,7 @@ Shindo.tests('Fog::Compute[:ibm] | instance requests', ['ibm']) do
@instance_type = "COP32.1/2048/60"
@location = "101"
@public_key = "test"
@expiration_time= (Time.now.tv_usec + 10000).to_f * 1000
@expiration_time= (Time.now.tv_usec + 10000).to_f * 1000
@options = {}
tests("#create_instance('#{@name}', '#{@image_id}', '#{@instance_type}', '#{@location}', '#{@public_key}', options)").formats(@instances_format) do
@ -46,21 +46,21 @@ Shindo.tests('Fog::Compute[:ibm] | instance requests', ['ibm']) do
@instance_id = response['instances'][0]['id']
response
end
tests("#get_instance('#{@instance_id}')").formats(@instance_format) do
response = Fog::Compute[:ibm].get_instance(@instance_id).body
end
Fog::Compute[:ibm].servers.get(@instance_id).wait_for { ready? }
tests("#list_instances").formats(@instances_format) do
instances = Fog::Compute[:ibm].list_instances.body
end
tests("#restart_instance('#{@instance_id}', '#{@public_key}')") do
returns(true) { Fog::Compute[:ibm].restart_instance(@instance_id, @public_key).body["success"] }
end
tests("#rename_instance('#{@instance_id}', '#{@name} 2')") do
returns(true) { Fog::Compute[:ibm].rename_instance(@instance_id, @name + " 2").body["success"] }
end
@ -68,20 +68,20 @@ Shindo.tests('Fog::Compute[:ibm] | instance requests', ['ibm']) do
tests("#set_instance_expiration('#{@instance_id}', '#{@expiration_time}')") do
returns(@expiration_time) { Fog::Compute[:ibm].set_instance_expiration(@instance_id, @expiration_time).body["expirationTime"] }
end
tests("#delete_instance('#{@instance_id}')") do
data = Fog::Compute[:ibm].delete_instance(@instance_id)
end
end
tests('failures') do
tests('#create_instance => 401') do
response = Fog::Compute[:ibm].create_instance("FAIL: 401", "123456", "12345", "101", "invalid")
returns("401") { response.status }
returns("401") { response.status }
end
end
end

View file

@ -1,5 +1,5 @@
Shindo.tests('Fog::Compute[:ibm] | key requests', ['ibm']) do
@key_format = {
'default' => Fog::Boolean,
'instanceIds' => Array,
@ -7,43 +7,51 @@ Shindo.tests('Fog::Compute[:ibm] | key requests', ['ibm']) do
'keyName' => String,
'lastModifiedTime' => Integer
}
@keys_format = {
'keys' => [ @key_format ]
}
tests('success') do
@key_name = "fog test key"
@public_key = <<-EOF
-----BEGIN RSA PUBLIC KEY-----
MIGJAoGBAL2nePLzDy1Z2Y64/Dz5QMmJN4S9xc6D8TbiKVe5YHeuNt3fCSYDJl9x
d/V5r2mUo4nGrEhum1ooX0rdk5CPugVxd3Tgovj87y3NRw9zAdeCB8omfrRwG4yu
x1z+ejqX1BSKYy+KvOT2RKiuLdIiodLsps5epovQFZmlymTIg/ODAgMBAAE=
-----END RSA PUBLIC KEY-----
-----END RSA PUBLIC KEY-----
EOF
@public_key.gsub!(/^\s{4}/, '')
tests("#create_key('#{@key_name}')").formats(@key_format) do
Fog::Compute[:ibm].create_key(@key_name).body
end
tests("#list_keys").formats(@keys_format) do
Fog::Compute[:ibm].list_keys.body
end
tests("#get_key('#{@key_name}')").formats(@key_format) do
Fog::Compute[:ibm].get_key(@key_name).body
end
tests("#set_default_key('#{@key_name}')") do
returns(@key_name) { Fog::Compute[:ibm].set_default_key(@key_name).body }
end
tests("#update_key('#{@key_name}', '#{@public_key}')") do
returns(true) { Fog::Compute[:ibm].update_key(@key_name, @public_key).body['success'] }
end
end
tests("#set_default_key('#{@key_name}')") do
returns(true) { Fog::Compute[:ibm].modify_key(@key_name, 'default' => true).body['success'] }
end
tests("#update_key('#{@key_name}', 'publicKey' => '#{@public_key}')") do
returns(true) { Fog::Compute[:ibm].modify_key(@key_name, 'publicKey' => @public_key).body['success'] }
end
tests("#delete_key('#{@key_name}')") do
returns(true) { Fog::Compute[:ibm].delete_key(@key_name).body['success'] }
end
@ -51,7 +59,7 @@ Shindo.tests('Fog::Compute[:ibm] | key requests', ['ibm']) do
tests("#upload_key('#{@key_name}', '#{@public_key}')") do
returns(true) { Fog::Compute[:ibm].upload_key(@key_name, @public_key).body['success'] }
end
end
end
end

View file

@ -1,5 +1,5 @@
Shindo.tests('Fog::Compute[:ibm] | location requests', ['ibm']) do
@location_format = {
'state' => Integer,
'location' => String,
@ -8,21 +8,21 @@ Shindo.tests('Fog::Compute[:ibm] | location requests', ['ibm']) do
'id' => String,
'description' => String
}
@locations_format = {
'locations' => [ @location_format ]
}
tests('success') do
tests("#list_locations").formats(@locations_format) do
Fog::Compute[:ibm].list_locations.body
end
tests('#get_locations').formats(@location_format) do
Fog::Compute[:ibm].get_location("101").body
end
end
end
end

View file

@ -1,85 +1,85 @@
Shindo.tests('Fog::Compute[:ibm] | volume requests', ['ibm']) do
@combined_volume_format = {
"id" => String,
"instanceId" => String,
"name" => String,
"format" => String,
"state" => Integer,
"size" => String,
"offeringId" => String,
"owner" => String,
"createdTime" => Integer,
"location" => String,
"productCodes" => Array,
"name" => String,
"format" => String,
"state" => Integer,
"size" => String,
"offeringId" => String,
"owner" => String,
"createdTime" => Integer,
"location" => String,
"productCodes" => Array,
"ioPrice" => {
"rate" => Float,
"unitOfMeasure" => String,
"countryCode" => String,
"effectiveDate" => Integer,
"currencyCode" => String,
"rate" => Float,
"unitOfMeasure" => String,
"countryCode" => String,
"effectiveDate" => Integer,
"currencyCode" => String,
"pricePerQuantity" => Integer,
}
}
@volumes_format = {
'volumes' => [ @combined_volume_format.reject { |k,v| k == "ioPrice" } ]
}
@volume_format = @combined_volume_format.reject { |k,v| k == "instanceId" }
tests('success') do
@volume_id = nil
@name = "fog test volume"
@name = "fog test volume"
@format = "raw"
@location_id = "101"
@size = "256"
@offering_id = "20001208"
@instance_id = nil
@image_id = "20015393"
@instance_type = "BRZ32.1/2048/60*175"
@location = "101"
@public_key = "test"
tests("#create_volume('#{@name}', '#{@format}', '#{@location_id}', '#{@size}', '#{@offering_id}')").formats(@volume_format) do
data = Fog::Compute[:ibm].create_volume(@name, @format, @location_id, @size, @offering_id).body
@volume_id = data['id']
data
end
tests("#list_volumes").formats(@volumes_format) do
Fog::Compute[:ibm].list_volumes.body
end
tests("#get_volume('#{@volume_id}')").formats(@volume_format) do
Fog::Compute[:ibm].get_volume(@volume_id).body
end
tests("#attach_volume('#{@instance_id}','#{@volume_id}')") do
@instance_id = Fog::Compute[:ibm].create_instance(
"fog test volume instance",
@image_id,
@instance_type,
@location,
@public_key,
@image_id,
@instance_type,
@location,
@public_key,
@options
).body['instances'][0]['id']
# TODO: Add assertions for this whenever it is properly supported
Fog::Compute[:ibm].attach_volume(@instance_id, @volume_id)
end
tests("#detach_volume('#{@instance_id}','#{@volume_id}')") do
# TODO: Add assertions for this whenever it is properly supported
Fog::Compute[:ibm].detach_volume(@instance_id, @volume_id)
Fog::Compute[:ibm].delete_instance(@instance_id)
end
tests("#delete_volume('#{@volume_id}')") do
returns(true) { Fog::Compute[:ibm].delete_volume(@volume_id).body['success'] }
returns(true) { Fog::Storage[:ibm].delete_volume(@volume_id).body['success'] }
end
end
end
end