Files
MoviePilot/tests/test_database_backup_docker.py
InfinityPacer 326b5cf3ad feat: 新增 Python 3.14t 自由线程镜像 (#6434)
* fix(resource): select free-threaded extension ABI

* chore(deps): require moviepilot-rust 0.2.9

* perf: add free-threaded runtime comparison

* feat: add free-threaded runtime profile

* chore(deps): require moviepilot-rust 0.3.0

* test: isolate system endpoint import graph

* fix(docker): preserve runtime profile during recovery

* feat(runtime): expose active GIL state

* feat(plugin): log GIL fallback attribution

* test: refresh runtime observability dependency baseline

* fix(plugin): validate the active uv runtime profile

* test(runtime): expand free-threaded benchmark evidence

* docs(runtime): define v3t governance gates

* test(runtime): separate rust benchmark modes

* docs: sync free-threaded architecture baseline

* perf: add PostgreSQL driver comparison

* docs(runtime): record final free-threaded evidence

* fix(runtime): converge dual-profile dependency verification

* fix(runtime): scope Python 3.14 warning filter

* fix(runtime): match actual oss2 syntax warning

* docs(runtime): refresh free-threaded benchmark evidence

* test(architecture): refresh runtime dependency baseline

* ci: skip unused Trivy Java database

* build: exclude local verification artifacts

* docs(runtime): refresh PostgreSQL driver benchmarks

* docs(runtime): record plugin restore acceptance

* docs(runtime): record amd64 candidate acceptance

* ci: pin beta image publisher action

* test(architecture): merge runtime dependency baseline

* feat(runtime): expose Python GIL status

* docs(runtime): document Python runtime status fields
2026-08-24 17:48:14 +08:00

58 lines
2.1 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.

"""数据库备份所需 Docker 运行时工具合同。"""
import re
from pathlib import Path
def test_runtime_image_installs_postgresql_18_client_from_pgdg() -> None:
"""Trixie 镜像必须从签名的 PGDG 源安装固定主版本客户端。"""
dockerfile = (
Path(__file__).resolve().parents[1] / "docker" / "Dockerfile"
).read_text(encoding="utf-8")
assert re.search(
r'^ARG MOVIEPILOT_PYTHON_VERSION="3\.14\.7"$',
dockerfile,
re.MULTILINE,
)
assert "FROM python:${MOVIEPILOT_PYTHON_VERSION}-slim-trixie AS base" in dockerfile
assert "https://www.postgresql.org/media/keys/ACCC4CF8.asc" in dockerfile
for curl_option in (
"--connect-timeout 10",
"--max-time 30",
"--retry 3",
"--retry-all-errors",
"--retry-max-time 90",
):
assert curl_option in dockerfile
keyring = "/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc"
assert f"chmod 0644 {keyring}" in dockerfile
assert f"signed-by={keyring}" in dockerfile
assert "https://apt.postgresql.org/pub/repos/apt trixie-pgdg main" in dockerfile
assert re.search(r"^\s+postgresql-client-18 \\$", dockerfile, re.MULTILINE)
assert not re.search(r"^\s+postgresql-client \\$", dockerfile, re.MULTILINE)
def test_runtime_image_keeps_pgdg_setup_architecture_neutral_and_cleans_apt_cache(
) -> None:
"""PGDG 原生架构解析需同时适用于 amd64/arm64且不得遗留 APT 索引。"""
dockerfile = (
Path(__file__).resolve().parents[1] / "docker" / "Dockerfile"
).read_text(encoding="utf-8")
pgdg_sources = [
line for line in dockerfile.splitlines() if "apt.postgresql.org/pub/repos/apt" in line
]
assert len(pgdg_sources) == 1
pgdg_source = pgdg_sources[0]
assert "arch=" not in pgdg_source
runtime_packages = dockerfile[
dockerfile.index("FROM base AS prepare_package") :
dockerfile.index("FROM base AS prepare_venv")
]
assert "/var/lib/apt/lists/*" in runtime_packages
assert runtime_packages.index("postgresql-client-18") < runtime_packages.index(
"/var/lib/apt/lists/*"
)