Skip to content

Commit 0ae65cd

Browse files
committed
Update test and add test for forced behaviour
1 parent f5dffeb commit 0ae65cd

File tree

1 file changed

+31
-4
lines changed

1 file changed

+31
-4
lines changed

test/test-ghe-restore.sh

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ echo "fake ghe-export-ssl-ca-certificates data" > "$GHE_DATA_DIR/current/ssl-ca-
8383
echo "fake license data" > "$GHE_DATA_DIR/current/enterprise.ghl"
8484
echo "fake manage password hash data" > "$GHE_DATA_DIR/current/manage-password"
8585
echo "rsync" > "$GHE_DATA_DIR/current/strategy"
86+
echo "$GHE_REMOTE_VERSION" > "$GHE_DATA_DIR/current/version"
8687
if [ "$GHE_VERSION_MAJOR" -eq 2 ]; then
8788
touch "$GHE_DATA_DIR/current/es-scan-complete"
8889
fi
@@ -668,12 +669,38 @@ begin_test "ghe-restore fails when restore 2.9/2.10 snapshot without audit log m
668669
echo "v2.9.10" > "$GHE_DATA_DIR/current/version"
669670
rm "$GHE_DATA_DIR/current/es-scan-complete"
670671

671-
! output=$(ghe-restore -v -f localhost 2>&1)
672+
! output=$(ghe-restore -v localhost 2>&1)
672673

673-
echo $output | grep -q "Error: Snapshot must be from GitHub Enterprise v2.9 or v.2.10 after running the"
674+
echo $output | grep -q "Error: Snapshot must be from GitHub Enterprise v2.9 or v2.10 after running the"
674675

675676
echo "v2.10.5" > "$GHE_DATA_DIR/current/version"
676-
! output=$(ghe-restore -v -f localhost 2>&1)
677+
! output=$(ghe-restore -v localhost 2>&1)
677678

678-
echo $output | grep -q "Error: Snapshot must be from GitHub Enterprise v2.9 or v.2.10 after running the"
679+
echo $output | grep -q "Error: Snapshot must be from GitHub Enterprise v2.9 or v2.10 after running the"
679680
)
681+
end_test
682+
683+
begin_test "ghe-restore force restore of 2.9/2.10 snapshot without audit log migration sentinel file to 2.11"
684+
(
685+
set -e
686+
687+
# noop if not testing against 2.11
688+
if [ "$GHE_VERSION_MAJOR" -le 1 ] || [ "$GHE_VERSION_MINOR" -ne 11 ]; then
689+
exit 0
690+
fi
691+
692+
rm -rf "$GHE_REMOTE_ROOT_DIR"
693+
setup_remote_metadata
694+
695+
echo "rsync" > "$GHE_DATA_DIR/current/strategy"
696+
echo "v2.9.10" > "$GHE_DATA_DIR/current/version"
697+
698+
# Create fake remote repositories dir
699+
mkdir -p "$GHE_REMOTE_DATA_USER_DIR/repositories"
700+
701+
ghe-restore -v -f localhost
702+
703+
echo "v2.10.5" > "$GHE_DATA_DIR/current/version"
704+
ghe-restore -v -f localhost
705+
)
706+
end_test

0 commit comments

Comments
 (0)