Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test/test UI #1131

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 16 additions & 14 deletions ui_tests/tests/test_splunk_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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"],
Expand All @@ -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"],
Expand Down Expand Up @@ -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"],
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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"],
Expand All @@ -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",
Expand All @@ -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"],
Expand All @@ -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"],
Expand Down Expand Up @@ -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"],
Expand All @@ -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",
Expand All @@ -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"],
Expand All @@ -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"],
Expand Down
Loading