Skip to content

Commit b58585d

Browse files
author
“deep-splunk”
committed
modification in test
1 parent 03162ed commit b58585d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

test/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def pytest_configure():
6969
producer.send(config["kafka_header_topic"], msg, headers=headers_to_send)
7070
producer.send("test_splunk_hec_malformed_events", {})
7171
producer.send("test_splunk_hec_malformed_events", {"&&": "null", "message": ["$$$$****////", 123, None]})
72-
producer.send("record_key",{"timestamp": config['timestamp']},bytes("record_key_test", 'utf-8'))
72+
producer.send("record_key",{"timestamp": config['timestamp']},b"{}")
7373
protobuf_producer.send("prototopic",value=b'\x00\x00\x00\x00\x01\x00\n\x011\x12\r10-01-04-3:45\x18\x15%\x00\x00*C*\x02No:\x12\n\x011\x12\x04this\x1a\x07New oneB\x0c\n\x011\x12\x07shampooJ\x04Many')
7474
timestamp_producer.send("date_format",b"{\"id\": \"19\",\"host\":\"host-01\",\"source\":\"bu\",\"fields\":{\"hn\":\"hostname\",\"CLASS\":\"class\",\"cust_id\":\"000013934\",\"time\": \"Jun 13 2010 23:11:52.454 UTC\",\"category\":\"IFdata\",\"ifname\":\"LoopBack7\",\"IFdata.Bits received\":\"0\",\"IFdata.Bits sent\":\"0\"}")
7575
timestamp_producer.send("epoch_format",b"{\"id\": \"19\",\"host\":\"host-01\",\"source\":\"bu\",\"fields\":{\"hn\":\"hostname\",\"CLASS\":\"class\",\"cust_id\":\"000013934\",\"time\": \"1555209605000\",\"category\":\"IFdata\",\"ifname\":\"LoopBack7\",\"IFdata.Bits received\":\"0\",\"IFdata.Bits sent\":\"0\"}")

test/testcases/test_data_enrichment.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ def test_line_breaking_configuration(self, setup, test_case, test_input, expecte
6161
f'\nActual value: \n{actual_raw_data} \ndoes not match expected value: \n{expected_data}'
6262

6363
@pytest.mark.parametrize("test_scenario, test_input, expected", [
64-
("record_key_extraction", "sourcetype::track_record_key", "record_key_test"),
64+
("record_key_extraction", "sourcetype::track_record_key", "{}"),
6565
])
6666
def test_record_key_data_enrichment(self, setup, test_scenario, test_input, expected):
6767
logger.info(f"testing {test_scenario} input={test_input} expected={expected} event(s)")
68-
search_query = f"index={setup['splunk_index']} | search {test_input}"
68+
search_query = f"index={setup['splunk_index']} | search {test_input} | fields *"
6969
logger.info(search_query)
7070
events = check_events_from_splunk(start_time="-15m@m",
7171
url=setup["splunkd_url"],
@@ -75,6 +75,6 @@ def test_record_key_data_enrichment(self, setup, test_scenario, test_input, expe
7575
logger.info("Splunk received %s events in the last hour", len(events))
7676

7777
if(len(events)==1):
78-
assert events[0]["fields"]["kafka_record_key"] == expected
78+
assert events[0]["kafka_record_key"] == expected
7979
else:
8080
assert False,"No event found or duplicate events found"

0 commit comments

Comments
 (0)