prole/tests/installer/test_verify_k3s_services_status.py
chrisfu 4ee2b259c9 Checkpoint: rename installer to knoe + harden db build context
- Add build-context helper to copy Docker context safely (ignore runtime data, keep symlinks)

- Update UI and core actions to use ~/.prole/build and shared copy helper

- Add/adjust tests and scripts; introduce knoe ops helpers and update manifests

Co-authored-by: Junie <junie@jetbrains.com>
2026-03-22 01:45:21 -07:00

40 lines
1.1 KiB
Python

from pathlib import Path
import sys
import subprocess
# Ensure `installer` is importable when tests are invoked directly via `pytest`
# (the project also provides `tests/run_tests.sh` which sets `PYTHONPATH=.`).
PROJECT_ROOT = Path(__file__).resolve().parents[2]
if str(PROJECT_ROOT) not in sys.path:
sys.path.insert(0, str(PROJECT_ROOT))
from knoe.core import env as core_env
def test_verify_k3s_services_status_does_not_require_token_when_kubeconfig_available(
monkeypatch, tmp_path
):
kubeconfig = tmp_path / "kubeconfig"
kubeconfig.write_text("dummy")
def fake_run(cmd, capture_output=True, text=True, timeout=None, env=None):
return subprocess.CompletedProcess(
args=cmd,
returncode=0,
stdout="registry\nopenbao\nopentofu\n",
stderr="",
)
monkeypatch.setattr(core_env.subprocess, "run", fake_run)
status = core_env._verify_k3s_services_status(
project_root=PROJECT_ROOT,
managed_kubeconfig=str(kubeconfig),
)
assert status["registry"] == "Good"
assert status["openbao"] == "Good"
assert status["opentofu"] == "Good"