From f8c6670466303a1bab118e7a20a451fff65e72aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Dzie=C5=84?= Date: Tue, 5 Aug 2025 11:40:45 +0200 Subject: [PATCH 1/2] test: creation of metric index --- requirements-dev.txt | 2 +- tests/ucc_modinput_functional/splunk/forges.py | 8 +++----- tests/ucc_modinput_functional/test_configuration.py | 7 ++++++- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index bc76570..64a2031 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,3 +1,3 @@ pytest-splunk-addon==5.4.1 splunk-add-on-ucc-framework==5.58.0 -splunk-add-on-ucc-modinput-test==1.0.0 +splunk-add-on-ucc-modinput-test @ git+https://github.com/splunk/addonfactory-ucc-test.git@feat/metric-index diff --git a/tests/ucc_modinput_functional/splunk/forges.py b/tests/ucc_modinput_functional/splunk/forges.py index b5b84f0..ca8d782 100644 --- a/tests/ucc_modinput_functional/splunk/forges.py +++ b/tests/ucc_modinput_functional/splunk/forges.py @@ -320,12 +320,10 @@ def another_account( def another_account_index( - splunk_client: SplunkClient, + splunk_client: SplunkClient, test_id: str, datatype: str = None ) -> Generator[Dict[str, str], None, None]: - index_name = f"idx_mit_another_account_{utils.Common().sufix}" - splunk_client.create_index( - index_name, - ) + index_name = f"idx_mit_another_account_{test_id}".lower() + splunk_client.create_index(index_name, datatype) yield {"another_account_index_name": index_name} diff --git a/tests/ucc_modinput_functional/test_configuration.py b/tests/ucc_modinput_functional/test_configuration.py index 83b46fb..4fa7d7d 100644 --- a/tests/ucc_modinput_functional/test_configuration.py +++ b/tests/ucc_modinput_functional/test_configuration.py @@ -60,6 +60,8 @@ def test_accounts( assert actual_another_account["api_key"] == defaults.ENCRYPTED_VALUE +# Test all types of indexes +@pytest.mark.parametrize("datatype", ["event", "metric"]) @bootstrap( forge( set_loglevel, @@ -72,9 +74,12 @@ def test_accounts( # if more indexes are needed, they can be created as well ), ) -def test_indexes(splunk_client: SplunkClient, another_account_index_name: str) -> None: +def test_indexes( + splunk_client: SplunkClient, another_account_index_name: str, datatype: str +) -> None: actual_index = splunk_client.get_index( another_account_index_name, ) assert actual_index is not None assert actual_index.name == another_account_index_name + assert actual_index.content["datatype"] == datatype From 79846804e19f281560ab2b871c3311cf3ca89bf6 Mon Sep 17 00:00:00 2001 From: kdoroszko-splunk Date: Mon, 11 Aug 2025 11:54:57 +0200 Subject: [PATCH 2/2] chore: bump ucc-modinput-test version --- requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index 64a2031..e3a42d3 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,3 +1,3 @@ pytest-splunk-addon==5.4.1 splunk-add-on-ucc-framework==5.58.0 -splunk-add-on-ucc-modinput-test @ git+https://github.com/splunk/addonfactory-ucc-test.git@feat/metric-index +splunk-add-on-ucc-modinput-test==2.0.0