Skip to content

Commit 16b3638

Browse files
authored
Harden spanner system tests further. (googleapis#4374)
Because of quota, we are sharing the instance we use to test CRUD of databases: we therefore cannot rely on having only the expected databases present, as other tests may be running simultaneously, or may have failed in ways which left 'stray' databases in the instance.
1 parent 3f3fbe4 commit 16b3638

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

spanner/tests/system/test_system.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -274,12 +274,10 @@ def test_create_database(self):
274274
# We want to make sure the operation completes.
275275
operation.result(30) # raises on failure / timeout.
276276

277-
name_attr = operator.attrgetter('name')
278-
expected = sorted([temp_db, self._db], key=name_attr)
279-
280-
databases = list(Config.INSTANCE.list_databases())
281-
found = sorted(databases, key=name_attr)
282-
self.assertEqual(found, expected)
277+
database_ids = [
278+
database.database_id
279+
for database in Config.INSTANCE.list_databases()]
280+
self.assertIn(temp_db_id, database_ids)
283281

284282
def test_update_database_ddl(self):
285283
pool = BurstyPool()

0 commit comments

Comments
 (0)