Skip to content

Commit 7d6ad43

Browse files
committed
fix cleaning up of stale databases
1 parent d6d5c48 commit 7d6ad43

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

tests/system/_helpers.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,19 @@ def scrub_instance_ignore_not_found(to_scrub):
115115
"""Helper for func:`cleanup_old_instances`"""
116116
scrub_instance_backups(to_scrub)
117117

118+
for database_pb in to_scrub.list_databases():
119+
db = to_scrub.database(database_pb.name.split("/")[-1])
120+
try:
121+
if db.enable_drop_protection:
122+
db.enable_drop_protection = False
123+
operation = db.update(["enable_drop_protection"])
124+
operation.result(DATABASE_OPERATION_TIMEOUT_IN_SECONDS)
125+
except exceptions.NotFound:
126+
pass
127+
118128
try:
119129
retry_429_503(to_scrub.delete)()
120-
except exceptions.NotFound: # lost the race
130+
except exceptions.NotFound:
121131
pass
122132

123133

0 commit comments

Comments
 (0)