From e6aff9effea7ad508f0aad8093097f89573fbf21 Mon Sep 17 00:00:00 2001 From: Ignacio Bermudez Corrales Date: Fri, 19 Feb 2021 17:05:24 -0800 Subject: [PATCH] added test preview bare firehose --- .../run_ssa_smoketest.py | 5 ++++ .../tests/modules/__init__.py | 0 .../tests/modules/spl/test2.spl | 3 +- .../tests/modules/spl/test3.spl | 1 + .../modules/streams_service_api_helper.py | 4 +-- .../tests/test_ssa_detections_playground.py | 28 +++++++++++-------- 6 files changed, 26 insertions(+), 15 deletions(-) create mode 100644 bin/ssa-end-to-end-testing/tests/modules/__init__.py create mode 100644 bin/ssa-end-to-end-testing/tests/modules/spl/test3.spl diff --git a/bin/ssa-end-to-end-testing/run_ssa_smoketest.py b/bin/ssa-end-to-end-testing/run_ssa_smoketest.py index 980910eb12..8c4a3fae96 100644 --- a/bin/ssa-end-to-end-testing/run_ssa_smoketest.py +++ b/bin/ssa-end-to-end-testing/run_ssa_smoketest.py @@ -2,6 +2,11 @@ import sys import pytest import argparse +# import logging +# import os +# +# logging.basicConfig(level=os.environ.get("LOGLEVEL", "INFO")) +# LOGGER = logging.getLogger(__name__) def main(args): diff --git a/bin/ssa-end-to-end-testing/tests/modules/__init__.py b/bin/ssa-end-to-end-testing/tests/modules/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/bin/ssa-end-to-end-testing/tests/modules/spl/test2.spl b/bin/ssa-end-to-end-testing/tests/modules/spl/test2.spl index 62e1cfb3d4..d035fc7f36 100644 --- a/bin/ssa-end-to-end-testing/tests/modules/spl/test2.spl +++ b/bin/ssa-end-to-end-testing/tests/modules/spl/test2.spl @@ -17,5 +17,4 @@ | eval start_time = timestamp, end_time = timestamp, entities = mvappend(dest_device_id, dest_user_id), -body = "TBD" -| into write_null(); +body = "TBD"; diff --git a/bin/ssa-end-to-end-testing/tests/modules/spl/test3.spl b/bin/ssa-end-to-end-testing/tests/modules/spl/test3.spl new file mode 100644 index 0000000000..e70a2802e7 --- /dev/null +++ b/bin/ssa-end-to-end-testing/tests/modules/spl/test3.spl @@ -0,0 +1 @@ +| from splunk_firehose(); diff --git a/bin/ssa-end-to-end-testing/tests/modules/streams_service_api_helper.py b/bin/ssa-end-to-end-testing/tests/modules/streams_service_api_helper.py index 3fd7764996..e439c43746 100644 --- a/bin/ssa-end-to-end-testing/tests/modules/streams_service_api_helper.py +++ b/bin/ssa-end-to-end-testing/tests/modules/streams_service_api_helper.py @@ -16,7 +16,7 @@ from modules.utils import request_headers DSP_URL = f"https://api.playground.scp.splunk.com/research2/" STREAMS_ENDPOINT = f"{DSP_URL}streams/v3beta1/" -SEARCH_EDNPOINT = f"{DSP_URL}search/v2beta1/" +SEARCH_ENDPOINT = f"{DSP_URL}search/v2beta1/" # Streaming Pipelines REST endpoints CONNECTIONS_ENDPOINT = f"{STREAMS_ENDPOINT}connections" @@ -27,7 +27,7 @@ PIPELINES_REGISTRY_ENDPOINT = f"{PIPELINES_ENDPOINT}/registry" PREVIEW_SESSION_ENDPOINT = f"{STREAMS_ENDPOINT}preview-session" PREVIEW_DATA_ENDPOINT = f"{STREAMS_ENDPOINT}preview-data" INGEST_ENDPOINT = f"{DSP_URL}ingest/v1beta2/events" -SUBMIT_SEARCH_ENDPOINT = f"{SEARCH_EDNPOINT}jobs" +SUBMIT_SEARCH_ENDPOINT = f"{SEARCH_ENDPOINT}jobs" # Logger logging.basicConfig(level=os.environ.get("LOGLEVEL", "INFO")) diff --git a/bin/ssa-end-to-end-testing/tests/test_ssa_detections_playground.py b/bin/ssa-end-to-end-testing/tests/test_ssa_detections_playground.py index 826302f644..fa37acfecb 100644 --- a/bin/ssa-end-to-end-testing/tests/test_ssa_detections_playground.py +++ b/bin/ssa-end-to-end-testing/tests/test_ssa_detections_playground.py @@ -12,17 +12,7 @@ from modules.utils import read_spl, read_data logging.basicConfig(level=os.environ.get("LOGLEVEL", "INFO")) LOGGER = logging.getLogger(__name__) - -def test_ssa_detection_in_dsp_with_preview_session(token): - assert (token is not None), "scloud token is missing" - header_token = f"Bearer {token}" - - spl = read_spl('test2.spl') - - # pipeline_id = create_pipeline_from_spl(header_token, spl) - # assert pipeline_id is not None - # print(pipeline_id) - +def ssa_detection_in_dsp_with_preview_session(header_token, spl): preview_id = get_preview_id_from_spl(header_token, spl) assert preview_id is not None @@ -33,6 +23,22 @@ def test_ssa_detection_in_dsp_with_preview_session(token): assert response_body.get("currentNumberOfRecords") > 0, "Missing records in preview session." +def test_ssa_detection_test2(token): + assert (token is not None), "scloud token is missing" + header_token = f"Bearer {token}" + + spl = read_spl('test2.spl') + + ssa_detection_in_dsp_with_preview_session(header_token, spl) + +def test_ssa_detection_test3(token): + assert (token is not None), "scloud token is missing" + header_token = f"Bearer {token}" + + spl = read_spl('test3.spl') + + ssa_detection_in_dsp_with_preview_session(header_token, spl) + def test_ssa_detection_end_to_end(token): assert (token is not None), "scloud token is missing" token_formatted = f"Bearer {token}"