@@ -77,7 +77,7 @@ begin_test "ghe-restore into configured vm"
7777 export GHE_RESTORE_HOST
7878
7979 # run ghe-restore and write output to file for asserting against
80- ghe-restore -v > " $TRASHDIR /restore-out" 2>&1
80+ ghe-restore -v -f > " $TRASHDIR /restore-out" 2>&1
8181 cat " $TRASHDIR /restore-out"
8282
8383 # verify connect to right host
@@ -110,6 +110,50 @@ begin_test "ghe-restore into configured vm"
110110)
111111end_test
112112
113+ begin_test " ghe-restore aborts without user verification"
114+ (
115+ set -e
116+ rm -rf " $GHE_REMOTE_DATA_DIR "
117+ setup_remote_metadata
118+
119+ # create settings file -- used to determine if instance has been configured.
120+ touch " $GHE_REMOTE_DATA_DIR /enterprise/dna.json"
121+
122+ # set restore host environ var
123+ GHE_RESTORE_HOST=127.0.0.1
124+ export GHE_RESTORE_HOST
125+
126+ # run ghe-restore and write output to file for asserting against
127+ if echo " no" | ghe-restore -v > " $TRASHDIR /restore-out" 2>&1 ; then
128+ cat " $TRASHDIR /restore-out"
129+ false # ghe-restore should have exited non-zero
130+ fi
131+
132+ grep -q " Restore aborted" " $TRASHDIR /restore-out"
133+ )
134+ end_test
135+
136+ begin_test " ghe-restore accepts user verification"
137+ (
138+ set -e
139+ rm -rf " $GHE_REMOTE_DATA_DIR "
140+ setup_remote_metadata
141+
142+ # create settings file -- used to determine if instance has been configured.
143+ touch " $GHE_REMOTE_DATA_DIR /enterprise/dna.json"
144+
145+ # set restore host environ var
146+ GHE_RESTORE_HOST=127.0.0.1
147+ export GHE_RESTORE_HOST
148+
149+ # run ghe-restore and write output to file for asserting against
150+ if ! echo " yes" | ghe-restore -v > " $TRASHDIR /restore-out" 2>&1 ; then
151+ cat " $TRASHDIR /restore-out"
152+ false # ghe-restore should have accepted the input
153+ fi
154+ )
155+ end_test
156+
113157begin_test " ghe-restore -c into unconfigured vm"
114158(
115159 set -e
@@ -121,7 +165,7 @@ begin_test "ghe-restore -c into unconfigured vm"
121165 export GHE_RESTORE_HOST
122166
123167 # run ghe-restore and write output to file for asserting against
124- ghe-restore -v -c > " $TRASHDIR /restore-out" 2>&1
168+ ghe-restore -v -f - c > " $TRASHDIR /restore-out" 2>&1
125169 cat " $TRASHDIR /restore-out"
126170
127171 # verify connect to right host
@@ -165,7 +209,7 @@ begin_test "ghe-restore into unconfigured vm"
165209
166210 # run ghe-restore and write output to file for asserting against
167211 # this should fail due to the appliance being in an unconfigured state
168- ! ghe-restore -v > " $TRASHDIR /restore-out" 2>&1
212+ ! ghe-restore -v -f > " $TRASHDIR /restore-out" 2>&1
169213
170214 # verify that ghe-restore failed due to the appliance not being configured
171215 grep -q -e " Error: $GHE_RESTORE_HOST not configured" " $TRASHDIR /restore-out"
@@ -186,7 +230,7 @@ begin_test "ghe-restore with host arg"
186230 export GHE_RESTORE_HOST
187231
188232 # run it
189- output=" $( ghe-restore localhost) " || false
233+ output=" $( ghe-restore -f localhost) " || false
190234
191235 # verify host arg overrides configured restore host
192236 echo " $output " | grep -q ' Connect localhost OK'
@@ -220,7 +264,7 @@ begin_test "ghe-restore no host arg or configured restore host"
220264 unset GHE_RESTORE_HOST
221265
222266 # verify running ghe-restore fails
223- ! ghe-restore
267+ ! ghe-restore -f
224268)
225269end_test
226270
@@ -237,7 +281,7 @@ begin_test "ghe-restore with no pages backup"
237281 rm -rf " $GHE_DATA_DIR /1/pages"
238282
239283 # run it
240- ghe-restore -v localhost
284+ ghe-restore -v -f localhost
241285)
242286end_test
243287
@@ -252,7 +296,7 @@ begin_test "ghe-restore with tarball strategy"
252296
253297 # run it
254298 echo " tarball" > " $GHE_DATA_DIR /current/strategy"
255- output=$( ghe-restore -v localhost)
299+ output=$( ghe-restore -v -f localhost)
256300
257301 # verify ghe-import-repositories was run on remote side with fake tarball
258302 echo " $output " | grep -q ' fake ghe-export-repositories data'
0 commit comments