chore: initialize containerized Python learning workbook (2026 DevOps/SRE)
This commit is contained in:
commit
ae4c421815
63 files changed
+1273
No files matched your search
@@ -0,0 +1,20 @@
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
from cross_os import config_path, format_json_log, run_echo_safely
|
||||
|
||||
|
||||
def test_config_path() -> None:
|
||||
base = Path("home") / "ops"
|
||||
assert config_path(base, "monitor") == base / "monitor" / "config.yaml"
|
||||
|
||||
|
||||
def test_run_echo_safely_blocks_shell_metacharacters() -> None:
|
||||
payload = "hello; echo INJECTED"
|
||||
assert run_echo_safely(payload) == payload
|
||||
|
||||
|
||||
def test_format_json_log() -> None:
|
||||
line = format_json_log("INFO", "deploy_done", env="prod", replicas=3)
|
||||
parsed = json.loads(line)
|
||||
assert parsed == {"level": "INFO", "event": "deploy_done", "env": "prod", "replicas": 3}
|
||||
Reference in new issue
Block a user