feat: enhance test data cleanup by dropping MongoDB test database if applicable
Chore App Build, Test, and Push Docker Images / build-and-push (push) Successful in 2m22s
Chore App Build, Test, and Push Docker Images / build-and-push (push) Successful in 2m22s
This commit is contained in:
+25
-19
@@ -579,23 +579,29 @@ def ensure_mongodb_indexes(client=None, db_name=None):
|
|||||||
coll.create_index(keys, **kwargs)
|
coll.create_index(keys, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
# Clear test collections at import time so tests start with a clean slate.
|
# Clear test data at import time so tests start with a clean slate.
|
||||||
if os.environ.get('DB_ENV', 'prod') == 'test':
|
if os.environ.get('DB_ENV', 'prod') == 'test':
|
||||||
child_db.truncate()
|
if USE_MONGODB:
|
||||||
task_db.truncate()
|
# Drop the entire MongoDB test database for a fresh start. Only do this
|
||||||
routine_db.truncate()
|
# for clearly test/e2e database names as a safety guard.
|
||||||
routine_items_db.truncate()
|
if _mongo_db_name and _mongo_db_name.endswith(('_test', '_e2e')):
|
||||||
routine_schedules_db.truncate()
|
get_mongo_client().drop_database(_mongo_db_name)
|
||||||
routine_extensions_db.truncate()
|
else:
|
||||||
reward_db.truncate()
|
child_db.truncate()
|
||||||
image_db.truncate()
|
task_db.truncate()
|
||||||
pending_reward_db.truncate()
|
routine_db.truncate()
|
||||||
pending_confirmations_db.truncate()
|
routine_items_db.truncate()
|
||||||
users_db.truncate()
|
routine_schedules_db.truncate()
|
||||||
tracking_events_db.truncate()
|
routine_extensions_db.truncate()
|
||||||
child_overrides_db.truncate()
|
reward_db.truncate()
|
||||||
chore_schedules_db.truncate()
|
image_db.truncate()
|
||||||
task_extensions_db.truncate()
|
pending_reward_db.truncate()
|
||||||
refresh_tokens_db.truncate()
|
pending_confirmations_db.truncate()
|
||||||
push_subscriptions_db.truncate()
|
users_db.truncate()
|
||||||
digest_action_tokens_db.truncate()
|
tracking_events_db.truncate()
|
||||||
|
child_overrides_db.truncate()
|
||||||
|
chore_schedules_db.truncate()
|
||||||
|
task_extensions_db.truncate()
|
||||||
|
refresh_tokens_db.truncate()
|
||||||
|
push_subscriptions_db.truncate()
|
||||||
|
digest_action_tokens_db.truncate()
|
||||||
|
|||||||
Reference in New Issue
Block a user