Skip to content

Commit 71ccd65

Browse files
test: creation of metric index (#39)
Added a test for the creation of a metric index. --------- Co-authored-by: kdoroszko-splunk <kdoroszko@splunk.com>
1 parent 81257a3 commit 71ccd65

3 files changed

Lines changed: 10 additions & 7 deletions

File tree

requirements-dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
pytest-splunk-addon==5.4.1
22
splunk-add-on-ucc-framework==5.58.0
3-
splunk-add-on-ucc-modinput-test==1.0.0
3+
splunk-add-on-ucc-modinput-test==2.0.0

tests/ucc_modinput_functional/splunk/forges.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -320,12 +320,10 @@ def another_account(
320320

321321

322322
def another_account_index(
323-
splunk_client: SplunkClient,
323+
splunk_client: SplunkClient, test_id: str, datatype: str = None
324324
) -> Generator[Dict[str, str], None, None]:
325-
index_name = f"idx_mit_another_account_{utils.Common().sufix}"
326-
splunk_client.create_index(
327-
index_name,
328-
)
325+
index_name = f"idx_mit_another_account_{test_id}".lower()
326+
splunk_client.create_index(index_name, datatype)
329327
yield {"another_account_index_name": index_name}
330328

331329

tests/ucc_modinput_functional/test_configuration.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ def test_accounts(
6060
assert actual_another_account["api_key"] == defaults.ENCRYPTED_VALUE
6161

6262

63+
# Test all types of indexes
64+
@pytest.mark.parametrize("datatype", ["event", "metric"])
6365
@bootstrap(
6466
forge(
6567
set_loglevel,
@@ -72,9 +74,12 @@ def test_accounts(
7274
# if more indexes are needed, they can be created as well
7375
),
7476
)
75-
def test_indexes(splunk_client: SplunkClient, another_account_index_name: str) -> None:
77+
def test_indexes(
78+
splunk_client: SplunkClient, another_account_index_name: str, datatype: str
79+
) -> None:
7680
actual_index = splunk_client.get_index(
7781
another_account_index_name,
7882
)
7983
assert actual_index is not None
8084
assert actual_index.name == another_account_index_name
85+
assert actual_index.content["datatype"] == datatype

0 commit comments

Comments
 (0)