summaryrefslogtreecommitdiff
path: root/test/run-tests.sh
diff options
context:
space:
mode:
authorClaude <noreply@anthropic.com>2026-09-25 07:36:19 +0000
committerClaude <noreply@anthropic.com>2026-09-25 07:36:19 +0000
commit0d04aefa0c5e7956cb2dbc80596910cbe53136bf (patch)
tree9580972c3b17dc6ed55282f6227999de8007ecc0 /test/run-tests.sh
parentc89250698116180acfe9a98c24e2e5291e050240 (diff)
publish-apk: allow publishing from another machine over sshHEADmain
The host gate stopped the Fedora laptop publishing at all, which left a build made there with nowhere to go. It now takes PUBLISH_SSH and sends the file to the real host instead. The gate itself is unchanged in spirit: without PUBLISH_SSH a build from elsewhere is still refused, because the failure it guards against is writing to a local path that merely looks like the deploy host's. Two tests cover that -- the error names the way out, and a failed remote publish never falls back to writing locally. Transfers land on a temporary name and move into place only once complete, and the remote copy is hash-compared against the source before the served bytes are checked. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018AwnALZL6bD4VBtATDVv3B
Diffstat (limited to 'test/run-tests.sh')
-rwxr-xr-xtest/run-tests.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/run-tests.sh b/test/run-tests.sh
index 1c75cd7..5830224 100755
--- a/test/run-tests.sh
+++ b/test/run-tests.sh
@@ -329,5 +329,23 @@ else
bad "pruning kept the wrong ones" "newest backup was deleted"
fi
+# 25. The wrong-host message has to name the way out, or the laptop is simply stuck.
+out=$("$BIN/publish-apk" /dev/null thing.apk --host definitely-not-this-host 2>&1); rc=$?
+if [ $rc -eq 2 ] && printf '%s' "$out" | grep -q "PUBLISH_SSH"; then
+ ok "wrong-host error explains how to publish remotely"
+else
+ bad "ssh hint" "rc=$rc out=$out"
+fi
+
+# 26. PUBLISH_SSH must not become a way to write locally on the wrong host -- the whole point
+# is that it sends the file to the real one.
+out=$(PUBLISH_SSH="nobody@invalid.invalid" "$BIN/publish-apk" "$realapk" thing.apk \
+ --host definitely-not-this-host --dir "$tmproot/should-not-be-touched" 2>&1); rc=$?
+if [ $rc -ne 0 ] && [ ! -e "$tmproot/should-not-be-touched/thing.apk" ]; then
+ ok "remote publish never falls back to writing locally"
+else
+ bad "remote fallback" "rc=$rc; local file created?"
+fi
+
printf '\n=== summary: %d passed, %d failed ===\n' "$pass" "$fail"
[ "$fail" -eq 0 ]