prole/tests/test_argocd_manifest_idempotency.py
chrisfu a43aed7134 k3s: eliminate localhost registry + dedupe common-core
- Ensure k3s mode uses the k3s registry endpoint and avoid localhost/k3d image prefixes.

- Make ArgoCD repo-server cmp symlink creation idempotent.

- Normalize common-core provisioning to knoe-system and add repair-time dedupe of stray default-namespace installs.

- Add k3s MariaDB datastore/refresh playbooks and regression tests.
2026-03-05 14:31:33 -08:00

30 lines
1.1 KiB
Python

import re
from pathlib import Path
def test_argocd_repo_server_copyutil_symlink_is_idempotent():
manifest_path = Path(__file__).resolve().parents[1] / "k8s" / "argocd" / "install.yaml"
text = manifest_path.read_text(encoding="utf-8")
# Ensure the repo-server initContainer makes the cmp-server symlink idempotently.
# The repo-server can be recreated while `/var/run/argocd` is persisted (hostPath),
# so an unconditional `ln -s` will fail with "File exists".
assert "argocd-cmp-server" in text
safe_link_re = re.compile(
r"/bin/ln\s+-sf\s+/var/run/argocd/argocd\s+/var/run/argocd/argocd-cmp-server",
re.MULTILINE,
)
assert safe_link_re.search(text), (
"Expected ArgoCD repo-server copyutil initContainer to use `ln -sf` when creating "
"`/var/run/argocd/argocd-cmp-server`."
)
unsafe_link_re = re.compile(
r"/bin/ln\s+-s\s+/var/run/argocd/argocd\s+/var/run/argocd/argocd-cmp-server",
re.MULTILINE,
)
assert not unsafe_link_re.search(text), (
"Found an unconditional `ln -s` for `argocd-cmp-server` which is not idempotent."
)