Commit 13de6d65 authored by Konstantinos Togias's avatar Konstantinos Togias
Browse files

test: keep release scheduling aligned with supported tag shapes

parent c6824168
Loading
Loading
Loading
Loading
+13 −0
Changes for tests/ci/test_release_guards.py: 13 added lines, 0 removed lines.
Original line number Diff line number Diff line
"""Release controls refuse unverified or mismatched artifact identities."""

import sys
import re
import zipfile
from pathlib import Path

@@ -43,6 +44,18 @@ def test_unapproved_or_mismatched_release_is_refused(tag, version, protected):
        release.check_tag(tag, version, protected)


@pytest.mark.parametrize(
    "tag,accepted",
    [("v2.0.0-release", True), ("v2.0.0", True), ("v2.0.0rc5", True),
     ("v2.0.0rc5-release", False), ("v1.0.0-release", False), ("v2.0-dev", False)],
)
def test_pipeline_schedules_the_supported_release_tag_shapes(tag, accepted):
    configuration = (CI.parent / ".gitlab-ci.yml").read_text()
    patterns = re.findall(r"CI_COMMIT_TAG =~ /([^/]+)/", configuration)
    assert len(patterns) == 2
    assert all(bool(re.fullmatch(pattern, tag)) == accepted for pattern in patterns)


def test_a_wheel_missing_the_chart_is_refused(tmp_path):
    path = tmp_path / "broken.whl"
    with zipfile.ZipFile(path, "w") as archive: