Skip to content

Commit 5148bcb

Browse files
test: Updated doc and wait for uf method
1 parent 1a4e8ac commit 5148bcb

File tree

2 files changed

+43
-3
lines changed

2 files changed

+43
-3
lines changed

docs/release_history.rst

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,18 @@ Release History
88

99
The best way to track the development of pytest-splunk-addon is through `the GitHub Repo <https://github.com/splunk/pytest-splunk-addon/>`_.
1010

11-
1.4.0
11+
1.5.0
12+
"""""""""""""""""""""""""
13+
**Changes:**
14+
15+
* Added support for ingestion of data via pytest-splunk-addon with a user-defined index ``index = <index_name>``.
16+
17+
**Known Issues:**
18+
19+
* Event ingestion through SC4S via UDP port
20+
* Fields for modular regular expressions are not extracted in the plugin.
21+
22+
1.4.0 (2021-01-05)
1223
""""""""""""""""""""""""""
1324
**Changes:**
1425

@@ -20,7 +31,7 @@ The best way to track the development of pytest-splunk-addon is through `the Git
2031
* Fields for modular regular expressions are not extracted in the plugin.
2132

2233

23-
1.3.15
34+
1.3.15 (2020-12-16)
2435
""""""""""""""""""""""""""
2536
**Changes:**
2637

pytest_splunk_addon/splunk.py

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ def uf(request):
429429
uf["uf_username"] = request.config.getoption("splunk_uf_user")
430430
uf["uf_password"] = request.config.getoption("splunk_uf_password")
431431
for _ in range(RESPONSIVE_SPLUNK_TIMEOUT):
432-
if is_responsive_splunk(uf):
432+
if is_responsive_uf(uf):
433433
break
434434
sleep(1)
435435
yield uf
@@ -708,6 +708,35 @@ def file_system_prerequisite():
708708
shutil.rmtree(UF_FILE_MONTOR_DIR, ignore_errors=True)
709709
os.mkdir(monitor_dir)
710710

711+
def is_responsive_uf(uf):
712+
"""
713+
Verify if the management port of Universal Forwarder is responsive or not
714+
715+
Args:
716+
uf (dict): details of the Universal Forwarder instance
717+
718+
Returns:
719+
bool: True if Universal Forwarder is responsive. False otherwise
720+
"""
721+
try:
722+
LOGGER.info(
723+
"Trying to connect Universal Forwarder instance... splunk=%s", json.dumps(uf),
724+
)
725+
client.connect(
726+
username=uf["uf_username"],
727+
password=uf["uf_password"],
728+
host=uf["uf_host"],
729+
port=uf["uf_port"],
730+
)
731+
LOGGER.info("Connected to Universal Forwarder instance.")
732+
733+
return True
734+
except Exception as e:
735+
LOGGER.warning(
736+
"Could not connect to Universal Forwarder Instance. Will try again. exception=%s", str(e),
737+
)
738+
return False
739+
711740
def is_responsive_splunk(splunk):
712741
"""
713742
Verify if the management port of Splunk is responsive or not

0 commit comments

Comments
 (0)