|
3 | 3 | # created: 2021-04-13 |
4 | 4 |
|
5 | 5 | """AlmaLinux Test System package testing tasks running.""" |
6 | | - |
7 | 6 | import logging |
8 | 7 | import traceback |
9 | 8 | import random |
|
25 | 24 | from urllib3 import Retry |
26 | 25 | from urllib3.exceptions import TimeoutError |
27 | 26 |
|
| 27 | +from alts.shared.utils.file_utils import file_url_exists |
28 | 28 | from alts.shared.constants import API_VERSION, DEFAULT_REQUEST_TIMEOUT |
29 | 29 | from alts.shared.exceptions import ( |
30 | 30 | InstallPackageError, |
@@ -120,6 +120,9 @@ def is_success(stage_data_: dict): |
120 | 120 | return False |
121 | 121 | return stage_data_['exit_code'] == 0 |
122 | 122 |
|
| 123 | + def should_skip_test(package, test_name, skipped_tests_map): |
| 124 | + return test_name in skipped_tests_map.get(package, []) if skipped_tests_map else False |
| 125 | + |
123 | 126 | def set_artifacts_when_stage_has_unexpected_exception( |
124 | 127 | _artifacts: dict, |
125 | 128 | error_message: str, |
@@ -175,29 +178,52 @@ def set_artifacts_when_stage_has_unexpected_exception( |
175 | 178 | module_name = task_params.get('module_name') |
176 | 179 | module_stream = task_params.get('module_stream') |
177 | 180 | module_version = task_params.get('module_version') |
| 181 | + |
| 182 | + def get_excluded_packages(): |
| 183 | + uri = 'https://git.almalinux.org/almalinux/alts-exclusions/raw/branch/main/skipped_tests.json' |
| 184 | + try: |
| 185 | + response = requests.get(uri) |
| 186 | + response.raise_for_status() |
| 187 | + return response.json() |
| 188 | + except requests.RequestException: |
| 189 | + return {} |
| 190 | + |
178 | 191 | try: |
179 | 192 | # Wait a bit to not spawn all environments at once when |
180 | 193 | # a lot of tasks are coming to the machine |
181 | 194 | time.sleep(random.randint(5, 10)) |
182 | | - runner.setup() |
183 | | - runner.run_system_info_commands() |
184 | | - runner.install_package( |
185 | | - package_name, |
186 | | - package_version=package_version, |
187 | | - package_epoch=package_epoch, |
188 | | - module_name=module_name, |
189 | | - module_stream=module_stream, |
190 | | - module_version=module_version, |
191 | | - semi_verbose=True, |
192 | | - ) |
193 | | - if CONFIG.enable_integrity_tests: |
194 | | - runner.run_package_integrity_tests(package_name, package_version) |
195 | | - runner.run_third_party_tests( |
196 | | - package_name, |
197 | | - package_version=package_version, |
198 | | - package_epoch=package_epoch, |
199 | | - ) |
200 | | - runner.uninstall_package(package_name) |
| 195 | + |
| 196 | + test_steps = [ |
| 197 | + ("setup", runner.setup, [], {}), |
| 198 | + ("run_system_info_commands", runner.run_system_info_commands, [], {}), |
| 199 | + ("install_package", runner.install_package, [ |
| 200 | + package_name |
| 201 | + ], { |
| 202 | + "package_version": package_version, |
| 203 | + "package_epoch": package_epoch, |
| 204 | + "module_name": module_name, |
| 205 | + "module_stream": module_stream, |
| 206 | + "module_version": module_version, |
| 207 | + "semi_verbose": True, |
| 208 | + }), |
| 209 | + ("run_package_integrity_tests", runner.run_package_integrity_tests, [ |
| 210 | + package_name, package_version |
| 211 | + ], {}), |
| 212 | + ("run_third_party_tests", runner.run_third_party_tests, [ |
| 213 | + package_name |
| 214 | + ], { |
| 215 | + "package_version": package_version, |
| 216 | + "package_epoch": package_epoch, |
| 217 | + }), |
| 218 | + ("uninstall_package", runner.uninstall_package, [package_name], {}) |
| 219 | + ] |
| 220 | + |
| 221 | + for test_name, func, args, kwargs in test_steps: |
| 222 | + if test_name == "run_package_integrity_tests" and not CONFIG.enable_integrity_tests: |
| 223 | + continue |
| 224 | + if should_skip_test(package_name, test_name, get_excluded_packages()): |
| 225 | + continue |
| 226 | + func(*args, **kwargs) |
201 | 227 | except VMImageNotFound as exc: |
202 | 228 | logging.exception('Cannot find VM image: %s', exc) |
203 | 229 | except WorkDirPreparationError: |
|
0 commit comments