Skip to content

Commit

Permalink
Merge pull request #185 from splunk/emit_summary_if_no_detections_tested
Browse files Browse the repository at this point in the history
Emit summary if no detections tested
  • Loading branch information
pyth0n1c authored Jul 9, 2024
2 parents 904ed46 + 7b25c2e commit 93d689c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion contentctl/actions/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ def execute(self, input_dto: TestInputDto) -> bool:

if len(input_dto.detections) == 0:
print(f"With Detection Testing Mode '{input_dto.config.getModeName()}', there were [0] detections found to test.\nAs such, we will quit immediately.")
# Directly call stop so that the summary.yml will be generated. Of course it will not have any test results, but we still want it to contain
# a summary showing that now detections were tested.
file.stop()
else:
print(f"MODE: [{input_dto.config.getModeName()}] - Test [{len(input_dto.detections)}] detections")
if input_dto.config.mode in [DetectionTestingMode.changes, DetectionTestingMode.selected]:
Expand All @@ -98,7 +101,7 @@ def execute(self, input_dto: TestInputDto) -> bool:

manager.setup()
manager.execute()

try:
summary_results = file.getSummaryObject()
summary = summary_results.get("summary", {})
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "contentctl"
version = "4.1.0"
version = "4.1.1"
description = "Splunk Content Control Tool"
authors = ["STRT <[email protected]>"]
license = "Apache 2.0"
Expand Down

0 comments on commit 93d689c

Please sign in to comment.