Skip to content

Commit

Permalink
Avoid sharing database name between testcase classes. (googleapis#4285)
Browse files Browse the repository at this point in the history
Abrupt shutdown (maybe CircleCI auto-cancellation?) can cause them not to be cleaned up.
  • Loading branch information
tseaver authored and chemelnucfin committed Nov 6, 2017
1 parent 2368e77 commit af35095
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions spanner/tests/system/test_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
else:
INSTANCE_ID = os.environ.get('GOOGLE_CLOUD_TESTS_SPANNER_INSTANCE',
'google-cloud-python-systest')
DATABASE_ID = 'test_database'
EXISTING_INSTANCES = []
COUNTERS_TABLE = 'counters'
COUNTERS_COLUMNS = ('name', 'value')
Expand Down Expand Up @@ -237,12 +236,13 @@ def _check_row_data(self, row_data, expected=None):


class TestDatabaseAPI(unittest.TestCase, _TestData):
DATABASE_NAME = 'test_database' + unique_resource_id('_')

@classmethod
def setUpClass(cls):
pool = BurstyPool()
cls._db = Config.INSTANCE.database(
DATABASE_ID, ddl_statements=DDL_STATEMENTS, pool=pool)
cls.DATABASE_NAME, ddl_statements=DDL_STATEMENTS, pool=pool)
cls._db.create()

@classmethod
Expand Down Expand Up @@ -376,6 +376,7 @@ def _unit_of_work(transaction, name):


class TestSessionAPI(unittest.TestCase, _TestData):
DATABASE_NAME = 'test_sessions' + unique_resource_id('_')
ALL_TYPES_TABLE = 'all_types'
ALL_TYPES_COLUMNS = (
'list_goes_on',
Expand Down Expand Up @@ -407,7 +408,7 @@ class TestSessionAPI(unittest.TestCase, _TestData):
def setUpClass(cls):
pool = BurstyPool()
cls._db = Config.INSTANCE.database(
DATABASE_ID, ddl_statements=DDL_STATEMENTS, pool=pool)
cls.DATABASE_NAME, ddl_statements=DDL_STATEMENTS, pool=pool)
operation = cls._db.create()
operation.result(30) # raises on failure / timeout.

Expand Down

0 comments on commit af35095

Please sign in to comment.