CI: fix stage config (unit test release issue)

#no_ci_cache
This commit is contained in:
Max Kainov 2024-03-06 16:30:47 +00:00
parent 56b6810122
commit 4dd5e4fe99
2 changed files with 31 additions and 5 deletions

View File

@ -11,7 +11,7 @@ from ci_utils import WithIter
from integration_test_images import IMAGES
class CIStages:
class CIStages(metaclass=WithIter):
NA = "UNKNOWN"
BUILDS_1 = "Builds_1"
BUILDS_2 = "Builds_2"
@ -547,9 +547,17 @@ class CIConfig:
stage_type = CIStages.TESTS_2
elif self.is_test_job(job_name):
stage_type = CIStages.TESTS_1
if job_name == JobNames.LIBFUZZER_TEST:
# since fuzzers build in Builds_2, test must be in Tests_2
stage_type = CIStages.TESTS_2
if job_name in CI_CONFIG.test_configs:
required_build = CI_CONFIG.test_configs[job_name].required_build
assert required_build
if required_build in CI_CONFIG.get_builds_for_report(
JobNames.BUILD_CHECK
):
stage_type = CIStages.TESTS_1
else:
stage_type = CIStages.TESTS_2
else:
stage_type = CIStages.TESTS_1
assert stage_type, f"BUG [{job_name}]"
return stage_type

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python3
import unittest
from ci_config import JobNames, CI_CONFIG, Runners
from ci_config import CIStages, JobNames, CI_CONFIG, Runners
class TestCIConfig(unittest.TestCase):
@ -10,3 +10,21 @@ class TestCIConfig(unittest.TestCase):
for job in JobNames:
runner = CI_CONFIG.get_runner_type(job)
self.assertIn(runner, Runners)
def test_job_stage_config(self):
"""check runner is provided w/o exception"""
for job in JobNames:
stage = CI_CONFIG.get_job_ci_stage(job)
if job in [
JobNames.STYLE_CHECK,
JobNames.FAST_TEST,
JobNames.JEPSEN_KEEPER,
JobNames.BUILD_CHECK,
JobNames.BUILD_CHECK_SPECIAL,
]:
assert (
stage == CIStages.NA
), "These jobs are not in CI stages, must be NA"
else:
assert stage != CIStages.NA, f"stage not found for [{job}]"
self.assertIn(stage, CIStages)