Commit a1771c43 authored by Colin Obyrne's avatar Colin Obyrne

Fixes specs by using legacy manifest

[#91451310]
Signed-off-by: default avatarJonathan Barnes <jbarnes@pivotal.io>
parent 97bb569a
......@@ -82,7 +82,7 @@ describe 'run errand failure', type: :integration, with_tmp_dir: true do
with_reset_sandbox_before_each
let(:manifest_hash) do
manifest_hash = Bosh::Spec::Deployments.manifest_with_errand
manifest_hash = Bosh::Spec::Deployments.legacy_manifest_with_errand
# Sleep so we have time to cancel it
manifest_hash['jobs'].last['properties']['errand1']['sleep_duration_in_seconds'] = 5000
......
......@@ -6,7 +6,7 @@ describe 'run errand success', type: :integration, with_tmp_dir: true do
with_reset_sandbox_before_each
let(:manifest_hash) do
manifest_hash = Bosh::Spec::Deployments.manifest_with_errand
manifest_hash = Bosh::Spec::Deployments.legacy_manifest_with_errand
manifest_hash['properties'] = {
'errand1' => {
'sleep_duration_in_seconds' => 60,
......@@ -169,7 +169,7 @@ describe 'run errand success', type: :integration, with_tmp_dir: true do
# When the errand is run, a network update will be required.
# The network update will fail, by default dummy CPI will
# raise NotSupported, like the aws cpi.
manifest_hash = Bosh::Spec::Deployments.manifest_with_errand
manifest_hash = Bosh::Spec::Deployments.legacy_manifest_with_errand
# get rid of the non-errand job, it's not important
manifest_hash['jobs'].delete(manifest_hash['jobs'][0])
......@@ -254,16 +254,16 @@ describe 'run errand success', type: :integration, with_tmp_dir: true do
with_tmp_dir_before_all
before(:all) do
deploy_simple(manifest_hash: manifest_with_errand)
expect_errands('errand1-name')
deploy_simple(manifest_hash: Bosh::Spec::Deployments.legacy_manifest_with_errand)
expect_errands('fake-errand-name')
@output, @exit_code = bosh_runner.run("run errand errand1-name --download-logs --logs-dir #{@tmp_dir}",
@output, @exit_code = bosh_runner.run("run errand fake-errand-name --download-logs --logs-dir #{@tmp_dir}",
{return_exit_code: true})
end
it 'shows bin/run stdout and stderr' do
expect(@output).to include('some-stdout')
expect(@output).to include('some-stderr')
expect(@output).to include('fake-errand-stdout')
expect(@output).to include('fake-errand-stderr')
end
it 'shows output generated by package script which proves dependent packages are included' do
......@@ -271,14 +271,14 @@ describe 'run errand success', type: :integration, with_tmp_dir: true do
end
it 'downloads errand logs and shows downloaded location' do
expect(@output =~ /Logs saved in `(.*errand1-name\.0\..*\.tgz)'/).to_not(be_nil, @output)
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
it 'returns 0 as exit code from the cli and indicates that errand ran successfully' do
expect(@output).to include('Errand `errand1-name\' completed successfully (exit code 0)')
expect(@output).to include('Errand `fake-errand-name\' completed successfully (exit code 0)')
expect(@exit_code).to eq(0)
end
end
......@@ -289,41 +289,17 @@ describe 'run errand success', type: :integration, with_tmp_dir: true do
let(:manifest_hash) do
large_property = 64.times.inject('') { |p| p << 'a'*1024 } # generates 64Kb string
manifest = {'large_property' => large_property }
manifest.merge(manifest_with_errand)
manifest.merge(Bosh::Spec::Deployments.legacy_manifest_with_errand)
end
it 'deploys successfully' do
deploy_simple(manifest_hash: manifest_hash)
_, exit_code = bosh_runner.run('run errand errand1-name', { return_exit_code: true })
_, exit_code = bosh_runner.run('run errand fake-errand-name', { return_exit_code: true })
expect(exit_code).to eq(0)
end
end
def manifest_with_errand
manifest_hash = Bosh::Spec::Deployments.legacy_simple_manifest
manifest_hash['jobs'].first['instances'] = 1
manifest_hash['jobs'] << {
'name' => 'errand1-name',
'template' => 'errand1',
'lifecycle' => 'errand',
'resource_pool' => 'a',
'instances' => 1,
'networks' => [{ 'name' => 'a' }],
'properties' => {
'errand1' => {
'exit_code' => 0,
'stdout' => 'some-stdout',
'stderr' => 'some-stderr',
'run_package_file' => true,
},
},
}
manifest_hash
end
def expect_errands(*expected_errands)
output, _ = bosh_runner.run('errands')
expected_errands.each do |errand|
......
......@@ -107,8 +107,8 @@ module Bosh::Spec
})
end
def self.manifest_with_errand
manifest = simple_manifest.merge(
def self.legacy_manifest_with_errand
manifest = legacy_simple_manifest.merge(
'name' => 'errand'
)
manifest['resource_pools'].first.delete('size')
......
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