spl2-testing-framework 1.4.0__tar.gz → 1.5.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.
Files changed (39) hide show
  1. {spl2_testing_framework-1.4.0 → spl2_testing_framework-1.5.0}/PKG-INFO +9 -1
  2. {spl2_testing_framework-1.4.0 → spl2_testing_framework-1.5.0}/README.md +9 -1
  3. {spl2_testing_framework-1.4.0 → spl2_testing_framework-1.5.0}/pyproject.toml +12 -13
  4. spl2_testing_framework-1.5.0/spl2_testing_framework/__init__.py +13 -0
  5. {spl2_testing_framework-1.4.0 → spl2_testing_framework-1.5.0}/spl2_testing_framework/conftest.py +16 -13
  6. {spl2_testing_framework-1.4.0 → spl2_testing_framework-1.5.0}/spl2_testing_framework/launch_remotely_spl2.py +11 -12
  7. spl2_testing_framework-1.5.0/spl2_testing_framework/logger_manager.py +25 -0
  8. {spl2_testing_framework-1.4.0 → spl2_testing_framework-1.5.0}/spl2_testing_framework/single_spl2_file_runner.py +11 -12
  9. {spl2_testing_framework-1.4.0 → spl2_testing_framework-1.5.0}/spl2_testing_framework/test_runner.py +11 -12
  10. spl2_testing_framework-1.5.0/spl2_testing_framework/tools/__init__.py +13 -0
  11. {spl2_testing_framework-1.4.0 → spl2_testing_framework-1.5.0}/spl2_testing_framework/tools/create_diff_sheet.py +11 -12
  12. spl2_testing_framework-1.5.0/spl2_testing_framework/tools/jobs/__init__.py +13 -0
  13. {spl2_testing_framework-1.4.0 → spl2_testing_framework-1.5.0}/spl2_testing_framework/tools/jobs/cli_job.py +22 -13
  14. {spl2_testing_framework-1.4.0 → spl2_testing_framework-1.5.0}/spl2_testing_framework/tools/jobs/cloud_job.py +11 -12
  15. {spl2_testing_framework-1.4.0 → spl2_testing_framework-1.5.0}/spl2_testing_framework/tools/jobs/job.py +11 -12
  16. {spl2_testing_framework-1.4.0 → spl2_testing_framework-1.5.0}/spl2_testing_framework/tools/jobs/splunk_job.py +11 -12
  17. {spl2_testing_framework-1.4.0 → spl2_testing_framework-1.5.0}/spl2_testing_framework/tools/jobs/test_cloud_job.py +11 -12
  18. {spl2_testing_framework-1.4.0 → spl2_testing_framework-1.5.0}/spl2_testing_framework/tools/performance.py +11 -12
  19. {spl2_testing_framework-1.4.0 → spl2_testing_framework-1.5.0}/spl2_testing_framework/tools/results.py +11 -12
  20. spl2_testing_framework-1.5.0/spl2_testing_framework/tools/search_clients/__init__.py +13 -0
  21. spl2_testing_framework-1.5.0/spl2_testing_framework/tools/search_clients/cli_search_client.py +109 -0
  22. {spl2_testing_framework-1.4.0 → spl2_testing_framework-1.5.0}/spl2_testing_framework/tools/search_clients/cloud_search_client.py +10 -25
  23. {spl2_testing_framework-1.4.0 → spl2_testing_framework-1.5.0}/spl2_testing_framework/tools/search_clients/search_client.py +10 -25
  24. {spl2_testing_framework-1.4.0 → spl2_testing_framework-1.5.0}/spl2_testing_framework/tools/search_clients/splunk_search_client.py +10 -25
  25. {spl2_testing_framework-1.4.0 → spl2_testing_framework-1.5.0}/spl2_testing_framework/tools/spl2test_runner.py +47 -14
  26. {spl2_testing_framework-1.4.0 → spl2_testing_framework-1.5.0}/spl2_testing_framework/tools/test_discovery.py +11 -12
  27. {spl2_testing_framework-1.4.0 → spl2_testing_framework-1.5.0}/spl2_testing_framework/tools/test_types.py +11 -12
  28. {spl2_testing_framework-1.4.0 → spl2_testing_framework-1.5.0}/spl2_testing_framework/tools/utils.py +11 -12
  29. spl2_testing_framework-1.4.0/spl2_testing_framework/__init__.py +0 -15
  30. spl2_testing_framework-1.4.0/spl2_testing_framework/logger_manager.py +0 -26
  31. spl2_testing_framework-1.4.0/spl2_testing_framework/tools/__init__.py +0 -15
  32. spl2_testing_framework-1.4.0/spl2_testing_framework/tools/jobs/__init__.py +0 -15
  33. spl2_testing_framework-1.4.0/spl2_testing_framework/tools/search_clients/__init__.py +0 -28
  34. spl2_testing_framework-1.4.0/spl2_testing_framework/tools/search_clients/cli_search_client.py +0 -87
  35. {spl2_testing_framework-1.4.0 → spl2_testing_framework-1.5.0}/LICENSE +0 -0
  36. {spl2_testing_framework-1.4.0 → spl2_testing_framework-1.5.0}/spl2_testing_framework/pytest.ini.sample +0 -0
  37. {spl2_testing_framework-1.4.0 → spl2_testing_framework-1.5.0}/spl2_testing_framework/spl2_test_config.json +0 -0
  38. {spl2_testing_framework-1.4.0 → spl2_testing_framework-1.5.0}/spl2_testing_framework/spl2_utils/assertions.spl2 +0 -0
  39. {spl2_testing_framework-1.4.0 → spl2_testing_framework-1.5.0}/spl2_testing_framework/spl2_utils/logs_to_metrics.spl2 +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: spl2-testing-framework
