Skip to content

Commit

Permalink
fix: reducing index removal while using --splunk-cleanup to be done b…
Browse files Browse the repository at this point in the history
…y only one worker (#805)

Reducing index removal while using --splunk-cleanup to be done by only
one worker.
  • Loading branch information
kdoroszko-splunk authored Dec 12, 2023
1 parent 78d3a57 commit a6e13e2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pytest_splunk_addon/splunk.py
Original file line number Diff line number Diff line change
Expand Up @@ -771,8 +771,12 @@ def splunk_events_cleanup(request, splunk_search_util):
"""
if request.config.getoption("splunk_cleanup"):
LOGGER.info("Running the old events cleanup")
splunk_search_util.deleteEventsFromIndex()
if (
"PYTEST_XDIST_WORKER" not in os.environ
or os.environ.get("PYTEST_XDIST_WORKER") == "gw0"
):
LOGGER.info("Running the old events cleanup")
splunk_search_util.deleteEventsFromIndex()
else:
LOGGER.info("Events cleanup was disabled.")

Expand Down

0 comments on commit a6e13e2

Please sign in to comment.