Skip to content

Commit ac1cbb1

Browse files
committed
fix test runs
1 parent 494a521 commit ac1cbb1

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

bin/ghe-host-check

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ if [ $rc -ne 0 ]; then
8585
exit $rc
8686
fi
8787

88-
CLUSTER=false
88+
if [ -z "$CLUSTER" ]; then
89+
CLUSTER=false
90+
fi
8991
if ghe-ssh "$host" -- \
9092
"[ -f '$GHE_REMOTE_ROOT_DIR/etc/github/cluster' ]"; then
9193
CLUSTER=true
@@ -117,7 +119,7 @@ fi
117119

118120
NON_WRITABLE=""
119121
# ensure all nodes are writable
120-
if "$CLUSTER"; then
122+
if [ "$CLUSTER" == "true" ] ; then
121123
if [ -z "$FILE_TO_TEST" ]; then
122124
if [ -d "/data/user/tmp" ]; then
123125
FILE_TO_TEST="/data/user/tmp/test-ro-file.txt"
@@ -164,7 +166,7 @@ if [ -n "$GHE_RESTORE_SNAPSHOT_PATH" ]; then
164166
fi
165167

166168
if [ -z "$GHE_ALLOW_REPLICA_BACKUP" ]; then
167-
if [ "$(ghe-ssh $host -- cat $GHE_REMOTE_ROOT_DIR/etc/github/repl-state 2>/dev/null || true)" = "replica" ]; then
169+
if [ "$(ghe-ssh $host -- cat $GHE_REMOTE_ROOT_DIR/etc/github/repl-state1 2>/dev/null || true)" = "replica" ]; then
168170
echo "Error: high availability replica detected." 1>&2
169171
echo "Backup Utilities should be used to backup from the primary node in" 1>&2
170172
echo "high availability environments to ensure consistent and reliable backups." 1>&2

test/test-ghe-host-check.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,12 @@ begin_test "ghe-host-check fails when encountering RO file-system"
129129
(
130130
set -e
131131

132-
enable_ro_fs
133-
! FILE_TO_TEST=/run/user/501/test ghe-host-check
132+
ghe-ssh "$GHE_HOSTNAME" -- 'mkdir -p "~/tmp"'
133+
# Remove write access in ~/tmp
134+
ghe-ssh "$GHE_HOSTNAME" -- 'chmod a-w -R "~/tmp"'
135+
136+
# File creation fails for CLUSTER
137+
! FILE_TO_TEST="~/tmp/test" CLUSTER=true ghe-host-check
138+
FILE_TO_TEST="~/tmp/test" CLUSTER=false ghe-host-check
134139
)
135140
end_test

0 commit comments

Comments
 (0)