3
- Version: 1.4.0
3
+ Version: 1.5.0
4
4
  Summary: SPL2 Testing Framework
5
5
  Home-page: https://github.com/splunk/spl2-testing-framework
6
6
  Keywords: SPL2 testing framework
@@ -133,6 +133,7 @@ Additionally, the following options are supported:
133
133
  * `--ignore_empty_strings` - to ignore empty strings in the results
134
134
  * `--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)
135
135
  * `--create_comparison_sheet` - to create a comparison sheet in `comparison_box_test` folder using actual and expected outputs (works only when running box tests)
136
+ * `--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`.
136
137
 
137
138
  Note: The `pytest.ini.sample` file allows you to define command parameters. Just update the configurations, rename the
138
139
  file by removing the `.sample` extension, and execute the command.
@@ -204,3 +205,10 @@ Content of this file will also be printed to stdout.
204
205
 
205
206
  This checks can be applied only to box tests, as assertions which are used in unit tests may impact spl2 pipeline
206
207
  performance.
208
+
209
+ ## Format all files
210
+ To format all files, run:
211
+
212
+ ```bash
213
+ black spl2_testing_framework tests
214
+ ```
@@ -101,6 +101,7 @@ Additionally, the following options are supported:
101
101
  * `--ignore_empty_strings` - to ignore empty strings in the results
102
102
  * `--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)
103
103
  * `--create_comparison_sheet` - to create a comparison sheet in `comparison_box_test` folder using actual and expected outputs (works only when running box tests)
104
+ * `--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`.
104
105
 
105
106
  Note: The `pytest.ini.sample` file allows you to define command parameters. Just update the configurations, rename the
106
107
  file by removing the `.sample` extension, and execute the command.
@@ -171,4 +172,11 @@ command ("|")
171
172
  Content of this file will also be printed to stdout.
172
173
 
173
174
  This checks can be applied only to box tests, as assertions which are used in unit tests may impact spl2 pipeline
174
- performance.
175
+ performance.
176
+
177
+ ## Format all files
178
+ To format all files, run:
179
+
180
+ ```bash
181
+ black spl2_testing_framework tests
182
+ ```
@@ -1,22 +1,21 @@
1
+ # Copyright 2026 Splunk Inc.
1
2
  #
2
- # Copyright 2025 Splunk Inc.
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
3
6
  #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
7
+ # http://www.apache.org/licenses/LICENSE-2.0
15
8
  #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
16
15
 
17
16
  [tool.poetry]
18
17
  name = "spl2-testing-framework"
19
- version = "1.4.0"
18
+ version = "1.5.0"
20
19
  description = "SPL2 Testing Framework"
21
20
  authors = ["mgazda-splunk <mgazda@splunk.com>"]
22
21
  readme = "README.md"
@@ -0,0 +1,13 @@
1
+ # Copyright 2026 Splunk Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
@@ -1,18 +1,17 @@
1
+ # Copyright 2026 Splunk Inc.
1
2
  #
