Files
enginex-qwen25-compat/tests/test_release_plan.py
刘宪东 742d93a7c5
All checks were successful
Build and verify Qwen2.5 compatibility engines / docker (push) Successful in 1m59s
Scope engine image builds and verification by release target
2026-09-30 15:08:59 +08:00

67 lines
2.4 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import tempfile
import unittest
from pathlib import Path
from release_plan import GPU_GROUPS, plan_for_tag, write_gitea_env
class ReleasePlanTests(unittest.TestCase):
def test_one_vendor_tag_builds_only_that_image_and_gpu(self):
plan = plan_for_tag("v0.3.0-metax-c500")
self.assertEqual(plan.target, "metax-c500")
self.assertEqual(plan.image_targets, ("metax-c500",))
self.assertEqual(plan.gpu_types, ("MetaX_c-500",))
self.assertEqual(plan.verification_pairs, (("MetaX_c-500", "metax-c500"),))
def test_cambricon_cards_reuse_one_image(self):
plan = plan_for_tag("v0.3.0-cambricon-mlu370")
self.assertEqual(plan.image_targets, ("cambricon-mlu370",))
self.assertEqual(
plan.gpu_types,
("Cambricon_mlu-370-x4", "Cambricon_mlu-370-x8"),
)
self.assertEqual(
plan.verification_pairs,
(
("Cambricon_mlu-370-x4", "cambricon-mlu370"),
("Cambricon_mlu-370-x8", "cambricon-mlu370"),
),
)
def test_all_requires_explicit_suffix(self):
plan = plan_for_tag("v0.3.0-all")
self.assertEqual(plan.image_targets, tuple(GPU_GROUPS))
self.assertEqual(len(plan.gpu_types), 5)
self.assertEqual(len(set(plan.gpu_types)), 5)
def test_unscoped_or_unknown_tag_cannot_default_to_all(self):
for tag in (
"v0.3.0",
"v0.3.0-unknown",
"v0.3.0-metax-c500-extra",
"v0.3.0-all",
"latest",
):
with self.subTest(tag=tag), self.assertRaises(ValueError):
plan_for_tag(tag)
def test_gitea_env_contains_only_selected_targets(self):
with tempfile.TemporaryDirectory() as directory:
path = Path(directory) / "gitea_env"
path.write_text("FRAMEWORK=vllm_qwen25_compat\n", encoding="utf-8")
write_gitea_env(plan_for_tag("v0.3.0-vastai-va16"), path)
self.assertEqual(
path.read_text(encoding="utf-8").splitlines(),
[
"FRAMEWORK=vllm_qwen25_compat",
"RELEASE_TARGET=vastai-va16",
"IMAGE_TARGETS=vastai-va16",
"GPU_TYPES=Vastai_va16",
"VERIFY_PAIRS=Vastai_va16:vastai-va16",
],
)
if __name__ == "__main__":
unittest.main()