mirror of
https://github.com/dredx/prole.git
synced 2026-09-24 18:54:32 +00:00
- improve installer/action/controller flow and shell-variable expansion handling across screens\n- adjust Supabase Helm rendering and storage deployment templates\n- align monitoring, cloudnative-pg and repair pipeline behavior with updated config paths\n- refresh and expand installer/core regression tests around milestones, navigation and repair logic Co-authored-by: Junie <junie@jetbrains.com>
54 lines
1.7 KiB
Python
54 lines
1.7 KiB
Python
from __future__ import annotations
|
|
|
|
import os
|
|
from pathlib import Path
|
|
|
|
|
|
def test_environment_screen_expands_shell_vars_for_filesystem(monkeypatch, tmp_path: Path):
|
|
"""Regression: `$HOME`/`$PROLE_HOME` must be expanded before mkdir/copy.
|
|
|
|
Without this, setting `PROLE_HOME=$HOME/prole` can create a literal `$HOME`
|
|
directory in the current working directory.
|
|
"""
|
|
|
|
# Isolate CWD so a regression can't pollute the repo checkout.
|
|
monkeypatch.chdir(tmp_path)
|
|
|
|
home_dir = tmp_path / "home"
|
|
home_dir.mkdir(parents=True, exist_ok=True)
|
|
monkeypatch.setenv("HOME", str(home_dir))
|
|
|
|
# Provide a minimal PROJECT_ROOT so `_save_env_to_file` has tiny copy sources.
|
|
proj = tmp_path / "project_root"
|
|
(proj / "etc").mkdir(parents=True, exist_ok=True)
|
|
(proj / "etc" / "init-port-forward.sh").write_text("#!/usr/bin/env bash\necho ok\n")
|
|
|
|
import knoe.ui.screens.environment as env_screen
|
|
|
|
monkeypatch.setattr(env_screen, "PROJECT_ROOT", proj)
|
|
|
|
class Dummy(env_screen.EnvironmentScreenMixin):
|
|
pass
|
|
|
|
dummy = Dummy()
|
|
|
|
values = {
|
|
"PROLE_HOME": "$HOME/prole",
|
|
"PROLE_CONF": "$PROLE_HOME/conf",
|
|
"PROLE_DATA": "$PROLE_HOME/data",
|
|
"PROLE_LOGS": "$PROLE_HOME/logs",
|
|
"PROLE_SERVICE": "$PROLE_HOME/etc",
|
|
}
|
|
dummy._save_env_to_file(values)
|
|
|
|
expected_home = home_dir / "prole"
|
|
assert expected_home.is_dir()
|
|
assert (expected_home / "conf").is_dir()
|
|
assert (expected_home / "data").is_dir()
|
|
assert (expected_home / "logs").is_dir()
|
|
assert (expected_home / "etc").is_dir()
|
|
assert (expected_home / "env.sh").is_file()
|
|
|
|
# Critical assertion: we must NOT create a literal `$HOME` directory in CWD.
|
|
assert not (tmp_path / "$HOME").exists()
|