@@ -77,7 +77,7 @@ begin_test "ghe-restore into configured vm"
77
77
export GHE_RESTORE_HOST
78
78
79
79
# 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
81
81
cat " $TRASHDIR /restore-out"
82
82
83
83
# verify connect to right host
@@ -110,6 +110,50 @@ begin_test "ghe-restore into configured vm"
110
110
)
111
111
end_test
112
112
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
+
113
157
begin_test " ghe-restore -c into unconfigured vm"
114
158
(
115
159
set -e
@@ -121,7 +165,7 @@ begin_test "ghe-restore -c into unconfigured vm"
121
165
export GHE_RESTORE_HOST
122
166
123
167
# 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
125
169
cat " $TRASHDIR /restore-out"
126
170
127
171
# verify connect to right host
@@ -165,7 +209,7 @@ begin_test "ghe-restore into unconfigured vm"
165
209
166
210
# run ghe-restore and write output to file for asserting against
167
211
# 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
169
213
170
214
# verify that ghe-restore failed due to the appliance not being configured
171
215
grep -q -e " Error: $GHE_RESTORE_HOST not configured" " $TRASHDIR /restore-out"
@@ -186,7 +230,7 @@ begin_test "ghe-restore with host arg"
186
230
export GHE_RESTORE_HOST
187
231
188
232
# run it
189
- output=" $( ghe-restore localhost) " || false
233
+ output=" $( ghe-restore -f localhost) " || false
190
234
191
235
# verify host arg overrides configured restore host
192
236
echo " $output " | grep -q ' Connect localhost OK'
@@ -220,7 +264,7 @@ begin_test "ghe-restore no host arg or configured restore host"
220
264
unset GHE_RESTORE_HOST
221
265
222
266
# verify running ghe-restore fails
223
- ! ghe-restore
267
+ ! ghe-restore -f
224
268
)
225
269
end_test
226
270
@@ -237,7 +281,7 @@ begin_test "ghe-restore with no pages backup"
237
281
rm -rf " $GHE_DATA_DIR /1/pages"
238
282
239
283
# run it
240
- ghe-restore -v localhost
284
+ ghe-restore -v -f localhost
241
285
)
242
286
end_test
243
287
@@ -252,7 +296,7 @@ begin_test "ghe-restore with tarball strategy"
252
296
253
297
# run it
254
298
echo " tarball" > " $GHE_DATA_DIR /current/strategy"
255
- output=$( ghe-restore -v localhost)
299
+ output=$( ghe-restore -v -f localhost)
256
300
257
301
# verify ghe-import-repositories was run on remote side with fake tarball
258
302
echo " $output " | grep -q ' fake ghe-export-repositories data'
0 commit comments