2
- # Copyright 2025 Splunk Inc.
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
3
6
  #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
7
+ # http://www.apache.org/licenses/LICENSE-2.0
15
8
  #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
16
15
 
17
16
  import json
18
17
  import os
@@ -53,6 +52,7 @@ PERFORMANCE_CHECK = "performance_check"
53
52
  TEST_TYPE = "type"
54
53
  TEST_DIR = "test_dir"
55
54
  LIMIT_TESTS = "limit_tests"
55
+ CLI_BENCH = "cli_bench"
56
56
 
57
57
  import logging
58
58
 
@@ -79,6 +79,7 @@ def pytest_addoption(parser):
79
79
  parser.addoption(f"--{IGNORE_EMPTY_STRINGS}", action="store_true")
80
80
  parser.addoption(f"--{IGNORE_ADDITIONAL_FIELDS_IN_ACTUAL}", action="store_true")
81
81
  parser.addoption(f"--{LIMIT_TESTS}", action="store", type=int, default=None)
82
+ parser.addoption(f"--{CLI_BENCH}", action="store", type=int, default=None)
82
83
 
83
84
 
84
85
  def pytest_generate_tests(metafunc):
@@ -147,7 +148,8 @@ def spl2_test_runner(
147
148
  url = f"{config['host']}:{config['port']}"
148
149
  search_client = SplunkSearchClient(url=url, auth=basic_authentication)
149
150
  elif test_type == "cli":
150
- search_client = CLISearchClient()
151
+ cli_bench = run_configurations.get(CLI_BENCH)
152
+ search_client = CLISearchClient(cli_bench=cli_bench)
151
153
  elif test_type == "cloud":
152
154
  url = f"https://{config['tenant']}.api.{config['cloud_instance']}/{config['tenant']}"
153
155
  search_client = CloudSearchClient(url=url, auth=bearer_token_authentication)
@@ -169,6 +171,7 @@ def run_configurations(request):
169
171
  CREATE_COMPARISON_SHEET: request.config.getoption(
170
172
  f"--{CREATE_COMPARISON_SHEET}"
171
173
  ),
174
+ CLI_BENCH: request.config.getoption(f"--{CLI_BENCH}"),
172
175
  }
173
176
 
174
177
 
@@ -1,18 +1,17 @@
1
+ # Copyright 2026 Splunk Inc.
1
2
  #
2
- # Copyright 2025 Splunk Inc.
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
3
6
  #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
7
+ # http://www.apache.org/licenses/LICENSE-2.0
15
8
  #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
16
15
 
17
16
  import argparse
18
17
  import json
@@ -0,0 +1,25 @@
1
+ # Copyright 2026 Splunk Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+
16
+ import logging
17
+
18
+
19
+ def setup_logging():
20
+ logging.basicConfig(
21
+ format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
22
+ handlers=[
23
+ logging.FileHandler("spl2_testing_framework.log"),
24
+ ],
25
+ )
@@ -1,18 +1,17 @@
1
+ # Copyright 2026 Splunk Inc.
1
2
  #
2
- # Copyright 2025 Splunk Inc.
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
3
6
  #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
7
+ # http://www.apache.org/licenses/LICENSE-2.0
15
8
  #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
16
15
 
17
16
  import argparse
18
17
  import logging
@@ -1,18 +1,17 @@
1
+ # Copyright 2026 Splunk Inc.
1
2
  #
2
- # Copyright 2025 Splunk Inc.
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
3
6
  #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
7
+ # http://www.apache.org/licenses/LICENSE-2.0
15
8
  #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
16
15
 
17
16
  import argparse
18
17
  import sys
@@ -0,0 +1,13 @@
1
+ # Copyright 2026 Splunk Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
@@ -1,18 +1,17 @@
1
+ # Copyright 2026 Splunk Inc.
1
2
  #
2
- # Copyright 2025 Splunk Inc.
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
3
6
  #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
7
+ # http://www.apache.org/licenses/LICENSE-2.0
15
8
  #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
16
15
 
17
16
  import pandas as pd
18
17
  from openpyxl import load_workbook
@@ -0,0 +1,13 @@
1
+ # Copyright 2026 Splunk Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
@@ -1,18 +1,17 @@
1
+ # Copyright 2026 Splunk Inc.
1
2
  #
2
- # Copyright 2025 Splunk Inc.
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
3
6
  #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
7
+ # http://www.apache.org/licenses/LICENSE-2.0
15
8
  #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
