mirror of
https://github.com/pyMC-dev/pyMC_Repeater.git
synced 2026-10-30 19:51:59 +01:00
fix(manage): render container warning with real line breaks
This commit is contained in:
1 parent
e4276b4273
commit
054ddd0784
2 files changed
+47
-1
No files matched your search
@@ -1550,7 +1550,7 @@ UPGRADEEOF
|
||||
fi
|
||||
echo "✓ Configuration preserved"
|
||||
if [[ -n "$container_note" ]]; then
|
||||
echo "$container_note"
|
||||
printf '%b\n' "$container_note"
|
||||
fi
|
||||
else
|
||||
show_info "Upgrade Complete" "Upgrade completed successfully!\n\nVersion: $current_version → $new_version\n\n✓ Configuration preserved${container_note}"
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
"""Exercise the upgrade summary without running installation/service commands."""
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.mark.parametrize("service_running", [0, 1])
|
||||
def test_silent_upgrade_container_warning_renders_newlines(service_running):
|
||||
script = (Path(__file__).resolve().parents[1] / "manage.sh").read_text()
|
||||
start = script.index(' local container_note=""')
|
||||
end = script.index("\n return 0\n}", start)
|
||||
summary = script[start:end]
|
||||
# The nonempty container variable selects the warning without depending on
|
||||
# the test host. Only the final output block runs, not manage.sh itself.
|
||||
probe = (
|
||||
"set -eu\nrender() {\n"
|
||||
"local silent=true container=test current_version=old new_version=new\n"
|
||||
f"local service_was_running={service_running} service_was_enabled=0\n"
|
||||
f"{summary}\n}}\nrender\n"
|
||||
)
|
||||
env = os.environ.copy()
|
||||
env.pop("BASH_ENV", None)
|
||||
result = subprocess.run(
|
||||
["bash", "--noprofile", "--norc"],
|
||||
input=probe,
|
||||
text=True,
|
||||
capture_output=True,
|
||||
check=True,
|
||||
env=env,
|
||||
)
|
||||
expected = "Upgrade completed successfully!\nVersion: old -> new\n"
|
||||
if service_running:
|
||||
expected += "✓ Service is running\n"
|
||||
expected += (
|
||||
"✓ Configuration preserved\n\n\n"
|
||||
"⚠ CONTAINER DETECTED:\n"
|
||||
"USB udev rules must be set on the HOST, not here.\n"
|
||||
"CH341 host-side setup: "
|
||||
"https://docs.openhop.dev/projects/openhop-repeater/hardware-setup/#ch341-usb-spi-hosts\n"
|
||||
"=== Upgrade Complete ===\n"
|
||||
)
|
||||
assert result.stdout == expected
|
||||
assert result.stderr == ""
|
||||
Reference in new issue
Block a user