|
70 | 70 | run_cpflow_command!("build-image", "-a", app)
|
71 | 71 | end
|
72 | 72 |
|
73 |
| - after do |
74 |
| - run_cpflow_command!("delete", "-a", app, "--yes") |
75 |
| - end |
76 |
| - |
77 | 73 | it "deletes app with volumesets and images", :slow do
|
78 |
| - allow(Shell).to receive(:confirm).with(include(app)).and_return(true) |
79 |
| - |
80 |
| - result = run_cpflow_command("delete", "-a", app) |
| 74 | + result = run_cpflow_command("delete", "-a", app, "--yes") |
81 | 75 |
|
82 |
| - expect(Shell).to have_received(:confirm).once |
83 | 76 | expect(result[:status]).to eq(0)
|
84 | 77 | expect(result[:stderr]).to match(/Deleting volumeset 'detached-volume' from app '#{app}'[.]+? done!/)
|
85 | 78 | expect(result[:stderr]).to match(/Deleting volumeset 'postgres-volume' from app '#{app}'[.]+? done!/)
|
|
157 | 150 | end
|
158 | 151 |
|
159 | 152 | it "does not unbind identity from policy" do
|
160 |
| - allow(Shell).to receive(:confirm).with(include(app)).and_return(true) |
161 |
| - |
162 |
| - result = run_cpflow_command("delete", "-a", app) |
| 153 | + result = run_cpflow_command("delete", "-a", app, "--yes") |
163 | 154 |
|
164 |
| - expect(Shell).to have_received(:confirm).once |
165 | 155 | expect(result[:status]).to eq(0)
|
166 | 156 | expect(result[:stderr]).to match(/Deleting app '#{app}'[.]+? done!/)
|
167 | 157 | expect(result[:stderr]).not_to include("Unbinding identity from policy")
|
|
176 | 166 | end
|
177 | 167 |
|
178 | 168 | it "does not unbind identity from policy" do
|
179 |
| - allow(Shell).to receive(:confirm).with(include(app)).and_return(true) |
180 |
| - |
181 |
| - result = run_cpflow_command("delete", "-a", app) |
| 169 | + result = run_cpflow_command("delete", "-a", app, "--yes") |
182 | 170 |
|
183 |
| - expect(Shell).to have_received(:confirm).once |
184 | 171 | expect(result[:status]).to eq(0)
|
185 | 172 | expect(result[:stderr]).to match(/Deleting app '#{app}'[.]+? done!/)
|
186 | 173 | expect(result[:stderr]).not_to include("Unbinding identity from policy")
|
|
195 | 182 | end
|
196 | 183 |
|
197 | 184 | it "does not unbind identity from policy" do
|
198 |
| - allow(Shell).to receive(:confirm).with(include(app)).and_return(true) |
199 |
| - |
200 |
| - result = run_cpflow_command("delete", "-a", app) |
| 185 | + result = run_cpflow_command("delete", "-a", app, "--yes") |
201 | 186 |
|
202 |
| - expect(Shell).to have_received(:confirm).once |
203 | 187 | expect(result[:status]).to eq(0)
|
204 | 188 | expect(result[:stderr]).to match(/Deleting app '#{app}'[.]+? done!/)
|
205 | 189 | expect(result[:stderr]).not_to include("Unbinding identity from policy")
|
|
214 | 198 | end
|
215 | 199 |
|
216 | 200 | it "unbinds identity from policy" do
|
217 |
| - allow(Shell).to receive(:confirm).with(include(app)).and_return(true) |
218 |
| - |
219 |
| - result = run_cpflow_command("delete", "-a", app) |
| 201 | + result = run_cpflow_command("delete", "-a", app, "--yes") |
220 | 202 |
|
221 |
| - expect(Shell).to have_received(:confirm).once |
222 | 203 | expect(result[:status]).to eq(0)
|
223 | 204 | expect(result[:stderr]).to match(/Deleting app '#{app}'[.]+? done!/)
|
224 | 205 | expect(result[:stderr]).to match(/Unbinding identity from policy for app '#{app}'[.]+? done!/)
|
|
238 | 219 | end
|
239 | 220 |
|
240 | 221 | it "fails to run hook", :slow do
|
241 |
| - result = nil |
242 |
| - |
243 |
| - spawn_cpflow_command("delete", "-a", app, "--yes") do |it| |
244 |
| - result = it.read_full_output |
245 |
| - end |
| 222 | + result = run_cpflow_command("delete", "-a", app, "--yes") |
246 | 223 |
|
247 |
| - expect(result).to include("Running pre-deletion hook") |
248 |
| - expect(result).to include("Failed to run pre-deletion hook") |
| 224 | + expect(result[:status]).not_to eq(0) |
| 225 | + expect(result[:stderr]).to include("Running pre-deletion hook") |
| 226 | + expect(result[:stderr]).to include("Failed to run pre-deletion hook") |
249 | 227 | end
|
250 | 228 | end
|
251 | 229 |
|
|
258 | 236 | end
|
259 | 237 |
|
260 | 238 | it "successfully runs hook", :slow do
|
261 |
| - result = nil |
262 |
| - |
263 |
| - spawn_cpflow_command("delete", "-a", app, "--yes") do |it| |
264 |
| - result = it.read_full_output |
265 |
| - end |
| 239 | + result = run_cpflow_command("delete", "-a", app, "--yes") |
266 | 240 |
|
267 |
| - expect(result).to include("Running pre-deletion hook") |
268 |
| - expect(result).to include("Finished running pre-deletion hook") |
| 241 | + expect(result[:status]).to eq(0) |
| 242 | + expect(result[:stderr]).to include("Running pre-deletion hook") |
| 243 | + expect(result[:stderr]).to include("Finished running pre-deletion hook") |
269 | 244 | end
|
270 | 245 | end
|
271 | 246 |
|
|
277 | 252 | end
|
278 | 253 |
|
279 | 254 | it "does not run hook" do
|
280 |
| - allow(Shell).to receive(:confirm).with(include(app)).and_return(true) |
| 255 | + result = run_cpflow_command("delete", "-a", app, "--yes", "--skip-pre-deletion-hook") |
281 | 256 |
|
282 |
| - result = run_cpflow_command("delete", "-a", app, "--skip-pre-deletion-hook") |
283 |
| - |
284 |
| - expect(Shell).to have_received(:confirm).once |
285 | 257 | expect(result[:status]).to eq(0)
|
286 | 258 | expect(result[:stderr]).not_to include("Running pre-deletion hook")
|
287 | 259 | end
|
|
0 commit comments