@@ -83,6 +83,10 @@ echo "fake ghe-export-ssl-ca-certificates data" > "$GHE_DATA_DIR/current/ssl-ca-
8383echo " fake license data" > " $GHE_DATA_DIR /current/enterprise.ghl"
8484echo " fake manage password hash data" > " $GHE_DATA_DIR /current/manage-password"
8585echo " rsync" > " $GHE_DATA_DIR /current/strategy"
86+ echo " $GHE_REMOTE_VERSION " > " $GHE_DATA_DIR /current/version"
87+ if [ " $GHE_VERSION_MAJOR " -eq 2 ]; then
88+ touch " $GHE_DATA_DIR /current/es-scan-complete"
89+ fi
8690
8791begin_test " ghe-restore into configured vm"
8892(
@@ -152,6 +156,11 @@ begin_test "ghe-restore into configured vm"
152156
153157 # verify the UUID was transferred
154158 diff -ru " $GHE_DATA_DIR /current/uuid" " $GHE_REMOTE_DATA_USER_DIR /common/uuid"
159+
160+ # verify the audit log migration sentinel file has been created on 2.9 and above
161+ if [ " $GHE_VERSION_MAJOR " -eq 2 ] && [ " $GHE_VERSION_MINOR " -ge 9 ]; then
162+ [ -f " $GHE_REMOTE_DATA_USER_DIR /common/es-scan-complete" ]
163+ fi
155164 fi
156165)
157166end_test
@@ -292,6 +301,11 @@ begin_test "ghe-restore -c into unconfigured vm"
292301
293302 # verify ghe-export-ssl-ca-certificates was run
294303 grep -q " fake ghe-export-ssl-ca-certificates data" " $TRASHDIR /restore-out"
304+
305+ # verify the audit log migration sentinel file has been created on 2.9 and above
306+ if [ " $GHE_VERSION_MAJOR " -eq 2 ] && [ " $GHE_VERSION_MINOR " -ge 9 ]; then
307+ [ -f " $GHE_REMOTE_DATA_USER_DIR /common/es-scan-complete" ]
308+ fi
295309 fi
296310)
297311end_test
@@ -365,6 +379,11 @@ begin_test "ghe-restore into unconfigured vm"
365379
366380 # verify no config run after restore on unconfigured instance
367381 ! grep -q " ghe-config-apply OK" " $TRASHDIR /restore-out"
382+
383+ # verify the audit log migration sentinel file has been created on 2.9 and above
384+ if [ " $GHE_VERSION_MAJOR " -eq 2 ] && [ " $GHE_VERSION_MINOR " -ge 9 ]; then
385+ [ -f " $GHE_REMOTE_DATA_USER_DIR /common/es-scan-complete" ]
386+ fi
368387 fi
369388)
370389end_test
@@ -418,6 +437,11 @@ begin_test "ghe-restore with host arg"
418437
419438 # verify the UUID was transferred
420439 diff -ru " $GHE_DATA_DIR /current/uuid" " $GHE_REMOTE_DATA_USER_DIR /common/uuid"
440+
441+ # verify the audit log migration sentinel file has been created on 2.9 and above
442+ if [ " $GHE_VERSION_MAJOR " -eq 2 ] && [ " $GHE_VERSION_MINOR " -ge 9 ]; then
443+ [ -f " $GHE_REMOTE_DATA_USER_DIR /common/es-scan-complete" ]
444+ fi
421445 fi
422446)
423447end_test
@@ -628,3 +652,55 @@ begin_test "ghe-restore fails when restore to an active HA pair"
628652 echo $output | grep -q " Error: Restoring to an appliance with replication enabled is not supported."
629653)
630654end_test
655+
656+ begin_test " ghe-restore fails when restore 2.9/2.10 snapshot without audit log migration sentinel file to 2.11"
657+ (
658+ set -e
659+
660+ # noop if not testing against 2.11
661+ if [ " $GHE_VERSION_MAJOR " -le 1 ] || [ " $GHE_VERSION_MINOR " -ne 11 ]; then
662+ exit 0
663+ fi
664+
665+ rm -rf " $GHE_REMOTE_ROOT_DIR "
666+ setup_remote_metadata
667+
668+ echo " rsync" > " $GHE_DATA_DIR /current/strategy"
669+ echo " v2.9.10" > " $GHE_DATA_DIR /current/version"
670+ rm " $GHE_DATA_DIR /current/es-scan-complete"
671+
672+ ! output=$( ghe-restore -v localhost 2>&1 )
673+
674+ echo $output | grep -q " Error: Snapshot must be from GitHub Enterprise v2.9 or v2.10 after running the"
675+
676+ echo " v2.10.5" > " $GHE_DATA_DIR /current/version"
677+ ! output=$( ghe-restore -v localhost 2>&1 )
678+
679+ echo $output | grep -q " Error: Snapshot must be from GitHub Enterprise v2.9 or v2.10 after running the"
680+ )
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