Three major improvements: 1. Rootless Docker refactor: Removes docker/binary modes, unifies to rootless Docker with per-runner system users. Each runner gets its own rootless Docker daemon, systemd user service, and isolated environment. Simplifies CLI (removes --mode option), Ansible role (single code path), and molecule scenarios (removes binary scenario). 2. Auto-merge fix: Fixes status check context mismatch in branch protection (was requiring "lint", "unit-tests", "molecule-tests" but actual contexts are "CI / quality", "CI / molecule-tests*"). Adds retry/wait logic to auto_merge.py that polls commit statuses for up to 15 minutes before attempting merge, eliminating the chicken-and-egg problem where auto-merge would fail because CI hadn't completed yet. 3. Molecule platform matrix: Adds OS platform matrix to CI — all 6 scenarios now run on all 4 supported OSes (ubuntu-2204, ubuntu-2404, debian-12, archlinux) = 24 test pairs distributed across 3 parallel runners. Updates distribute_molecule.py to distribute (scenario, platform) pairs. Updates Makefile with molecule-all target for local multi-platform testing. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
55 lines
1.8 KiB
Python
55 lines
1.8 KiB
Python
"""Unit tests for config module constants."""
|
|
|
|
from gitea_runner_manager.config import (
|
|
BRANCH_PROTECTION_CONFIG,
|
|
CONVENTIONAL_RE,
|
|
DEFAULT_PER_PAGE,
|
|
DEFAULT_TIMEOUT,
|
|
GITEA_API_URL,
|
|
LABEL_CONFIG,
|
|
REPO_NAME,
|
|
REPO_OWNER,
|
|
TASK_ID_RE,
|
|
VIKUNJA_API_URL,
|
|
VIKUNJA_PROJECT_ID,
|
|
)
|
|
|
|
|
|
class TestConfigConstants:
|
|
def test_api_urls(self) -> None:
|
|
assert GITEA_API_URL == "https://git.oblachno.oblachno.fyi/api/v1"
|
|
assert VIKUNJA_API_URL == "https://work.oblachno.oblachno.fyi/api/v1"
|
|
|
|
def test_project_ids(self) -> None:
|
|
assert VIKUNJA_PROJECT_ID == 6
|
|
|
|
def test_timeouts(self) -> None:
|
|
assert DEFAULT_TIMEOUT == 30
|
|
assert DEFAULT_PER_PAGE == 50
|
|
|
|
def test_owner_and_repo(self) -> None:
|
|
assert REPO_OWNER == "oblachno-oss"
|
|
assert REPO_NAME == "grm"
|
|
|
|
def test_task_id_re(self) -> None:
|
|
assert TASK_ID_RE.search("GRM-1")
|
|
assert TASK_ID_RE.search("GRM-123")
|
|
assert not TASK_ID_RE.search("GRM-")
|
|
assert not TASK_ID_RE.search("other text")
|
|
|
|
def test_conventional_re(self) -> None:
|
|
assert CONVENTIONAL_RE.match("feat: add feature")
|
|
assert CONVENTIONAL_RE.match("fix(scope): bug fix")
|
|
assert not CONVENTIONAL_RE.match("random message")
|
|
assert not CONVENTIONAL_RE.match("feat:")
|
|
|
|
def test_branch_protection_config(self) -> None:
|
|
assert BRANCH_PROTECTION_CONFIG["branch_name"] == "master"
|
|
assert BRANCH_PROTECTION_CONFIG["enable_push"] is False
|
|
assert BRANCH_PROTECTION_CONFIG["required_approvals"] == 1
|
|
assert BRANCH_PROTECTION_CONFIG["status_check_contexts"] == ["CI / quality", "CI / molecule-tests*"]
|
|
|
|
def test_label_config(self) -> None:
|
|
assert LABEL_CONFIG["name"] == "ready-to-merge"
|
|
assert LABEL_CONFIG["color"] == "2ecc71"
|