Skip to content

Commit

Permalink
Merge pull request #88 from splunk/feature/add-integration-testing
Browse files Browse the repository at this point in the history
Adding integration testing to contentctl
  • Loading branch information
pyth0n1c authored Feb 15, 2024
2 parents cb6605e + 1c6c7f6 commit e246e36
Show file tree
Hide file tree
Showing 29 changed files with 2,574 additions and 458 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def sigint_handler(signum, frame):
instance_pool.submit(instance.execute): instance
for instance in self.detectionTestingInfrastructureObjects
}
# What for execution to finish
# Wait for execution to finish
for future in concurrent.futures.as_completed(future_instances_execute):
try:
result = future.result()
Expand All @@ -131,6 +131,7 @@ def sigint_handler(signum, frame):

self.output_dto.terminate = True

# Shut down all the views and wait for the shutdown to finish
future_views_shutdowner = {
view_shutdowner.submit(view.stop): view for view in self.input_dto.views
}
Expand All @@ -140,6 +141,7 @@ def sigint_handler(signum, frame):
except Exception as e:
print(f"Error stopping view: {str(e)}")

# Wait for original view-related threads to complete
for future in concurrent.futures.as_completed(future_views):
try:
result = future.result()
Expand Down
2 changes: 2 additions & 0 deletions contentctl/actions/detection_testing/GitService.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ def filter_detections_by_status(self, detections: list[Detection],
#print()
return [detection for detection in detections if DetectionStatus(detection.status) in statuses_to_test]

# TODO (cmcginley): consider listing Correlation type detections as skips rather than excluding
# them from results altogether?
def filter_detections_by_type(self, detections: list[Detection],
types_to_test: set[AnalyticsType] = {AnalyticsType.Anomaly, AnalyticsType.TTP, AnalyticsType.Hunting})->list[Detection]:
#print("\n".join(sorted([f"{detection.file_path[92:]} - {detection.type}" for detection in detections if AnalyticsType(detection.type) not in types_to_test])))
Expand Down
Loading

0 comments on commit e246e36

Please sign in to comment.