ch_tests: Support include, exclude list for ch pert tests (#2630)

This commit is contained in:
Purna Pavan Chandra 2023-02-27 21:57:49 +05:30 коммит произвёл GitHub
Родитель c178b043ad
Коммит 629a7d8fcd
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 22 добавлений и 5 удалений

Просмотреть файл

@ -144,8 +144,14 @@ class CloudHypervisorTestSuite(TestSuite):
) -> None:
hypervisor = self._get_hypervisor_param(node)
ref = variables.get("cloudhypervisor_ref", "")
# below variable expects a comma separated list of full testnames
include_list, exclude_list = get_test_list(
variables,
"ch_perf_tests_included",
"ch_perf_tests_excluded",
)
node.tools[CloudHypervisorTests].run_metrics_tests(
result, environment, hypervisor, log_path, ref
result, environment, hypervisor, log_path, ref, include_list, exclude_list
)
def _ensure_virtualization_enabled(self, node: Node) -> None:

Просмотреть файл

@ -125,15 +125,26 @@ class CloudHypervisorTests(Tool):
hypervisor: str,
log_path: Path,
ref: str = "",
only: Optional[List[str]] = None,
skip: Optional[List[str]] = None,
) -> None:
if ref:
self.node.tools[Git].checkout(ref, self.repo_root)
perf_metrics_tests = self._list_perf_metrics_tests(hypervisor=hypervisor)
subtests = self._list_perf_metrics_tests(hypervisor=hypervisor)
failed_testcases = []
for testcase in perf_metrics_tests:
if only is not None:
if not skip:
skip = []
# Add everything except 'only' to skip list
skip += list(subtests.difference(only))
if skip is not None:
subtests.difference_update(skip)
self._log.debug(f"Final Subtests list to run: {subtests}")
for testcase in subtests:
testcase_log_file = log_path.joinpath(f"{testcase}.log")
status: TestStatus = TestStatus.QUEUED
@ -319,7 +330,7 @@ class CloudHypervisorTests(Tool):
notifier.notify(subtest_msg)
def _list_perf_metrics_tests(self, hypervisor: str = "kvm") -> List[str]:
def _list_perf_metrics_tests(self, hypervisor: str = "kvm") -> Set[str]:
tests_list = []
result = self.run(
f"tests --hypervisor {hypervisor} --metrics -- -- --list-tests",
@ -340,7 +351,7 @@ class CloudHypervisorTests(Tool):
tests_list = pattern.findall(stdout)
self._log.debug(f"Testcases found: {tests_list}")
return tests_list
return set(tests_list)
def _process_perf_metric_test_result(self, output: str) -> str:
# Sample Output