Parcourir la source

The tests expect block storage to be available in all zones #39

As written, the tests for the block store service expect block storage
to be available in the same default zone as the instance created.

On our nectar cloud this is not necessarily true: block storage for a
given project may only be available in one of the zones. Hence the tests
attempt to create block storage in the same default zone as the instance
will most often fail.

This commit allows the zone a test instance is to be run in to be set:
and changes two of the block store tests to use the
helpers.get_provider_test_data(self.provider, 'placement') setting. In
this way the instance can be made to run in the same zone that block
storage is available in.
Martin Paulo il y a 9 ans
Parent
commit
0a88b2eeca
2 fichiers modifiés avec 8 ajouts et 3 suppressions
  1. 2 1
      test/helpers.py
  2. 6 2
      test/test_block_store_service.py

+ 2 - 1
test/helpers.py

@@ -132,12 +132,13 @@ def create_test_instance(
 
 
 def get_test_instance(provider, name, key_pair=None, security_groups=None,
-                      subnet=None):
+                      subnet=None, zone=None):
     launch_config = None
     instance = create_test_instance(
         provider,
         name,
         subnet=subnet,
+        zone=zone,
         key_pair=key_pair,
         security_groups=security_groups,
         launch_config=launch_config)

+ 6 - 2
test/test_block_store_service.py

@@ -107,7 +107,9 @@ class CloudBlockStoreServiceTestCase(ProviderTestBase):
             net, subnet = helpers.create_test_network(
                 self.provider, instance_name)
             test_instance = helpers.get_test_instance(
-                self.provider, instance_name, subnet=subnet)
+                self.provider, instance_name, subnet=subnet,
+                zone=helpers.get_provider_test_data(self.provider,
+                                                    'placement'))
             name = "CBUnitTestAttachVol-{0}".format(uuid.uuid4())
             test_vol = self.provider.block_store.volumes.create(
                 name, 1, test_instance.zone_id)
@@ -140,7 +142,9 @@ class CloudBlockStoreServiceTestCase(ProviderTestBase):
             net, subnet = helpers.create_test_network(
                 self.provider, instance_name)
             test_instance = helpers.get_test_instance(
-                self.provider, instance_name, subnet=subnet)
+                self.provider, instance_name, subnet=subnet,
+                zone=helpers.get_provider_test_data(self.provider,
+                                                    'placement'))
 
             name = "CBUnitTestVolProps-{0}".format(uuid.uuid4())
             test_vol = self.provider.block_store.volumes.create(