@@ -19,8 +19,8 @@ mkdir -p gh-enterprise-es/node/0
1919touch gh-enterprise-es/node/0/stuff1
2020touch gh-enterprise-es/node/0/stuff2
2121
22- # Create some fake hookshot data in the remote data directory
2322if [ " $GHE_VERSION_MAJOR " -ge 2 ]; then
23+ # Create some fake hookshot data in the remote data directory
2424 mkdir -p " $GHE_DATA_DIR /1/hookshot"
2525 cd " $GHE_DATA_DIR /1/hookshot"
2626 mkdir -p repository-123 repository-456
@@ -50,6 +50,9 @@ if [ "$GHE_VERSION_MAJOR" -ge 2 ]; then
5050
5151 mkdir -p " $GHE_DATA_DIR /1/alambic_assets/github-enterprise-releases/0001"
5252 touch " $GHE_DATA_DIR /1/alambic_assets/github-enterprise-releases/0001/1ed78298-522b-11e3-9dc0-22eed1f8132d"
53+
54+ # Create a fake uuid
55+ echo " fake uuid" > " $GHE_DATA_DIR /1/uuid"
5356fi
5457
5558# Add some fake repositories to the snapshot
@@ -145,6 +148,9 @@ begin_test "ghe-restore into configured vm"
145148
146149 # verify all alambic assets user data was transferred
147150 diff -ru " $GHE_DATA_DIR /current/alambic_assets" " $GHE_REMOTE_DATA_USER_DIR /alambic_assets"
151+
152+ # verify the UUID was transferred
153+ diff -ru " $GHE_DATA_DIR /current/uuid" " $GHE_REMOTE_DATA_USER_DIR /common/uuid"
148154 fi
149155)
150156end_test
@@ -279,6 +285,9 @@ begin_test "ghe-restore -c into unconfigured vm"
279285
280286 # verify all alambic assets user data was transferred
281287 diff -ru " $GHE_DATA_DIR /current/alambic_assets" " $GHE_REMOTE_DATA_USER_DIR /alambic_assets"
288+
289+ # verify the UUID was transferred
290+ diff -ru " $GHE_DATA_DIR /current/uuid" " $GHE_REMOTE_DATA_USER_DIR /common/uuid"
282291 fi
283292)
284293end_test
@@ -344,6 +353,9 @@ begin_test "ghe-restore into unconfigured vm"
344353 # verify all alambic assets user data was transferred
345354 diff -ru " $GHE_DATA_DIR /current/alambic_assets" " $GHE_REMOTE_DATA_USER_DIR /alambic_assets"
346355
356+ # verify the UUID was transferred
357+ diff -ru " $GHE_DATA_DIR /current/uuid" " $GHE_REMOTE_DATA_USER_DIR /common/uuid"
358+
347359 # verify no config run after restore on unconfigured instance
348360 ! grep -q " ghe-config-apply OK" " $TRASHDIR /restore-out"
349361 fi
@@ -396,6 +408,9 @@ begin_test "ghe-restore with host arg"
396408
397409 # verify all alambic assets user data was transferred
398410 diff -ru " $GHE_DATA_DIR /current/alambic_assets" " $GHE_REMOTE_DATA_USER_DIR /alambic_assets"
411+
412+ # verify the UUID was transferred
413+ diff -ru " $GHE_DATA_DIR /current/uuid" " $GHE_REMOTE_DATA_USER_DIR /common/uuid"
399414 fi
400415)
401416end_test
@@ -485,6 +500,43 @@ begin_test "ghe-restore with tarball strategy"
485500)
486501end_test
487502
503+ begin_test " ghe-restore with empty uuid file"
504+ (
505+ set -e
506+
507+ # Remove the UUID from the remote instance
508+ rm -f " $GHE_REMOTE_DATA_USER_DIR /common/uuid"
509+
510+ # Zero-length the UUID file
511+ cat /dev/null > " $GHE_DATA_DIR /current/uuid"
512+
513+ # Run a restore
514+ ghe-restore -v -f localhost
515+
516+ # Verify no uuid is restored
517+ [ ! -f " $GHE_REMOTE_DATA_USER_DIR /common/uuid" ]
518+
519+ )
520+ end_test
521+
522+ begin_test " ghe-restore with no uuid file"
523+ ( set -e
524+
525+ # Remove the UUID from the remote instance
526+ rm -f " $GHE_REMOTE_DATA_USER_DIR /common/uuid"
527+
528+ # Remove the UUID file
529+ rm -f " $GHE_DATA_DIR /current/uuid"
530+
531+ # Run a restore
532+ ghe-restore -v -f localhost
533+
534+ # Verify no uuid is restored
535+ [ ! -f " $GHE_REMOTE_DATA_USER_DIR /common/uuid" ]
536+
537+ )
538+ end_test
539+
488540begin_test " ghe-restore cluster backup to non-cluster appliance"
489541(
490542 set -e
0 commit comments