Commit 542cba44 authored by Colin Obyrne's avatar Colin Obyrne Committed by Jonathan Barnes

Removes some before :all's

The specs didn't benefit from their existance so we removed them
[#91451310]
Signed-off-by: default avatarJonathan Barnes <jbarnes@pivotal.io>
parent 96bcf418
......@@ -23,46 +23,32 @@ describe 'run errand failure', type: :integration, with_tmp_dir: true do
end
context 'with the keep-alive option set' do
before(:all) do
@output, @exit_code = bosh_runner.run("run errand fake-errand-name --download-logs --logs-dir #{@tmp_dir} --keep-alive",
{failure_expected: true, return_exit_code: true})
end
it 'does not delete/create the errand vm' do
expect(@output).to include("[stdout]\nNone")
expect(@output).to include("some-stderr1\nsome-stderr2\nsome-stderr3")
expect(@exit_code).to_not eq(0)
output, exit_code = bosh_runner.run("run errand fake-errand-name --download-logs --logs-dir #{@tmp_dir} --keep-alive",
{failure_expected: true, return_exit_code: true})
expect(output).to include("[stdout]\nNone")
expect(output).to include("some-stderr1\nsome-stderr2\nsome-stderr3")
expect(exit_code).to_not eq(0)
expect_running_vms(%w(fake-errand-name/0 foobar/0))
end
end
context 'without keep-alive option set' do
before(:all) do
@output, @exit_code = bosh_runner.run("run errand fake-errand-name --download-logs --logs-dir #{@tmp_dir}",
{failure_expected: true, return_exit_code: true})
end
it 'shows errand\'s stdout and stderr' do
expect(@output).to include("[stdout]\nNone")
expect(@output).to include("some-stderr1\nsome-stderr2\nsome-stderr3")
end
it 'deletes the errand vm' do
expect(@exit_code).to_not eq(0)
expect_running_vms(%w(foobar/0))
end
it 'shows the errors and deletes the vm without keep-alive option set' do
output, exit_code = bosh_runner.run(
"run errand fake-errand-name --download-logs --logs-dir #{@tmp_dir}",
{failure_expected: true, return_exit_code: true}
)
expect(exit_code).to eq(1)
it 'downloads errand logs and shows downloaded location' do
expect(@output =~ /Logs saved in `(.*fake-errand-name\.0\..*\.tgz)'/).to_not(be_nil, @output)
logs_file = Bosh::Spec::TarFileInspector.new($1)
expect(logs_file.file_names).to match_array(%w(./errand1/stdout.log ./custom.log))
expect(logs_file.smallest_file_size).to be > 0
end
expect_running_vms(%w(foobar/0))
it 'returns 1 as exit code from the cli and indicates that errand completed with error' do
expect(@output).to include('Errand `fake-errand-name\' completed with error (exit code 23)')
expect(@exit_code).to eq(1)
end
expect(output).to include("[stdout]\nNone")
expect(output).to include("some-stderr1\nsome-stderr2\nsome-stderr3")
expect(output).to include('Errand `fake-errand-name\' completed with error (exit code 23)')
expect(output =~ /Logs saved in `(.*fake-errand-name\.0\..*\.tgz)'/).to_not(be_nil, @output)
logs_file = Bosh::Spec::TarFileInspector.new($1)
expect(logs_file.file_names).to match_array(%w(./errand1/stdout.log ./custom.log))
expect(logs_file.smallest_file_size).to be > 0
end
end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment