Skip to content

Commit 65ec644

Browse files
committed
fix handling of dropped encryption collections
1 parent 8ce517d commit 65ec644

File tree

3 files changed

+69
-53
lines changed

3 files changed

+69
-53
lines changed

test/asynchronous/unified_format.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,12 @@ async def insert_initial_data(self, initial_data):
483483
else:
484484
wc = WriteConcern(w=1)
485485

486+
# Remove any encryption collections associated with the collection.
487+
collections = await db.list_collection_names()
488+
for collection in collections:
489+
if collection in [f"enxcol_.{coll_name}.esc", f"enxcol_.{coll_name}.ecoc"]:
490+
await db.drop_collection(collection)
491+
486492
if documents:
487493
if opts:
488494
await db.create_collection(coll_name, **opts)
@@ -491,12 +497,6 @@ async def insert_initial_data(self, initial_data):
491497
# Ensure collection exists
492498
await db.create_collection(coll_name, write_concern=wc, **opts)
493499

494-
# Remove any encryption collections associated with the collection.
495-
collections = await db.list_collection_names()
496-
for collection in collections:
497-
if collection in [f"nxcol_{coll_name}.esc", "enxcol_{coll_name}.ecoc"]:
498-
await db.drop_collection(collection)
499-
500500
@classmethod
501501
def setUpClass(cls) -> None:
502502
# Speed up the tests by decreasing the heartbeat frequency.

test/unified_format.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,12 @@ def insert_initial_data(self, initial_data):
482482
else:
483483
wc = WriteConcern(w=1)
484484

485+
# Remove any encryption collections associated with the collection.
486+
collections = db.list_collection_names()
487+
for collection in collections:
488+
if collection in [f"enxcol_.{coll_name}.esc", f"enxcol_.{coll_name}.ecoc"]:
489+
db.drop_collection(collection)
490+
485491
if documents:
486492
if opts:
487493
db.create_collection(coll_name, **opts)
@@ -490,12 +496,6 @@ def insert_initial_data(self, initial_data):
490496
# Ensure collection exists
491497
db.create_collection(coll_name, write_concern=wc, **opts)
492498

493-
# Remove any encryption collections associated with the collection.
494-
collections = db.list_collection_names()
495-
for collection in collections:
496-
if collection in [f"nxcol_{coll_name}.esc", "enxcol_{coll_name}.ecoc"]:
497-
db.drop_collection(collection)
498-
499499
@classmethod
500500
def setUpClass(cls) -> None:
501501
# Speed up the tests by decreasing the heartbeat frequency.

0 commit comments

Comments
 (0)