16
15
 
17
16
  from .job import Job
18
17
 
@@ -51,10 +50,16 @@ class CLISimpleJob(Job):
51
50
  """A job that is executed on CLI in box tests."""
52
51
 
53
52
  def __init__(
54
- self, source: str, code_module_name: str, code_module_content, test_name
53
+ self,
54
+ source: str,
55
+ code_module_name: str,
56
+ code_module_content,
57
+ test_name,
58
+ cli_bench=None,
55
59
  ):
56
60
  code_module_content += f"\n$source = from {str(source)};"
57
61
  super().__init__("", code_module_name, code_module_content, test_name)
62
+ self.cli_bench = cli_bench
58
63
 
59
64
  def create(self) -> "CLISimpleJob":
60
65
  """Creates a job. To run the job use run_job() method."""
@@ -62,6 +67,10 @@ class CLISimpleJob(Job):
62
67
  cli = "spl2-processor-cli"
63
68
  command = [cli, "test", "-s", "pipeline"]
64
69
 
70
+ # Add bench parameters if cli_bench is specified
71
+ if self.cli_bench is not None:
72
+ command.extend(["-b", "-n", str(self.cli_bench)])
73
+
65
74
  input_data = "\n\n".join(
66
75
  [
67
76
  self.commands_module,
@@ -1,18 +1,17 @@
1
+ # Copyright 2026 Splunk Inc.
1
2
  #
2
- # Copyright 2025 Splunk Inc.
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
3
6
  #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
7
+ # http://www.apache.org/licenses/LICENSE-2.0
15
8
  #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
16
15
 
17
16
  from requests import Response
18
17
 
@@ -1,18 +1,17 @@
1
+ # Copyright 2026 Splunk Inc.
1
2
  #
2
- # Copyright 2025 Splunk Inc.
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
3
6
  #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
7
+ # http://www.apache.org/licenses/LICENSE-2.0
15
8
  #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
16
15
 
17
16
  from requests import Response
18
17
 
@@ -1,18 +1,17 @@
1
+ # Copyright 2026 Splunk Inc.
1
2
  #
2
- # Copyright 2025 Splunk Inc.
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
3
6
  #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
7
+ # http://www.apache.org/licenses/LICENSE-2.0
15
8
  #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
16
15
 
17
16
  from requests import Response
18
17
 
@@ -1,18 +1,17 @@
1
+ # Copyright 2026 Splunk Inc.
1
2
  #
2
- # Copyright 2025 Splunk Inc.
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
3
6
  #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
7
+ # http://www.apache.org/licenses/LICENSE-2.0
15
8
  #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
16
15
 
17
16
  import unittest
18
17
  from unittest.mock import MagicMock
@@ -1,18 +1,17 @@
1
+ # Copyright 2026 Splunk Inc.
1
2
  #
2
- # Copyright 2025 Splunk Inc.
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
3
6
  #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
7
+ # http://www.apache.org/licenses/LICENSE-2.0
15
8
  #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
16
15
 
17
16
  import logging
18
17
  import os
@@ -1,18 +1,17 @@
1
+ # Copyright 2026 Splunk Inc.
1
2
  #
2
- # Copyright 2025 Splunk Inc.
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
3
6
  #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
7
+ # http://www.apache.org/licenses/LICENSE-2.0
15
8
  #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
16
15
 
17
16
  import json
18
17
  from collections import UserDict
@@ -0,0 +1,13 @@
1
+ # Copyright 2026 Splunk Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
@@ -0,0 +1,109 @@
1
+ # Copyright 2026 Splunk Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+
16
+ import json
17
+ import logging
18
+ import subprocess
19
+
20
+ from .search_client import SearchClient
21
+ from ..jobs.cli_job import CLIAssertionJob, CLISimpleJob
22
+ from ..jobs.job import Job
23
+
24
+ _LOGGER = logging.getLogger(__name__)
25
+
26
+
27
+ class CLISearchClient(SearchClient):
28
+ """Search client responsible for running jobs on CLI."""
29
+
30
+ jobs_dict = {}
31
+
32
+ def __init__(self, cli_bench=None):
33
+ """Initialize CLISearchClient with optional bench parameter.
34
+
35
+ Args:
36
+ cli_bench: Number of events to use for benchmarking (adds -b and -n flags)
37
+ """
38
+ self.cli_bench = cli_bench
39
+
40
+ @staticmethod
41
+ def create_job(
42
+ test_module: str, code_file_name: str, code_to_test: str, test_statement: str
43
+ ) -> Job:
44
+ """Creates a job for unit test run."""
45
+ return CLIAssertionJob(
46
+ test_module, code_file_name, code_to_test, test_statement
47
+ ).create()
48
+
49
+ def create_simple_job(
50
+ self, source: str, code_module_name: str, code_module_content, test_name
51
+ ) -> Job:
52
+ """Creates a job for box test run."""
53
+
54
+ return CLISimpleJob(
55
+ source, code_module_name, code_module_content, test_name, self.cli_bench
56
+ ).create()
57
+
58
+ def run_job(self, job):
59
+ """Run a job on CLI."""
60
+ result = subprocess.run(
61
+ job.job_content["command"],
62
+ input=job.job_content["input_data"], # Pass data to stdin
63
+ text=True, # Encode input_data as string
64
+ capture_output=True,
65
+ )
66
+
67
+ # When cli_bench is enabled, print output and always succeed
68
+ if self.cli_bench is not None:
69
+ # Set empty result to avoid json parsing errors
70
+ job.result = {}
71
+
72
+ self._print_bench_results(job, result)
73
+ return
74
+
75
+ # Normal mode - raise errors as before
76
+ if result.stderr:
77
+ raise RuntimeError(result.stderr)
78
+
79
+ job.result = json.loads(result.stdout)
80
+ return
81
+
82
+ def _print_bench_results(self, job, result):
83
+ """Print benchmark results to logs."""
84
+ _LOGGER.info("=" * 80)
85
+ _LOGGER.info("CLI BENCH MODE - Test: %s", job.test_name)
86
+ _LOGGER.info("=" * 80)
87
+
88
+ if result.stdout:
89
+ _LOGGER.info("STDOUT:\n%s", result.stdout)
90
+
91
+ if result.stderr:
92
+ _LOGGER.info("STDERR:\n%s", result.stderr)
93
+
94
+ _LOGGER.info("=" * 80)
95
+ _LOGGER.info("Return Code: %s", result.returncode)
96
+ _LOGGER.info("=" * 80)
97
+
98
+ def get_job_results(self, job: Job) -> dict:
99
+ """Get results of a job."""
100
+ # When cli_bench is enabled, return empty results to skip validation
101
+ if self.cli_bench is not None:
102
+ return {}
103
+
104
+ tmp = { # remove job_ prefix
105
+ k.replace("job_", ""): v for k, v in job.result.items()
106
+ } # TODO for python>3.9 use str.remove_prefix
107
+
108
+ results = self._cast_results(tmp)
109
+ return results
@@ -1,31 +1,16 @@
1
+ # Copyright 2026 Splunk Inc.
1
2
  #
2
- # Copyright 2025 Splunk Inc.
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
3
6
  #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
- #
16
- #
17
- # Licensed under the Apache License, Version 2.0 (the "License");
18
- # you may not use this file except in compliance with the License.
19
- # You may obtain a copy of the License at
20
- #
21
- # http://www.apache.org/licenses/LICENSE-2.0
22
- #
23
- # Unless required by applicable law or agreed to in writing, software
24
- # distributed under the License is distributed on an "AS IS" BASIS,
25
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26
- # See the License for the specific language governing permissions and
27
- # limitations under the License.
7
+ # http://www.apache.org/licenses/LICENSE-2.0
28
8
  #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
29
14
 
30
15
  #
31
16
  #
@@ -1,31 +1,16 @@
1
+ # Copyright 2026 Splunk Inc.
1
2
  #
2
- # Copyright 2025 Splunk Inc.
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
3
6
  #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
- #
16
- #
17
- # Licensed under the Apache License, Version 2.0 (the "License");
18
- # you may not use this file except in compliance with the License.
19
- # You may obtain a copy of the License at
20
- #
21
- # http://www.apache.org/licenses/LICENSE-2.0
22
- #
23
- # Unless required by applicable law or agreed to in writing, software
24
- # distributed under the License is distributed on an "AS IS" BASIS,
25
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26
- # See the License for the specific language governing permissions and
27
- # limitations under the License.
7
+ # http://www.apache.org/licenses/LICENSE-2.0
28
8
  #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
29
14
 
30
15
  #
31
16
  #
@@ -1,31 +1,16 @@
1
+ # Copyright 2026 Splunk Inc.
1
2
  #
2
- # Copyright 2025 Splunk Inc.
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
3
6
  #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
- #
16
- #
17
- # Licensed under the Apache License, Version 2.0 (the "License");
18
- # you may not use this file except in compliance with the License.
19
- # You may obtain a copy of the License at
20
- #
21
- # http://www.apache.org/licenses/LICENSE-2.0
22
- #
23
- # Unless required by applicable law or agreed to in writing, software
24
- # distributed under the License is distributed on an "AS IS" BASIS,
25
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26
- # See the License for the specific language governing permissions and
27
- # limitations under the License.
7
+ # http://www.apache.org/licenses/LICENSE-2.0
28
8
  #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
29
14
 
30
15
  #
31
16
  #
@@ -1,28 +1,29 @@
1
+ # Copyright 2026 Splunk Inc.
1
2
  #
2
- # Copyright 2025 Splunk Inc.
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
3
6
  #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
7
+ # http://www.apache.org/licenses/LICENSE-2.0
15
8
  #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
16
15
 
17
16
  import logging
18
17
 
19
18
  from tabulate import tabulate
20
19
 
20
+ from spl2_testing_framework.tools.create_diff_sheet import ComparisonSheet
21
21
  from spl2_testing_framework.tools.performance import PerformanceCheck
22
+ from spl2_testing_framework.tools.search_clients.cli_search_client import (
23
+ CLISearchClient,
24
+ )
22
25
  from spl2_testing_framework.tools.test_types import UnitTest, BoxTest, SingleSPL2
23
26
  from spl2_testing_framework.tools.utils import _make_functions_visible_for_testing
24
- from spl2_testing_framework.tools.create_diff_sheet import ComparisonSheet
25
-
26
27
 
27
28
  _LOGGER = logging.getLogger(__name__)
28
29
 
@@ -50,6 +51,16 @@ class SPL2TestRunner:
50
51
  single_spl2_file.name,
51
52
  )
52
53
  self._search_client.run_job(job)
54
+ # Check if cli_bench is enabled - if so, skip all assertions
55
+ if (
56
+ isinstance(self._search_client, CLISearchClient)
57
+ and self._search_client.cli_bench is not None
58
+ ):
59
+ _LOGGER.info(
60
+ f"CLI Bench Mode: Test {single_spl2_file.name} completed - skipping assertions"
61
+ )
62
+ return
63
+
53
64
  job_result = self._search_client.get_job_results(job)
54
65
  output_result = job_result.get("destination", [])
55
66
 
@@ -84,6 +95,17 @@ class SPL2TestRunner:
84
95
  )
