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

[rackspace] Fixes nesting of tests

Fog::Compute connection was called outside of the Shindo blocks and
failing if rackspace credentials were not present.
This commit is contained in:
Paul Thornthwaite 2013-01-17 10:33:17 +00:00
parent 281c33e214
commit b7b7f51b0b
10 changed files with 31 additions and 37 deletions

View file

@ -1,6 +1,5 @@
service = Fog::Rackspace::BlockStorage.new
Shindo.tests('Fog::Rackspace::BlockStorage | snapshot', ['rackspace']) do
service = Fog::Rackspace::BlockStorage.new
begin
volume = service.volumes.create({

View file

@ -1,6 +1,6 @@
Shindo.tests('Fog::Compute::RackspaceV2 | flavors', ['rackspace']) do
service = Fog::Compute::RackspaceV2.new
Shindo.tests('Fog::Compute::RackspaceV2 | flavors', ['rackspace']) do
tests("success") do
tests("#all").succeeds do
service.flavors.all

View file

@ -1,9 +1,8 @@
Shindo.tests('Fog::Compute::RackspaceV2 | image', ['rackspace']) do
service = Fog::Compute::RackspaceV2.new
flavor_id = Fog.credentials[:rackspace_flavor_id] || service.flavors.first.id
image_id = Fog.credentials[:rackspace_image_id] || service.images.first.id
Shindo.tests('Fog::Compute::RackspaceV2 | image', ['rackspace']) do
test_time = Time.now.to_i.to_s
options = {
:name => "fog_server_#{test_time}",

View file

@ -1,6 +1,5 @@
service = Fog::Compute::RackspaceV2.new
Shindo.tests('Fog::Compute::RackspaceV2 | images', ['rackspace']) do
service = Fog::Compute::RackspaceV2.new
image_id = nil

View file

@ -1,3 +1,4 @@
Shindo.tests('Fog::Compute::RackspaceV2 | server', ['rackspace']) do
service = Fog::Compute::RackspaceV2.new
cbs_service = Fog::Rackspace::BlockStorage.new
@ -5,8 +6,6 @@ flavor_id = Fog.credentials[:rackspace_flavor_id] || service.flavors.first.id
image_id = Fog.credentials[:rackspace_image_id] || service.images.first.id
image_id ||= Fog.mocking? ? service.images.first.id : service.images.find {|image| image.name =~ /Ubuntu/}.id # use the first Ubuntu image
Shindo.tests('Fog::Compute::RackspaceV2 | server', ['rackspace']) do
options = {
:name => "fog_server_#{Time.now.to_i.to_s}",
:flavor_id => flavor_id,

View file

@ -1,8 +1,8 @@
Shindo.tests('Fog::Compute::RackspaceV2 | servers', ['rackspace']) do
connection = Fog::Compute::RackspaceV2.new
flavor_id = Fog.credentials[:rackspace_flavor_id] || connection.flavors.first.id
image_id = Fog.credentials[:rackspace_image_id] || connection.images.first.id
Shindo.tests('Fog::Compute::RackspaceV2 | servers', ['rackspace']) do
options = {
:name => "fog_server_#{Time.now.to_i.to_s}",
:flavor_id => flavor_id,

View file

@ -1,5 +1,6 @@
timeout = Fog.mocking? ? 1 : 10
Shindo.tests('Fog::Rackspace::BlockStorage | snapshot_tests', ['rackspace']) do
timeout = Fog.mocking? ? 1 : 10
snapshot_format = {
'id' => String,
'status' => String,

View file

@ -1,11 +1,10 @@
Shindo.tests('Fog::Compute::RackspaceV2 | attachment_tests', ['rackspace']) do
compute_service = Fog::Compute::RackspaceV2.new
block_storage_service = Fog::Rackspace::BlockStorage.new
image_id = Fog.credentials[:rackspace_image_id] || compute_service.images.first.id
flavor_id = Fog.credentials[:rackspace_flavor_id] || compute_service.flavors.first.id
timeout = Fog.mocking? ? 1 : 10
Shindo.tests('Fog::Compute::RackspaceV2 | attachment_tests', ['rackspace']) do
attachment_format = {
'volumeAttachment' => {
'id' => String,

View file

@ -1,9 +1,8 @@
Shindo.tests('Fog::Compute::RackspaceV2 | image_tests', ['rackspace']) do
service = Fog::Compute.new(:provider => 'Rackspace', :version => 'V2')
flavor_id = Fog.credentials[:rackspace_flavor_id] || service.flavors.first.id
image_id = Fog.credentials[:rackspace_image_id] || service.images.first.id
Shindo.tests('Fog::Compute::RackspaceV2 | image_tests', ['rackspace']) do
image_format = {
'id' => String,
'name' => String,

View file

@ -1,10 +1,9 @@
Shindo.tests('Fog::Compute::RackspaceV2 | server_tests', ['rackspace']) do
service = Fog::Compute.new(:provider => 'Rackspace', :version => 'V2')
image_id = Fog.credentials[:rackspace_image_id]
image_id ||= Fog.mocking? ? service.images.first.id : service.images.find {|image| image.name =~ /Ubuntu/}.id # use the first Ubuntu image
flavor_id = Fog.credentials[:rackspace_flavor_id] || service.flavors.first.id
Shindo.tests('Fog::Compute::RackspaceV2 | server_tests', ['rackspace']) do
link_format = {
'href' => String,
'rel' => String