@@ -188,6 +188,40 @@ begin_test "ghe-restore into unconfigured vm"
188
188
)
189
189
end_test
190
190
191
+ begin_test " ghe-restore with host arg and config value"
192
+ (
193
+ set -e
194
+ rm -rf " $GHE_REMOTE_ROOT_DIR "
195
+ setup_remote_metadata
196
+
197
+ # set as configured, enable maintenance mode and create required directories
198
+ setup_maintenance_mode " configured"
199
+
200
+ # set restore host environ var (which we shouldn't see)
201
+ GHE_RESTORE_HOST=" broken.config.restore.host"
202
+ export GHE_RESTORE_HOST
203
+
204
+ # set restore host config var (which we shouldn't see)
205
+ GHE_BACKUP_CONFIG_TEMP=" ${GHE_BACKUP_CONFIG} .temp"
206
+ cp " $GHE_BACKUP_CONFIG " " $GHE_BACKUP_CONFIG_TEMP "
207
+ echo ' GHE_RESTORE_HOST="broken.config.restore.host"' >> " $GHE_BACKUP_CONFIG_TEMP "
208
+ GHE_BACKUP_CONFIG=" $GHE_BACKUP_CONFIG_TEMP "
209
+ export GHE_BACKUP_CONFIG
210
+
211
+ # run it
212
+ output=" $( ghe-restore -f localhost) " || false
213
+
214
+ # clean up the config file
215
+ rm " $GHE_BACKUP_CONFIG_TEMP "
216
+
217
+ # verify host arg overrides configured restore host
218
+ echo " $output " | grep -q ' Connect localhost:22 OK'
219
+
220
+ # Verify all the data we've restored is as expected
221
+ verify_all_restored_data
222
+ )
223
+ end_test
224
+
191
225
begin_test " ghe-restore with host arg"
192
226
(
193
227
set -e
@@ -198,7 +232,7 @@ begin_test "ghe-restore with host arg"
198
232
setup_maintenance_mode " configured"
199
233
200
234
# set restore host environ var
201
- GHE_RESTORE_HOST=127.0.0.1
235
+ GHE_RESTORE_HOST=" broken.environ.restore.host "
202
236
export GHE_RESTORE_HOST
203
237
204
238
# run it
0 commit comments