diff --git a/tests/google/helpers/disk_helper.rb b/tests/google/helpers/disk_helper.rb index 424b8eea0..595cf5dd9 100644 --- a/tests/google/helpers/disk_helper.rb +++ b/tests/google/helpers/disk_helper.rb @@ -1,9 +1,13 @@ +require 'securerandom' + # create a disk to be used in tests def create_test_disk(connection, zone) zone = 'us-central1-a' + random_string = SecureRandom.hex + disk = connection.disks.create({ - :name => "fogservername", - :size_gb => "2", + :name => "fog-test-disk-#{random_string}", + :size_gb => "10", :zone => zone, :source_image => "debian-7-wheezy-v20140408", }) diff --git a/tests/google/models/compute/disk_tests.rb b/tests/google/models/compute/disk_tests.rb index c20f96305..f6f2c9fa6 100644 --- a/tests/google/models/compute/disk_tests.rb +++ b/tests/google/models/compute/disk_tests.rb @@ -1,5 +1,12 @@ Shindo.tests("Fog::Compute[:google] | disk model", ['google']) do - model_tests(Fog::Compute[:google].disks, {:name => 'fogdiskname', :zone => 'us-central1-a'}) + model_tests(Fog::Compute[:google].disks, {:name => 'fog-disk-model-tests', + :zone => 'us-central1-a', + :size_gb => 10}) do |model| + Fog.wait_for do + model.reload + model.status != 'CREATING' + end + end end diff --git a/tests/google/models/compute/disks_tests.rb b/tests/google/models/compute/disks_tests.rb index 95ba2837c..36de0490b 100644 --- a/tests/google/models/compute/disks_tests.rb +++ b/tests/google/models/compute/disks_tests.rb @@ -1,5 +1,7 @@ Shindo.tests("Fog::Compute[:google] | disks", ['google']) do - collection_tests(Fog::Compute[:google].disks, {:name => 'fogdiskname', :zone => 'us-central1-a'}) + collection_tests(Fog::Compute[:google].disks, {:name => 'fog-disks-collections-tests', + :zone => 'us-central1-a', + :size_gb => 10}) end diff --git a/tests/google/models/compute/server_tests.rb b/tests/google/models/compute/server_tests.rb index 3d5eae370..e66916683 100644 --- a/tests/google/models/compute/server_tests.rb +++ b/tests/google/models/compute/server_tests.rb @@ -1,9 +1,15 @@ +require 'securerandom' + Shindo.tests("Fog::Compute[:google] | server model", ['google']) do @zone = 'us-central1-a' @disk = create_test_disk(Fog::Compute[:google], @zone) + random_string = SecureRandom.hex - model_tests(Fog::Compute[:google].servers, {:name => 'fogservername', :zone_name => @zone, :machine_type => 'n1-standard-1', :disks => [@disk]}) + model_tests(Fog::Compute[:google].servers, {:name => "fog-test-server-#{random_string}", + :zone_name => @zone, + :machine_type => 'n1-standard-1', + :disks => [@disk]}) tests('servers') do @instance = nil diff --git a/tests/google/models/compute/servers_tests.rb b/tests/google/models/compute/servers_tests.rb index c511ab4ca..d6a46a167 100644 --- a/tests/google/models/compute/servers_tests.rb +++ b/tests/google/models/compute/servers_tests.rb @@ -1,8 +1,14 @@ +require 'securerandom' + Shindo.tests("Fog::Compute[:google] | servers", ['google']) do @zone = 'us-central1-a' @disk = create_test_disk(Fog::Compute[:google], @zone) + random_string = SecureRandom.hex - collection_tests(Fog::Compute[:google].servers, {:name => 'fogservername', :zone_name => @zone, :machine_type => 'n1-standard-1', :disks => [@disk]}) + collection_tests(Fog::Compute[:google].servers, {:name => "fog-test-server-#{random_string}", + :zone_name => @zone, + :machine_type => 'n1-standard-1', + :disks => [@disk]}) end diff --git a/tests/helpers/collection_helper.rb b/tests/helpers/collection_helper.rb index 5c3733f4d..99b1a7171 100644 --- a/tests/helpers/collection_helper.rb +++ b/tests/helpers/collection_helper.rb @@ -75,6 +75,7 @@ def collection_tests(collection, params = {}, mocks_implemented = true) end if !Fog.mocking? || mocks_implemented + puts @instance.inspect @instance.destroy end end diff --git a/tests/helpers/model_helper.rb b/tests/helpers/model_helper.rb index c31a60ca9..e026a7b32 100644 --- a/tests/helpers/model_helper.rb +++ b/tests/helpers/model_helper.rb @@ -9,7 +9,7 @@ def model_tests(collection, params = {}, mocks_implemented = true) end if block_given? - yield + yield(@instance) end tests("#destroy").succeeds do