Skip to content

Commit a6e13e2

Browse files
fix: reducing index removal while using --splunk-cleanup to be done by only one worker (#805)
Reducing index removal while using --splunk-cleanup to be done by only one worker.
1 parent 78d3a57 commit a6e13e2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pytest_splunk_addon/splunk.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -771,8 +771,12 @@ def splunk_events_cleanup(request, splunk_search_util):
771771
772772
"""
773773
if request.config.getoption("splunk_cleanup"):
774-
LOGGER.info("Running the old events cleanup")
775-
splunk_search_util.deleteEventsFromIndex()
774+
if (
775+
"PYTEST_XDIST_WORKER" not in os.environ
776+
or os.environ.get("PYTEST_XDIST_WORKER") == "gw0"
777+
):
778+
LOGGER.info("Running the old events cleanup")
779+
splunk_search_util.deleteEventsFromIndex()
776780
else:
777781
LOGGER.info("Events cleanup was disabled.")
778782

0 commit comments

Comments
 (0)