@@ -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
0 commit comments