85
96
 
86
97
  self._search_client.run_job(job)
98
+
99
+ # Check if cli_bench is enabled - if so, skip all assertions
100
+ if (
101
+ isinstance(self._search_client, CLISearchClient)
102
+ and self._search_client.cli_bench is not None
103
+ ):
104
+ _LOGGER.info(
105
+ f"CLI Bench Mode: Test {template_test.name} completed - skipping assertions"
106
+ )
107
+ return
108
+
87
109
  job_results = self._search_client.get_job_results(job)
88
110
 
89
111
  errors = []
@@ -123,6 +145,17 @@ class SPL2TestRunner:
123
145
  )
124
146
 
125
147
  self._search_client.run_job(job)
148
+
149
+ # Check if cli_bench is enabled - if so, skip all assertions
150
+ if (
151
+ isinstance(self._search_client, CLISearchClient)
152
+ and self._search_client.cli_bench is not None
153
+ ):
154
+ _LOGGER.info(
155
+ f"CLI Bench Mode: Test {box_test.name} completed - skipping assertions"
156
+ )
157
+ return
158
+
126
159
  job_result = self._search_client.get_job_results(job)
127
160
 
128
161
  output_result = job_result.get("destination", [])
@@ -1,18 +1,17 @@
1
+ # Copyright 2026 Splunk Inc.
1
2
  #
