This commit is contained in:
@@ -12,16 +12,20 @@ import argparse
|
||||
import hashlib
|
||||
import json
|
||||
import subprocess
|
||||
import sys
|
||||
import urllib.error
|
||||
import urllib.request
|
||||
from collections.abc import Callable, Iterable
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from scripts.ops.check_production_version_truth import parse_config_version
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
if str(ROOT) not in sys.path:
|
||||
sys.path.insert(0, str(ROOT))
|
||||
|
||||
from scripts.ops.check_production_version_truth import parse_config_version
|
||||
|
||||
DEFAULT_HEALTH_URL = "https://mo.wooo.work/health"
|
||||
DEFAULT_GITEA_REMOTE = "ssh://git@192.168.0.110:2222/wooo/ewoooc.git"
|
||||
DEFAULT_TRACKED_FILES = (
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
import json
|
||||
import subprocess
|
||||
import sys
|
||||
import urllib.parse
|
||||
from pathlib import Path
|
||||
|
||||
from scripts.ops import report_source_deploy_runtime_truth as report
|
||||
@@ -220,3 +223,50 @@ def test_source_override_still_requires_committed_file_confirmation(tmp_path):
|
||||
assert payload["result"] == "BLOCKED"
|
||||
assert payload["summary"]["tracked_files_committed"] is False
|
||||
assert any("uncommitted source-control changes" in error for error in payload["errors"])
|
||||
|
||||
|
||||
def test_script_runs_by_path_when_called_from_outside_repo(tmp_path):
|
||||
source_root = _write_source_root(tmp_path)
|
||||
health_payload = urllib.parse.quote(
|
||||
json.dumps({"status": "healthy", "database": "postgresql", "version": "V10.725"})
|
||||
)
|
||||
|
||||
result = subprocess.run(
|
||||
[
|
||||
sys.executable,
|
||||
str(Path(report.__file__).resolve()),
|
||||
"--source-root",
|
||||
str(source_root),
|
||||
"--health-url",
|
||||
f"data:application/json,{health_payload}",
|
||||
"--tracked-file",
|
||||
"config.py",
|
||||
"--tracked-file",
|
||||
"proof.txt",
|
||||
"--source-head",
|
||||
LOCAL_HEAD,
|
||||
"--source-branch",
|
||||
"main",
|
||||
"--origin-main",
|
||||
LOCAL_HEAD,
|
||||
"--origin-dev",
|
||||
LOCAL_HEAD,
|
||||
"--gitea-main",
|
||||
LOCAL_HEAD,
|
||||
"--gitea-dev",
|
||||
LOCAL_HEAD,
|
||||
"--head-config-version",
|
||||
"V10.725",
|
||||
"--tracked-files-committed",
|
||||
"--json",
|
||||
],
|
||||
cwd="/tmp",
|
||||
check=True,
|
||||
text=True,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
)
|
||||
|
||||
payload = json.loads(result.stdout)
|
||||
assert payload["result"] == "PASS"
|
||||
assert payload["summary"]["truth_layers_separated"] is True
|
||||
|
||||
Reference in New Issue
Block a user