@@ -83,6 +83,10 @@ echo "fake ghe-export-ssl-ca-certificates data" > "$GHE_DATA_DIR/current/ssl-ca-
83
83
echo " fake license data" > " $GHE_DATA_DIR /current/enterprise.ghl"
84
84
echo " fake manage password hash data" > " $GHE_DATA_DIR /current/manage-password"
85
85
echo " 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
86
90
87
91
begin_test " ghe-restore into configured vm"
88
92
(
@@ -152,6 +156,11 @@ begin_test "ghe-restore into configured vm"
152
156
153
157
# verify the UUID was transferred
154
158
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
155
164
fi
156
165
)
157
166
end_test
@@ -292,6 +301,11 @@ begin_test "ghe-restore -c into unconfigured vm"
292
301
293
302
# verify ghe-export-ssl-ca-certificates was run
294
303
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
295
309
fi
296
310
)
297
311
end_test
@@ -365,6 +379,11 @@ begin_test "ghe-restore into unconfigured vm"
365
379
366
380
# verify no config run after restore on unconfigured instance
367
381
! 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
368
387
fi
369
388
)
370
389
end_test
@@ -418,6 +437,11 @@ begin_test "ghe-restore with host arg"
418
437
419
438
# verify the UUID was transferred
420
439
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
421
445
fi
422
446
)
423
447
end_test
@@ -628,3 +652,55 @@ begin_test "ghe-restore fails when restore to an active HA pair"
628
652
echo $output | grep -q " Error: Restoring to an appliance with replication enabled is not supported."
629
653
)
630
654
end_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