2
- # Copyright 2025 Splunk Inc.
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
3
6
  #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
7
+ # http://www.apache.org/licenses/LICENSE-2.0
15
8
  #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
16
15
 
17
16
  import abc
18
17
  import json
@@ -1,18 +1,17 @@
1
+ # Copyright 2026 Splunk Inc.
1
2
  #
2
- # Copyright 2025 Splunk Inc.
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
3
6
  #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
7
+ # http://www.apache.org/licenses/LICENSE-2.0
15
8
  #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
16
15
 
17
16
  import logging
18
17
  from collections import UserDict
@@ -1,18 +1,17 @@
1
+ # Copyright 2026 Splunk Inc.
1
2
  #
2
- # Copyright 2025 Splunk Inc.
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
3
6
  #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
7
+ # http://www.apache.org/licenses/LICENSE-2.0
15
8
  #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
16
15
 
17
16
  import pathlib
18
17
  import re
@@ -1,15 +0,0 @@
1
- #
2
- # Copyright 2025 Splunk Inc.
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
- #
@@ -1,26 +0,0 @@
1
- #
2
- # Copyright 2025 Splunk Inc.
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
- #
16
-
17
- import logging
18
-
19
-
20
- def setup_logging():
21
- logging.basicConfig(
22
- format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
23
- handlers=[
24
- logging.FileHandler("spl2_testing_framework.log"),
25
- ],
26
- )
@@ -1,15 +0,0 @@
1
- #
2
- # Copyright 2025 Splunk Inc.
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
- #
@@ -1,15 +0,0 @@
1
- #
2
- # Copyright 2025 Splunk Inc.
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
- #
@@ -1,28 +0,0 @@
1
- #
2
- # Copyright 2025 Splunk Inc.
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
- #
16
- #
17
- # Licensed under the Apache License, Version 2.0 (the "License");
18
- # you may not use this file except in compliance with the License.
19
- # You may obtain a copy of the License at
20
- #
21
- # http://www.apache.org/licenses/LICENSE-2.0
22
- #
23
- # Unless required by applicable law or agreed to in writing, software
24
- # distributed under the License is distributed on an "AS IS" BASIS,
25
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26
- # See the License for the specific language governing permissions and
27
- # limitations under the License.
28
- #
@@ -1,87 +0,0 @@
1
- #
2
- # Copyright 2025 Splunk Inc.
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
- #
16
- #
17
- # Licensed under the Apache License, Version 2.0 (the "License");
18
- # you may not use this file except in compliance with the License.
19
- # You may obtain a copy of the License at
20
- #
21
- # http://www.apache.org/licenses/LICENSE-2.0
22
- #
23
- # Unless required by applicable law or agreed to in writing, software
24
- # distributed under the License is distributed on an "AS IS" BASIS,
25
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26
- # See the License for the specific language governing permissions and
27
- # limitations under the License.
28
- #
29
-
30
-
31
- import json
32
- import logging
33
- import subprocess
34
- from ..jobs.cli_job import CLIAssertionJob, CLISimpleJob
35
- from ..jobs.job import Job
36
- from .search_client import SearchClient
37
-
38
- _LOGGER = logging.getLogger(__name__)
39
-
40
-
41
- class CLISearchClient(SearchClient):
42
- """Search client responsible for running jobs on CLI."""
43
-
44
- jobs_dict = {}
45
-
46
- @staticmethod
47
- def create_job(
48
- test_module: str, code_file_name: str, code_to_test: str, test_statement: str
49
- ) -> Job:
50
- """Creates a job for unit test run."""
51
- return CLIAssertionJob(
52
- test_module, code_file_name, code_to_test, test_statement
53
- ).create()
54
-
55
- @staticmethod
56
- def create_simple_job(
57
- source: str, code_module_name: str, code_module_content, test_name
58
- ) -> Job:
59
- """Creates a job for box test run."""
60
-
61
- return CLISimpleJob(
62
- source, code_module_name, code_module_content, test_name
63
- ).create()
64
-
65
- def run_job(self, job):
66
- """Run a job on CLI."""
67
- result = subprocess.run(
68
- job.job_content["command"],
69
- input=job.job_content["input_data"], # Pass data to stdin
70
- text=True, # Encode input_data as string
71
- capture_output=True,
72
- )
73
-
74
- if result.stderr:
75
- raise RuntimeError(result.stderr)
76
-
77
- job.result = json.loads(result.stdout)
78
- return
79
-
80
- def get_job_results(self, job: Job) -> dict:
81
- """Get results of a job."""
82
- tmp = { # remove job_ prefix
83
- k.replace("job_", ""): v for k, v in job.result.items()
84
- } # TODO for python>3.9 use str.remove_prefix
85
-
86
- results = self._cast_results(tmp)
87
- return results