From 2f4b6903a686d37eafdd4d239fd11fc9990f42b3 Mon Sep 17 00:00:00 2001 From: ajasnosz Date: Thu, 21 Nov 2024 16:13:49 +0100 Subject: [PATCH 1/3] test: test [run-int-tests] [run-ui-tests] From c83efc1bb4fc22130b0fc1fa0586710f93dbbcf4 Mon Sep 17 00:00:00 2001 From: ajasnosz Date: Thu, 21 Nov 2024 16:16:20 +0100 Subject: [PATCH 2/3] test: test [run-int-tests] [run-ui-tests] From 8a8cf942dee8ca2721d3191b65ee048fc049592b Mon Sep 17 00:00:00 2001 From: ajasnosz Date: Wed, 27 Nov 2024 10:54:48 +0100 Subject: [PATCH 3/3] test: test [run-ui-tests] --- ui_tests/tests/test_splunk_integration.py | 30 ++++++++++++----------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/ui_tests/tests/test_splunk_integration.py b/ui_tests/tests/test_splunk_integration.py index c864d1f2f..ca244d7f9 100644 --- a/ui_tests/tests/test_splunk_integration.py +++ b/ui_tests/tests/test_splunk_integration.py @@ -10,6 +10,8 @@ from splunk_search import check_events_from_splunk from webdriver.webriver_factory import WebDriverFactory +DEFAULT_PORT = 161 + logger = Logger().get_logger() driver = WebDriverFactory().get_driver() p_header = HeaderPage() @@ -77,7 +79,7 @@ def test_applying_changes_for_device_that_does_not_exists(setup): # check data in Splunk # check walk scheduled - search_query = f'index={config.LOGS_INDEX} "Sending due task sc4snmp;{host};walk"' + search_query = f'index={config.LOGS_INDEX} "Sending due task sc4snmp;{host}:{DEFAULT_PORT};walk"' events = check_events_from_splunk( start_time="-3m@m", url=setup["splunkd_url"], @@ -89,7 +91,7 @@ def test_applying_changes_for_device_that_does_not_exists(setup): assert len(events) == 1 # check no profiles polling - search_query = f'index={config.LOGS_INDEX} "Sending due task sc4snmp;{host};*;poll"' + search_query = f'index={config.LOGS_INDEX} "Sending due task sc4snmp;{host}:{DEFAULT_PORT};*;poll"' events = check_events_from_splunk( start_time="-3m@m", url=setup["splunkd_url"], @@ -175,7 +177,7 @@ def test_setting_group_in_inventory(setup): # check data in Splunk # check walk scheduled - search_query = f'index={config.LOGS_INDEX} "Sending due task sc4snmp;{host};walk"' + search_query = f'index={config.LOGS_INDEX} "Sending due task sc4snmp;{host}:{DEFAULT_PORT};walk"' events = check_events_from_splunk( start_time="-2m@m", url=setup["splunkd_url"], @@ -188,7 +190,7 @@ def test_setting_group_in_inventory(setup): # check profiles polling search_query = ( - f'index={config.LOGS_INDEX} "Sending due task sc4snmp;{host};12;poll"' + f'index={config.LOGS_INDEX} "Sending due task sc4snmp;{host}:{DEFAULT_PORT};12;poll"' ) events = check_events_from_splunk( start_time="-1m@m", @@ -202,7 +204,7 @@ def test_setting_group_in_inventory(setup): # checking smart profiles not working search_query = ( - f'index={config.LOGS_INDEX} "Sending due task sc4snmp;{host};600;poll"' + f'index={config.LOGS_INDEX} "Sending due task sc4snmp;{host}:{DEFAULT_PORT};600;poll"' ) events = check_events_from_splunk( start_time="-2m@m", @@ -216,7 +218,7 @@ def test_setting_group_in_inventory(setup): # checking polling for mandatory profile - 1200 - this should be visible even when smart profiles are disabled search_query = ( - f'index={config.LOGS_INDEX} "Sending due task sc4snmp;{host};1200;poll"' + f'index={config.LOGS_INDEX} "Sending due task sc4snmp;{host}:{DEFAULT_PORT};1200;poll"' ) events = check_events_from_splunk( start_time="-2m@m", @@ -316,7 +318,7 @@ def test_setting_host_in_inventory(setup): # check data in Splunk # check walk scheduled - search_query = f'index={config.LOGS_INDEX} "Sending due task sc4snmp;{host};walk"' + search_query = f'index={config.LOGS_INDEX} "Sending due task sc4snmp;{host}:{DEFAULT_PORT};walk"' events = check_events_from_splunk( start_time="-1m@m", url=setup["splunkd_url"], @@ -330,7 +332,7 @@ def test_setting_host_in_inventory(setup): # check profiles polling time.sleep(60) # wait to be sure that profile are being polled search_query = ( - f'index={config.LOGS_INDEX} "Sending due task sc4snmp;{host};10;poll"' + f'index={config.LOGS_INDEX} "Sending due task sc4snmp;{host}:{DEFAULT_PORT};10;poll"' ) events = check_events_from_splunk( start_time="-1m@m", @@ -342,7 +344,7 @@ def test_setting_host_in_inventory(setup): logger.info("Splunk received %s events in the last minute", len(events)) assert len(events) > 1 - search_query = f'index={config.LOGS_INDEX} "Sending due task sc4snmp;{host};7;poll"' + search_query = f'index={config.LOGS_INDEX} "Sending due task sc4snmp;{host}:{DEFAULT_PORT};7;poll"' events = check_events_from_splunk( start_time="-1m@m", url=setup["splunkd_url"], @@ -354,7 +356,7 @@ def test_setting_host_in_inventory(setup): assert len(events) > 1 # checking smart/base profiles - search_query = f'index={config.LOGS_INDEX} "Sending due task sc4snmp;{host};5;poll"' + search_query = f'index={config.LOGS_INDEX} "Sending due task sc4snmp;{host}:{DEFAULT_PORT};5;poll"' events = check_events_from_splunk( start_time="-1m@m", url=setup["splunkd_url"], @@ -390,7 +392,7 @@ def test_setting_host_in_inventory(setup): time.sleep(time_to_upgrade + 70) # wait for upgrade + walk time + polling # check walk scheduled - search_query = f'index={config.LOGS_INDEX} "Sending due task sc4snmp;{host};walk"' + search_query = f'index={config.LOGS_INDEX} "Sending due task sc4snmp;{host}:{DEFAULT_PORT};walk"' events = check_events_from_splunk( start_time="-1m@m", url=setup["splunkd_url"], @@ -404,7 +406,7 @@ def test_setting_host_in_inventory(setup): # check profiles polling time.sleep(60) # wait to be sure that disabled profile is no more polled search_query = ( - f'index={config.LOGS_INDEX} "Sending due task sc4snmp;{host};10;poll"' + f'index={config.LOGS_INDEX} "Sending due task sc4snmp;{host}:{DEFAULT_PORT};10;poll"' ) events = check_events_from_splunk( start_time="-1m@m", @@ -416,7 +418,7 @@ def test_setting_host_in_inventory(setup): logger.info("Splunk received %s events in the last minute", len(events)) assert len(events) == 0 - search_query = f'index={config.LOGS_INDEX} "Sending due task sc4snmp;{host};7;poll"' + search_query = f'index={config.LOGS_INDEX} "Sending due task sc4snmp;{host}:{DEFAULT_PORT};7;poll"' events = check_events_from_splunk( start_time="-1m@m", url=setup["splunkd_url"], @@ -428,7 +430,7 @@ def test_setting_host_in_inventory(setup): assert len(events) > 1 # checking smart/base profiles - no polling - search_query = f'index={config.LOGS_INDEX} "Sending due task sc4snmp;{host};5;poll"' + search_query = f'index={config.LOGS_INDEX} "Sending due task sc4snmp;{host}:{DEFAULT_PORT};5;poll"' events = check_events_from_splunk( start_time="-1m@m", url=setup["splunkd_url"],