aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-22 18:09:50 -0500
committerCraig Jennings <c@cjennings.net>2026-05-22 18:09:50 -0500
commit0a57d75d3947fddd6c6ab62924c52a456f4776b0 (patch)
tree0c6d863574d1eb6c5ffa4c3a761bc5bf514ba864 /tests
parentb6525a50fabf3aedf41eee70c164519b00d27704 (diff)
downloadarchangel-0a57d75d3947fddd6c6ab62924c52a456f4776b0.tar.gz
archangel-0a57d75d3947fddd6c6ab62924c52a456f4776b0.zip
test: make SSH_PORT overridable in test-install.sh
The port was hardcoded, so a test run collided with any other VM already forwarding 2222. It now defaults to 2222, so existing invocations are unchanged. SSH_PORT=2223 scripts/test-install.sh picks a free port to run alongside another VM.
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/test_test_install.bats21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/unit/test_test_install.bats b/tests/unit/test_test_install.bats
index 9cbb1aa..6b911af 100644
--- a/tests/unit/test_test_install.bats
+++ b/tests/unit/test_test_install.bats
@@ -214,3 +214,24 @@ EOF
[ "$status" -eq 0 ]
[ "$output" = "" ]
}
+
+#############################
+# SSH_PORT override
+#############################
+# The hostfwd port must be overridable so a test VM can coexist with
+# another VM already holding 2222 (re-sourcing applies the top-level
+# assignment with the env value in scope).
+
+@test "SSH_PORT honors a preset value" {
+ SSH_PORT=3333
+ # shellcheck disable=SC1091
+ source "${BATS_TEST_DIRNAME}/../../scripts/test-install.sh"
+ [ "$SSH_PORT" = "3333" ]
+}
+
+@test "SSH_PORT defaults to 2222 when unset" {
+ unset SSH_PORT
+ # shellcheck disable=SC1091
+ source "${BATS_TEST_DIRNAME}/../../scripts/test-install.sh"
+ [ "$SSH_PORT" = "2222" ]
+}