spl2-testing-framework 1.8.6__tar.gz → 1.8.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {spl2_testing_framework-1.8.6 → spl2_testing_framework-1.8.7}/PKG-INFO +2 -1
- {spl2_testing_framework-1.8.6 → spl2_testing_framework-1.8.7}/README.md +1 -0
- {spl2_testing_framework-1.8.6 → spl2_testing_framework-1.8.7}/pyproject.toml +1 -1
- {spl2_testing_framework-1.8.6 → spl2_testing_framework-1.8.7}/spl2_testing_framework/conftest.py +9 -0
- {spl2_testing_framework-1.8.6 → spl2_testing_framework-1.8.7}/spl2_testing_framework/tools/results.py +10 -0
- {spl2_testing_framework-1.8.6 → spl2_testing_framework-1.8.7}/spl2_testing_framework/tools/spl2test_runner.py +6 -4
- {spl2_testing_framework-1.8.6 → spl2_testing_framework-1.8.7}/LICENSE +0 -0
- {spl2_testing_framework-1.8.6 → spl2_testing_framework-1.8.7}/spl2_testing_framework/__init__.py +0 -0
- {spl2_testing_framework-1.8.6 → spl2_testing_framework-1.8.7}/spl2_testing_framework/launch_remotely_spl2.py +0 -0
- {spl2_testing_framework-1.8.6 → spl2_testing_framework-1.8.7}/spl2_testing_framework/logger_manager.py +0 -0
- {spl2_testing_framework-1.8.6 → spl2_testing_framework-1.8.7}/spl2_testing_framework/pytest.ini.sample +0 -0
- {spl2_testing_framework-1.8.6 → spl2_testing_framework-1.8.7}/spl2_testing_framework/single_spl2_file_runner.py +0 -0
- {spl2_testing_framework-1.8.6 → spl2_testing_framework-1.8.7}/spl2_testing_framework/spl2_test_config.json +0 -0
- {spl2_testing_framework-1.8.6 → spl2_testing_framework-1.8.7}/spl2_testing_framework/spl2_utils/assertions.spl2 +0 -0
- {spl2_testing_framework-1.8.6 → spl2_testing_framework-1.8.7}/spl2_testing_framework/spl2_utils/logs_to_metrics.spl2 +0 -0
- {spl2_testing_framework-1.8.6 → spl2_testing_framework-1.8.7}/spl2_testing_framework/splunk_setup.py +0 -0
- {spl2_testing_framework-1.8.6 → spl2_testing_framework-1.8.7}/spl2_testing_framework/test_runner.py +0 -0
- {spl2_testing_framework-1.8.6 → spl2_testing_framework-1.8.7}/spl2_testing_framework/tools/__init__.py +0 -0
- {spl2_testing_framework-1.8.6 → spl2_testing_framework-1.8.7}/spl2_testing_framework/tools/create_diff_sheet.py +0 -0
- {spl2_testing_framework-1.8.6 → spl2_testing_framework-1.8.7}/spl2_testing_framework/tools/jobs/__init__.py +0 -0
- {spl2_testing_framework-1.8.6 → spl2_testing_framework-1.8.7}/spl2_testing_framework/tools/jobs/cli_job.py +0 -0
- {spl2_testing_framework-1.8.6 → spl2_testing_framework-1.8.7}/spl2_testing_framework/tools/jobs/cloud_job.py +0 -0
- {spl2_testing_framework-1.8.6 → spl2_testing_framework-1.8.7}/spl2_testing_framework/tools/jobs/job.py +0 -0
- {spl2_testing_framework-1.8.6 → spl2_testing_framework-1.8.7}/spl2_testing_framework/tools/jobs/splunk_job.py +0 -0
- {spl2_testing_framework-1.8.6 → spl2_testing_framework-1.8.7}/spl2_testing_framework/tools/jobs/test_cloud_job.py +0 -0
- {spl2_testing_framework-1.8.6 → spl2_testing_framework-1.8.7}/spl2_testing_framework/tools/performance.py +0 -0
- {spl2_testing_framework-1.8.6 → spl2_testing_framework-1.8.7}/spl2_testing_framework/tools/search_clients/__init__.py +0 -0
- {spl2_testing_framework-1.8.6 → spl2_testing_framework-1.8.7}/spl2_testing_framework/tools/search_clients/cli_search_client.py +0 -0
- {spl2_testing_framework-1.8.6 → spl2_testing_framework-1.8.7}/spl2_testing_framework/tools/search_clients/cloud_search_client.py +0 -0
- {spl2_testing_framework-1.8.6 → spl2_testing_framework-1.8.7}/spl2_testing_framework/tools/search_clients/search_client.py +0 -0
- {spl2_testing_framework-1.8.6 → spl2_testing_framework-1.8.7}/spl2_testing_framework/tools/search_clients/splunk_search_client.py +0 -0
- {spl2_testing_framework-1.8.6 → spl2_testing_framework-1.8.7}/spl2_testing_framework/tools/splunk_integration/__init__.py +0 -0
- {spl2_testing_framework-1.8.6 → spl2_testing_framework-1.8.7}/spl2_testing_framework/tools/splunk_integration/splunk_handler.py +0 -0
- {spl2_testing_framework-1.8.6 → spl2_testing_framework-1.8.7}/spl2_testing_framework/tools/test_discovery.py +0 -0
- {spl2_testing_framework-1.8.6 → spl2_testing_framework-1.8.7}/spl2_testing_framework/tools/test_types.py +0 -0
- {spl2_testing_framework-1.8.6 → spl2_testing_framework-1.8.7}/spl2_testing_framework/tools/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: spl2-testing-framework
|
|
3
|
-
Version: 1.8.
|
|
3
|
+
Version: 1.8.7
|
|
4
4
|
Summary: SPL2 Testing Framework
|
|
5
5
|
Home-page: https://github.com/splunk/spl2-testing-framework
|
|
6
6
|
Keywords: SPL2 testing framework
|
|
@@ -135,6 +135,7 @@ Additionally, the following options are supported:
|
|
|
135
135
|
* `--code_dir` - directory where SPL2 code modules (`.spl2`) are located. Defaults to the current working directory. Falls back to `--test_dir` if the module is not found. See [Separate code and test directories](#separate-code-and-test-directories) for details.
|
|
136
136
|
* `--ignore_empty_strings` - to ignore empty strings in the results
|
|
137
137
|
* `--ignore_additional_fields_in_actual` - to ignore fields present in actual results but not in expected results (useful when actual results contain extra fields that should not affect comparison)
|
|
138
|
+
* `--keep_tag_fields` - by default, fields whose name starts with `tag::` (e.g. `tag::metric_name`) are stripped from **both** the actual and expected rows before the destination compare. Pass `--keep_tag_fields` to disable this behaviour and include `tag::` fields in the comparison.
|
|
138
139
|
* `--create_comparison_sheet` - to create a comparison sheet in `comparison_box_test` folder using actual and expected outputs (works only when running box tests)
|
|
139
140
|
* `--cli_bench` - when running tests with CLI, this option enables benchmarking mode by adding `-b` and `-n` flags to the spl2-processor-cli command. The value specifies the number of events to test (e.g., `--cli_bench=1000` will add `-b -n 1000` to the CLI command). **In bench mode, all tests always succeed and CLI output is printed to logs** - this is useful for performance testing and benchmarking. This is only applicable when using `--type cli`.
|
|
140
141
|
* `--lookups_root_dir` - root directory passed to `spl2-processor-cli` as `--lookupsRootDir` for resolving lookup `transforms.conf`. Defaults to `.` (current working directory). For a standard TA layout use `--lookups_root_dir=package/default`. Only applicable when using `--type cli`.
|
|
@@ -102,6 +102,7 @@ Additionally, the following options are supported:
|
|
|
102
102
|
* `--code_dir` - directory where SPL2 code modules (`.spl2`) are located. Defaults to the current working directory. Falls back to `--test_dir` if the module is not found. See [Separate code and test directories](#separate-code-and-test-directories) for details.
|
|
103
103
|
* `--ignore_empty_strings` - to ignore empty strings in the results
|
|
104
104
|
* `--ignore_additional_fields_in_actual` - to ignore fields present in actual results but not in expected results (useful when actual results contain extra fields that should not affect comparison)
|
|
105
|
+
* `--keep_tag_fields` - by default, fields whose name starts with `tag::` (e.g. `tag::metric_name`) are stripped from **both** the actual and expected rows before the destination compare. Pass `--keep_tag_fields` to disable this behaviour and include `tag::` fields in the comparison.
|
|
105
106
|
* `--create_comparison_sheet` - to create a comparison sheet in `comparison_box_test` folder using actual and expected outputs (works only when running box tests)
|
|
106
107
|
* `--cli_bench` - when running tests with CLI, this option enables benchmarking mode by adding `-b` and `-n` flags to the spl2-processor-cli command. The value specifies the number of events to test (e.g., `--cli_bench=1000` will add `-b -n 1000` to the CLI command). **In bench mode, all tests always succeed and CLI output is printed to logs** - this is useful for performance testing and benchmarking. This is only applicable when using `--type cli`.
|
|
107
108
|
* `--lookups_root_dir` - root directory passed to `spl2-processor-cli` as `--lookupsRootDir` for resolving lookup `transforms.conf`. Defaults to `.` (current working directory). For a standard TA layout use `--lookups_root_dir=package/default`. Only applicable when using `--type cli`.
|
{spl2_testing_framework-1.8.6 → spl2_testing_framework-1.8.7}/spl2_testing_framework/conftest.py
RENAMED
|
@@ -52,6 +52,7 @@ SINGLE_SPL2_FILE = "single_spl2_file"
|
|
|
52
52
|
|
|
53
53
|
IGNORE_EMPTY_STRINGS = "ignore_empty_strings"
|
|
54
54
|
IGNORE_ADDITIONAL_FIELDS_IN_ACTUAL = "ignore_additional_fields_in_actual"
|
|
55
|
+
KEEP_TAG_FIELDS = "keep_tag_fields"
|
|
55
56
|
CREATE_COMPARISON_SHEET = "create_comparison_sheet"
|
|
56
57
|
CHECK_SPLUNK_RESULTS = "check_splunk_results"
|
|
57
58
|
PERFORMANCE_CHECK = "performance_check"
|
|
@@ -88,6 +89,12 @@ def pytest_addoption(parser):
|
|
|
88
89
|
parser.addoption(f"--{CREATE_COMPARISON_SHEET}", action="store_true", default=False)
|
|
89
90
|
parser.addoption(f"--{IGNORE_EMPTY_STRINGS}", action="store_true")
|
|
90
91
|
parser.addoption(f"--{IGNORE_ADDITIONAL_FIELDS_IN_ACTUAL}", action="store_true")
|
|
92
|
+
parser.addoption(
|
|
93
|
+
f"--{KEEP_TAG_FIELDS}",
|
|
94
|
+
action="store_true",
|
|
95
|
+
default=False,
|
|
96
|
+
help="Do not strip tag:: fields from destination compare. By default, fields whose name starts with 'tag::' are excluded from the comparison.",
|
|
97
|
+
)
|
|
91
98
|
parser.addoption(f"--{LIMIT_TESTS}", action="store", type=int, default=None)
|
|
92
99
|
parser.addoption(f"--{CLI_BENCH}", action="store", type=int, default=None)
|
|
93
100
|
parser.addoption(
|
|
@@ -445,3 +452,5 @@ def _set_results_options(metafunc):
|
|
|
445
452
|
IGNORE_ADDITIONAL_FIELDS_IN_ACTUAL
|
|
446
453
|
)
|
|
447
454
|
Results._ignore_additional_fields_in_actual = ignore_fields_in_actual
|
|
455
|
+
keep_tag_fields = metafunc.config.getoption(KEEP_TAG_FIELDS)
|
|
456
|
+
Results._ignore_tag_fields = not keep_tag_fields
|
|
@@ -26,6 +26,7 @@ _WHOLE_FLOAT_STR_RE = re.compile(r"^(-?\d+)\.0+$")
|
|
|
26
26
|
class Results(UserDict):
|
|
27
27
|
_ignore_empty_strings = False
|
|
28
28
|
_ignore_additional_fields_in_actual = False
|
|
29
|
+
_ignore_tag_fields = True
|
|
29
30
|
"""Class responsible for parsing and storing results from Splunk, IP and CLI.
|
|
30
31
|
It's necessary to parse nested jsons and other python types to strings in order to compare them
|
|
31
32
|
"""
|
|
@@ -201,6 +202,15 @@ class Results(UserDict):
|
|
|
201
202
|
self._remove_extra_fields(self.data, expected.data)
|
|
202
203
|
return self
|
|
203
204
|
|
|
205
|
+
@staticmethod
|
|
206
|
+
def is_ignored_in_destination_compare(key: str) -> bool:
|
|
207
|
+
"""Return True if ``key`` should be dropped from destination comparison regardless of
|
|
208
|
+
the per-test ``ignore_fields_in_destination_compare`` list. Currently this covers
|
|
209
|
+
``tag::*`` fields, which are stripped by default and only kept when
|
|
210
|
+
``--keep_tag_fields`` is passed.
|
|
211
|
+
"""
|
|
212
|
+
return Results._ignore_tag_fields and key.startswith("tag::")
|
|
213
|
+
|
|
204
214
|
def __lt__(self, other):
|
|
205
215
|
if "_raw" in self.data:
|
|
206
216
|
s = self.data.get("_raw")
|
|
@@ -220,7 +220,7 @@ class SPL2TestRunner:
|
|
|
220
220
|
|
|
221
221
|
if self.create_comparison_sheet:
|
|
222
222
|
self.comp_obj.create_comparison_sheet(output_result, box_test)
|
|
223
|
-
if ignore_keys:
|
|
223
|
+
if ignore_keys or Results.is_ignored_in_destination_compare("tag::"):
|
|
224
224
|
stripped_actual = [
|
|
225
225
|
Results(
|
|
226
226
|
self._strip_ignored_fields_for_destination_compare(
|
|
@@ -285,9 +285,11 @@ class SPL2TestRunner:
|
|
|
285
285
|
def _strip_ignored_fields_for_destination_compare(
|
|
286
286
|
row: dict, ignore_keys: frozenset
|
|
287
287
|
) -> dict:
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
288
|
+
return {
|
|
289
|
+
k: v
|
|
290
|
+
for k, v in row.items()
|
|
291
|
+
if k not in ignore_keys and not Results.is_ignored_in_destination_compare(k)
|
|
292
|
+
}
|
|
291
293
|
|
|
292
294
|
def _splunk_process_event(self, box_test: BoxTest, event):
|
|
293
295
|
try:
|
|
File without changes
|
{spl2_testing_framework-1.8.6 → spl2_testing_framework-1.8.7}/spl2_testing_framework/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{spl2_testing_framework-1.8.6 → spl2_testing_framework-1.8.7}/spl2_testing_framework/splunk_setup.py
RENAMED
|
File without changes
|
{spl2_testing_framework-1.8.6 → spl2_testing_framework-1.8.7}/spl2_testing_framework/test_runner.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{spl2_testing_framework-1.8.6 → spl2_testing_framework-1.8.7}/spl2_testing_framework/tools/utils.py
RENAMED
|
File without changes
|