spl2-testing-framework 1.2.2__tar.gz → 1.3.0__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.2.2 → spl2_testing_framework-1.3.0}/PKG-INFO +3 -1
- {spl2_testing_framework-1.2.2 → spl2_testing_framework-1.3.0}/README.md +2 -0
- {spl2_testing_framework-1.2.2 → spl2_testing_framework-1.3.0}/pyproject.toml +1 -1
- {spl2_testing_framework-1.2.2 → spl2_testing_framework-1.3.0}/spl2_testing_framework/conftest.py +7 -3
- {spl2_testing_framework-1.2.2 → spl2_testing_framework-1.3.0}/spl2_testing_framework/tools/test_discovery.py +22 -6
- {spl2_testing_framework-1.2.2 → spl2_testing_framework-1.3.0}/LICENSE +0 -0
- {spl2_testing_framework-1.2.2 → spl2_testing_framework-1.3.0}/spl2_testing_framework/__init__.py +0 -0
- {spl2_testing_framework-1.2.2 → spl2_testing_framework-1.3.0}/spl2_testing_framework/launch_remotely_spl2.py +0 -0
- {spl2_testing_framework-1.2.2 → spl2_testing_framework-1.3.0}/spl2_testing_framework/logger_manager.py +0 -0
- {spl2_testing_framework-1.2.2 → spl2_testing_framework-1.3.0}/spl2_testing_framework/pytest.ini.sample +0 -0
- {spl2_testing_framework-1.2.2 → spl2_testing_framework-1.3.0}/spl2_testing_framework/single_spl2_file_runner.py +0 -0
- {spl2_testing_framework-1.2.2 → spl2_testing_framework-1.3.0}/spl2_testing_framework/spl2_test_config.json +0 -0
- {spl2_testing_framework-1.2.2 → spl2_testing_framework-1.3.0}/spl2_testing_framework/spl2_utils/assertions.spl2 +0 -0
- {spl2_testing_framework-1.2.2 → spl2_testing_framework-1.3.0}/spl2_testing_framework/spl2_utils/logs_to_metrics.spl2 +0 -0
- {spl2_testing_framework-1.2.2 → spl2_testing_framework-1.3.0}/spl2_testing_framework/test_runner.py +0 -0
- {spl2_testing_framework-1.2.2 → spl2_testing_framework-1.3.0}/spl2_testing_framework/tools/__init__.py +0 -0
- {spl2_testing_framework-1.2.2 → spl2_testing_framework-1.3.0}/spl2_testing_framework/tools/create_diff_sheet.py +0 -0
- {spl2_testing_framework-1.2.2 → spl2_testing_framework-1.3.0}/spl2_testing_framework/tools/jobs/__init__.py +0 -0
- {spl2_testing_framework-1.2.2 → spl2_testing_framework-1.3.0}/spl2_testing_framework/tools/jobs/cli_job.py +0 -0
- {spl2_testing_framework-1.2.2 → spl2_testing_framework-1.3.0}/spl2_testing_framework/tools/jobs/cloud_job.py +0 -0
- {spl2_testing_framework-1.2.2 → spl2_testing_framework-1.3.0}/spl2_testing_framework/tools/jobs/job.py +0 -0
- {spl2_testing_framework-1.2.2 → spl2_testing_framework-1.3.0}/spl2_testing_framework/tools/jobs/splunk_job.py +0 -0
- {spl2_testing_framework-1.2.2 → spl2_testing_framework-1.3.0}/spl2_testing_framework/tools/jobs/test_cloud_job.py +0 -0
- {spl2_testing_framework-1.2.2 → spl2_testing_framework-1.3.0}/spl2_testing_framework/tools/performance.py +0 -0
- {spl2_testing_framework-1.2.2 → spl2_testing_framework-1.3.0}/spl2_testing_framework/tools/results.py +0 -0
- {spl2_testing_framework-1.2.2 → spl2_testing_framework-1.3.0}/spl2_testing_framework/tools/search_clients/__init__.py +0 -0
- {spl2_testing_framework-1.2.2 → spl2_testing_framework-1.3.0}/spl2_testing_framework/tools/search_clients/cli_search_client.py +0 -0
- {spl2_testing_framework-1.2.2 → spl2_testing_framework-1.3.0}/spl2_testing_framework/tools/search_clients/cloud_search_client.py +0 -0
- {spl2_testing_framework-1.2.2 → spl2_testing_framework-1.3.0}/spl2_testing_framework/tools/search_clients/search_client.py +0 -0
- {spl2_testing_framework-1.2.2 → spl2_testing_framework-1.3.0}/spl2_testing_framework/tools/search_clients/splunk_search_client.py +0 -0
- {spl2_testing_framework-1.2.2 → spl2_testing_framework-1.3.0}/spl2_testing_framework/tools/spl2test_runner.py +0 -0
- {spl2_testing_framework-1.2.2 → spl2_testing_framework-1.3.0}/spl2_testing_framework/tools/test_types.py +0 -0
- {spl2_testing_framework-1.2.2 → spl2_testing_framework-1.3.0}/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.
|
|
3
|
+
Version: 1.3.0
|
|
4
4
|
Summary: SPL2 Testing Framework
|
|
5
5
|
Home-page: https://github.com/splunk/spl2-testing-framework
|
|
6
6
|
Keywords: SPL2 testing framework
|
|
@@ -180,6 +180,8 @@ It is possible to pass more options to the command, which works also with pytest
|
|
|
180
180
|
the samples in module.json file of the corresponding template file
|
|
181
181
|
* `--sample_delimiter` - Separator for separating the samples provided in the sample file. If not provided, it will use
|
|
182
182
|
newline as a default separator.
|
|
183
|
+
* `--limit_tests` - Limit number of tests to execute from the unit, sample file or module.json. If not provided, all will be executed.
|
|
184
|
+
This can be used for quick testing of spl2 files during development.
|
|
183
185
|
|
|
184
186
|
* ... and much more, whatever is supported by pytest
|
|
185
187
|
|
|
@@ -148,6 +148,8 @@ It is possible to pass more options to the command, which works also with pytest
|
|
|
148
148
|
the samples in module.json file of the corresponding template file
|
|
149
149
|
* `--sample_delimiter` - Separator for separating the samples provided in the sample file. If not provided, it will use
|
|
150
150
|
newline as a default separator.
|
|
151
|
+
* `--limit_tests` - Limit number of tests to execute from the unit, sample file or module.json. If not provided, all will be executed.
|
|
152
|
+
This can be used for quick testing of spl2 files during development.
|
|
151
153
|
|
|
152
154
|
* ... and much more, whatever is supported by pytest
|
|
153
155
|
|
{spl2_testing_framework-1.2.2 → spl2_testing_framework-1.3.0}/spl2_testing_framework/conftest.py
RENAMED
|
@@ -51,6 +51,7 @@ CREATE_COMPARISON_SHEET = "create_comparison_sheet"
|
|
|
51
51
|
PERFORMANCE_CHECK = "performance_check"
|
|
52
52
|
TEST_TYPE = "type"
|
|
53
53
|
TEST_DIR = "test_dir"
|
|
54
|
+
LIMIT_TESTS = "limit_tests"
|
|
54
55
|
|
|
55
56
|
import logging
|
|
56
57
|
|
|
@@ -62,7 +63,7 @@ _LOGGER = logging.getLogger(__name__)
|
|
|
62
63
|
|
|
63
64
|
|
|
64
65
|
def pytest_addoption(parser):
|
|
65
|
-
parser.addoption(f"--{TEST_TYPE}", action="store", default="
|
|
66
|
+
parser.addoption(f"--{TEST_TYPE}", action="store", default="cli")
|
|
66
67
|
parser.addoption(f"--{TEST_DIR}", action="store", default=".")
|
|
67
68
|
parser.addoption(
|
|
68
69
|
f"--{PERFORMANCE_CHECK}",
|
|
@@ -75,6 +76,7 @@ def pytest_addoption(parser):
|
|
|
75
76
|
parser.addoption("--sample_delimiter", action="store", default="\n")
|
|
76
77
|
parser.addoption(f"--{CREATE_COMPARISON_SHEET}", action="store_true", default=False)
|
|
77
78
|
parser.addoption(f"--{IGNORE_EMPTY_STRINGS}", action="store_true")
|
|
79
|
+
parser.addoption(f"--{LIMIT_TESTS}", action="store", type=int, default=None)
|
|
78
80
|
|
|
79
81
|
|
|
80
82
|
def pytest_generate_tests(metafunc):
|
|
@@ -82,11 +84,12 @@ def pytest_generate_tests(metafunc):
|
|
|
82
84
|
--test_dir option"""
|
|
83
85
|
test_dir = metafunc.config.getoption(TEST_DIR)
|
|
84
86
|
performance_check = metafunc.config.getoption(PERFORMANCE_CHECK)
|
|
87
|
+
limit_tests = metafunc.config.getoption(LIMIT_TESTS)
|
|
85
88
|
_set_results_options(metafunc)
|
|
86
89
|
|
|
87
90
|
if BOX_TEST in metafunc.fixturenames:
|
|
88
91
|
_LOGGER.info("Collecting Box Tests")
|
|
89
|
-
module_tests = BoxTestDiscovery(test_dir, performance_check)
|
|
92
|
+
module_tests = BoxTestDiscovery(test_dir, performance_check, limit_tests)
|
|
90
93
|
module_tests.discover_tests()
|
|
91
94
|
metafunc.parametrize(
|
|
92
95
|
"%s" % BOX_TEST, module_tests.tests, ids=module_tests.tests.get_ids()
|
|
@@ -105,6 +108,7 @@ def pytest_generate_tests(metafunc):
|
|
|
105
108
|
sample_file,
|
|
106
109
|
sample_delimiter,
|
|
107
110
|
performance_check=performance_check,
|
|
111
|
+
limit_tests=limit_tests,
|
|
108
112
|
)
|
|
109
113
|
try:
|
|
110
114
|
spl2_pipelines.discover_tests()
|
|
@@ -118,7 +122,7 @@ def pytest_generate_tests(metafunc):
|
|
|
118
122
|
|
|
119
123
|
if UNIT_TEST in metafunc.fixturenames:
|
|
120
124
|
_LOGGER.info("Collecting Unit Tests")
|
|
121
|
-
unit_tests = UTDiscovery(test_dir)
|
|
125
|
+
unit_tests = UTDiscovery(test_dir, limit_tests)
|
|
122
126
|
unit_tests.discover_tests()
|
|
123
127
|
metafunc.parametrize(
|
|
124
128
|
UNIT_TEST, unit_tests.tests, ids=unit_tests.tests.get_ids()
|
|
@@ -41,9 +41,10 @@ class SamplesNotFoundException(Exception):
|
|
|
41
41
|
class TestDiscovery(abc.ABC):
|
|
42
42
|
"""Base class for test discovery classes"""
|
|
43
43
|
|
|
44
|
-
def __init__(self, path: str, performance_check: str):
|
|
44
|
+
def __init__(self, path: str, performance_check: str, limit_tests: int = None):
|
|
45
45
|
self.path = pathlib.Path(path)
|
|
46
46
|
self._performance_check = performance_check
|
|
47
|
+
self.limit_tests = limit_tests
|
|
47
48
|
self.tests = TestSuite()
|
|
48
49
|
|
|
49
50
|
def _read_tests(self, test_name: str) -> None:
|
|
@@ -56,8 +57,8 @@ class TestDiscovery(abc.ABC):
|
|
|
56
57
|
class BoxTestDiscovery(TestDiscovery):
|
|
57
58
|
"""Discovers tests for box tests, looking into module.test.json files"""
|
|
58
59
|
|
|
59
|
-
def __init__(self, path: str, performance_check: str):
|
|
60
|
-
super().__init__(path, performance_check)
|
|
60
|
+
def __init__(self, path: str, performance_check: str, limit_tests: int = None):
|
|
61
|
+
super().__init__(path, performance_check, limit_tests)
|
|
61
62
|
|
|
62
63
|
def discover_tests(self) -> None:
|
|
63
64
|
self._read_tests("module.test.json")
|
|
@@ -70,7 +71,13 @@ class BoxTestDiscovery(TestDiscovery):
|
|
|
70
71
|
|
|
71
72
|
for module_path, content in self._parsed_modules.items():
|
|
72
73
|
path = module_path.parent
|
|
74
|
+
tests_added = 0
|
|
73
75
|
for test in content:
|
|
76
|
+
if self.limit_tests is not None and tests_added >= self.limit_tests:
|
|
77
|
+
_LOGGER.info(
|
|
78
|
+
f"Limit of {self.limit_tests} tests reached for {module_path}. Stopping."
|
|
79
|
+
)
|
|
80
|
+
break
|
|
74
81
|
name = test["filename"].replace(".spl2", "")
|
|
75
82
|
test_input = test["test"]["source"]
|
|
76
83
|
code_module_path = path / test["filename"]
|
|
@@ -92,6 +99,7 @@ class BoxTestDiscovery(TestDiscovery):
|
|
|
92
99
|
)
|
|
93
100
|
test.meta["performance"] = self._performance_check
|
|
94
101
|
self.tests.add(test)
|
|
102
|
+
tests_added += 1
|
|
95
103
|
|
|
96
104
|
|
|
97
105
|
class SingleSPL2Discovery(TestDiscovery):
|
|
@@ -104,8 +112,9 @@ class SingleSPL2Discovery(TestDiscovery):
|
|
|
104
112
|
sample_file=None,
|
|
105
113
|
sample_delimiter="\n",
|
|
106
114
|
performance_check="no",
|
|
115
|
+
limit_tests: int = None,
|
|
107
116
|
):
|
|
108
|
-
super().__init__(path, performance_check)
|
|
117
|
+
super().__init__(path, performance_check, limit_tests)
|
|
109
118
|
self.template_file = template_file
|
|
110
119
|
self.sample_file = sample_file
|
|
111
120
|
self.sample_delimiter = sample_delimiter
|
|
@@ -188,8 +197,8 @@ class SingleSPL2Discovery(TestDiscovery):
|
|
|
188
197
|
class UTDiscovery(TestDiscovery):
|
|
189
198
|
"""Discovers tests for unit tests, looking into .test.spl2 files"""
|
|
190
199
|
|
|
191
|
-
def __init__(self, path: str):
|
|
192
|
-
super().__init__(path, performance_check="no")
|
|
200
|
+
def __init__(self, path: str, limit_tests: int = None):
|
|
201
|
+
super().__init__(path, performance_check="no", limit_tests=limit_tests)
|
|
193
202
|
|
|
194
203
|
def discover_tests(self) -> None:
|
|
195
204
|
self._read_tests("*.test.spl2")
|
|
@@ -208,7 +217,13 @@ class UTDiscovery(TestDiscovery):
|
|
|
208
217
|
code_module_name = file_name.replace(".test.", ".")
|
|
209
218
|
code_module_path = path.parent / code_module_name
|
|
210
219
|
|
|
220
|
+
tests_added = 0
|
|
211
221
|
for test in tests:
|
|
222
|
+
if self.limit_tests is not None and tests_added >= self.limit_tests:
|
|
223
|
+
_LOGGER.info(
|
|
224
|
+
f"Limit of {self.limit_tests} tests reached for {file}. Stopping."
|
|
225
|
+
)
|
|
226
|
+
break
|
|
212
227
|
self.tests.add(
|
|
213
228
|
UnitTest(
|
|
214
229
|
name=test,
|
|
@@ -218,3 +233,4 @@ class UTDiscovery(TestDiscovery):
|
|
|
218
233
|
code_module_path=code_module_path,
|
|
219
234
|
)
|
|
220
235
|
)
|
|
236
|
+
tests_added += 1
|
|
File without changes
|
{spl2_testing_framework-1.2.2 → spl2_testing_framework-1.3.0}/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.2.2 → spl2_testing_framework-1.3.0}/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
|
{spl2_testing_framework-1.2.2 → spl2_testing_framework-1.3.0}/spl2_testing_framework/tools/utils.py
RENAMED
|
File without changes
|