소스 검색

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 9 년 전
부모
커밋
0a88b2eeca
2개의 변경된 파일8개의 추가작업 그리고 3개의 파일을 삭제
  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(