diff options
-rw-r--r-- | buildscripts/resmokelib/testing/fixtures/replicaset.py | 2 | ||||
-rw-r--r-- | buildscripts/resmokelib/testing/fixtures/shard_split.py | 17 |
2 files changed, 12 insertions, 7 deletions
diff --git a/buildscripts/resmokelib/testing/fixtures/replicaset.py b/buildscripts/resmokelib/testing/fixtures/replicaset.py index d9c463e29c9..e8f681c8f62 100644 --- a/buildscripts/resmokelib/testing/fixtures/replicaset.py +++ b/buildscripts/resmokelib/testing/fixtures/replicaset.py @@ -447,7 +447,7 @@ class ReplicaSetFixture(interface.ReplFixture): primary.mongo_client().admin.command(cmd) def _do_teardown(self, mode=None): - self.logger.info("Stopping all members of the replica set...") + self.logger.info("Stopping all members of the replica set '%s'...", self.replset_name) running_at_start = self.is_running() if not running_at_start: diff --git a/buildscripts/resmokelib/testing/fixtures/shard_split.py b/buildscripts/resmokelib/testing/fixtures/shard_split.py index ce80daf270c..18fba2304a9 100644 --- a/buildscripts/resmokelib/testing/fixtures/shard_split.py +++ b/buildscripts/resmokelib/testing/fixtures/shard_split.py @@ -16,11 +16,16 @@ def _is_replica_set_fixture(fixture): return hasattr(fixture, 'replset_name') -def _teardown_and_clean_node(node): - """Teardown the provided node and remove its data directory.""" - node.teardown(finished=True) +def _teardown_and_clean_fixture(fixture): + """Teardown the provided fixture, and remove its data directory.""" + # ReplicaSetFixtures in the shard split fixture share the same logger as the parent + # ShardSplitFixture instance. We only want to explicitly close the loggers if we are tearing + # down single recipient nodes (before they become a replica set). + should_close_logger = not _is_replica_set_fixture(fixture) + fixture.teardown(finished=should_close_logger) + # Remove the data directory for the node to prevent unbounded disk space utilization. - shutil.rmtree(node.get_dbpath_prefix(), ignore_errors=False) + shutil.rmtree(fixture.get_dbpath_prefix(), ignore_errors=False) class ShardSplitFixture(interface.MultiClusterFixture): @@ -358,7 +363,7 @@ class ShardSplitFixture(interface.MultiClusterFixture): self.logger.info("Tearing down recipient nodes and removing data directories.") for recipient_node in reversed(recipient_nodes): - _teardown_and_clean_node(recipient_node) + _teardown_and_clean_fixture(recipient_node) def replace_donor_with_recipient(self, recipient_set_name): """Replace the current donor with the newly initiated recipient.""" @@ -384,7 +389,7 @@ class ShardSplitFixture(interface.MultiClusterFixture): self._can_teardown_retired_donor_rs.wait() self.logger.info(f"Retiring old donor replica set '{retired_donor_rs.replset_name}'.") - _teardown_and_clean_node(retired_donor_rs) + _teardown_and_clean_fixture(retired_donor_rs) def enter_step_down(self): """Called by the ContinuousStepDown hook to indicate that we are stepping down.""" |