Commit 2f4ca1aa authored by Colin Obyrne's avatar Colin Obyrne

Use properties from the cloud_config if present

Updated all the integration specs to upload cloud configs and use
manifests without the cloud config properties. Adds specs to cover
legacy behavior if no cloud config is present.

[finishes #91451310]
Signed-off-by: default avatarJonathan Barnes <jbarnes@pivotal.io>
parent cd94dbd9
......@@ -14,7 +14,12 @@ module Bosh::Director
# @param [Hash] manifest Raw deployment manifest
# @return [DeploymentPlan::Planner] Deployment as build from deployment_spec
def parse(manifest, cloud_config, options = {})
@manifest = manifest
@deployment_manifest = manifest
if cloud_config.nil?
@cloud_manifest = cloud_manifest_from_deployment_manifest @deployment_manifest
else
@cloud_manifest = cloud_config.manifest
end
@job_states = safe_property(options, 'job_states', :class => Hash, :default => {})
......@@ -34,27 +39,36 @@ module Bosh::Director
private
CLOUD_MANIFEST_KEYS = ['resource_pools','compilation','disk_pools','networks']
def cloud_manifest_from_deployment_manifest(deployment_manifest)
cloud_manifest = {}
CLOUD_MANIFEST_KEYS.each do |key|
cloud_manifest[key] = deployment_manifest[key] if deployment_manifest.has_key? key
end
cloud_manifest
end
def parse_name
safe_property(@manifest, 'name', :class => String)
safe_property(@deployment_manifest, 'name', :class => String)
end
def parse_properties
@deployment.properties = safe_property(@manifest, 'properties',
@deployment.properties = safe_property(@deployment_manifest, 'properties',
:class => Hash, :default => {})
end
def parse_releases
release_specs = []
if @manifest.has_key?('release')
if @manifest.has_key?('releases')
if @deployment_manifest.has_key?('release')
if @deployment_manifest.has_key?('releases')
raise DeploymentAmbiguousReleaseSpec,
"Deployment manifest contains both 'release' and 'releases' " +
'sections, please use one of the two.'
end
release_specs << @manifest['release']
release_specs << @deployment_manifest['release']
else
safe_property(@manifest, 'releases', :class => Array).each do |release|
safe_property(@deployment_manifest, 'releases', :class => Array).each do |release|
release_specs << release
end
end
......@@ -65,7 +79,7 @@ module Bosh::Director
end
def parse_networks
networks = safe_property(@manifest, 'networks', :class => Array)
networks = safe_property(@cloud_manifest, 'networks', :class => Array)
networks.each do |network_spec|
type = safe_property(network_spec, 'type', :class => String,
:default => 'manual')
......@@ -91,17 +105,17 @@ module Bosh::Director
end
def parse_compilation
compilation_spec = safe_property(@manifest, 'compilation', :class => Hash)
compilation_spec = safe_property(@cloud_manifest, 'compilation', :class => Hash)
@deployment.compilation = CompilationConfig.new(@deployment, compilation_spec)
end
def parse_update
update_spec = safe_property(@manifest, 'update', :class => Hash)
update_spec = safe_property(@deployment_manifest, 'update', :class => Hash)
@deployment.update = UpdateConfig.new(update_spec)
end
def parse_resource_pools
resource_pools = safe_property(@manifest, 'resource_pools', :class => Array)
resource_pools = safe_property(@cloud_manifest, 'resource_pools', :class => Array)
resource_pools.each do |rp_spec|
@deployment.add_resource_pool(ResourcePool.new(@deployment, rp_spec, @logger))
end
......@@ -111,7 +125,7 @@ module Bosh::Director
end
def parse_disk_pools
disk_pools = safe_property(@manifest, 'disk_pools', :class => Array, :optional => true)
disk_pools = safe_property(@cloud_manifest, 'disk_pools', :class => Array, :optional => true)
return if disk_pools.nil?
disk_pools.each do |dp_spec|
@deployment.add_disk_pool(DiskPool.parse(dp_spec))
......@@ -119,7 +133,7 @@ module Bosh::Director
end
def parse_jobs
jobs = safe_property(@manifest, 'jobs', :class => Array, :default => [])
jobs = safe_property(@deployment_manifest, 'jobs', :class => Array, :default => [])
jobs.each do |job_spec|
state_overrides = @job_states[job_spec['name']]
if state_overrides
......
......@@ -5,6 +5,10 @@ module Bosh
def before_create
self.created_at ||= Time.now
end
def manifest
Psych.load properties
end
end
end
end
......
......@@ -9,7 +9,7 @@ module Bosh::Director::Models
one_to_many :vms
one_to_many :properties, :class => "Bosh::Director::Models::DeploymentProperty"
one_to_many :problems, :class => "Bosh::Director::Models::DeploymentProblem"
many_to_one :cloud_config
many_to_one :cloud_config
def validate
validates_presence :name
......
......@@ -32,7 +32,7 @@ module Bosh::Director
canonical_name: 'fake-network-name',
})
end
let(:cloud_config) { Models::CloudConfig.create }
let(:cloud_config) { nil }
describe 'name key' do
it 'parses name' do
......
......@@ -5,7 +5,7 @@ module Bosh::Director
describe Planner do
subject { described_class.new('fake-dep-name', manifest_text, cloud_config) }
let(:event_log) { instance_double('Bosh::Director::EventLog::Log') }
let(:cloud_config) { Bosh::Director::Models::CloudConfig.create }
let(:cloud_config) { nil }
let(:manifest_text) { Psych.dump minimal_manifest }
def minimal_manifest
{
......
......@@ -62,7 +62,7 @@ module Bosh::Director::DeploymentPlan
let(:resource_pools) { ResourcePools.new(event_log, rp_updaters) }
let(:rp_updaters) { deployment_plan.resource_pools.map { |resource_pool| Bosh::Director::ResourcePoolUpdater.new(resource_pool) } }
let(:assembler) { Assembler.new(deployment_plan) }
let(:cloud_config) { Bosh::Director::Models::CloudConfig.create }
let(:cloud_config) { nil }
let(:deployment_plan) { Planner.parse(deployment_manifest, cloud_config, {}, event_log, logger) }
let(:deployment_manifest) do
......
......@@ -2,10 +2,9 @@ require 'spec_helper'
module Bosh::Director::Jobs
describe UpdateDeployment do
subject(:job) { UpdateDeployment.new(manifest_path, cloud_config.id) }
subject(:job) { UpdateDeployment.new(manifest_path, nil) }
let(:config) { Bosh::Director::Config.load_file(asset('test-director-config.yml'))}
let(:cloud_config) { Bosh::Director::Models::CloudConfig.create }
let(:directory) { Support::FileHelpers::DeploymentDirectory.new }
let(:manifest_path) { directory.add_file('deployment.yml', manifest_content) }
let(:manifest_content) { Psych.dump ManifestHelper.default_legacy_manifest }
......@@ -52,6 +51,8 @@ module Bosh::Director::Jobs
end
end
it 'works with a cloud_config object passed in'
context 'when the first step fails' do
before do
expect(job).to receive(:with_deployment_lock).and_yield.ordered
......
......@@ -86,11 +86,13 @@ module Bosh::Cli::Command
recreate = !!options[:recreate]
redact_diff = !!options[:redact_diff]
manifest_yaml = prepare_deployment_manifest(
:yaml => true, :resolve_properties => true)
manifest_yaml = prepare_deployment_manifest(:yaml => true, :resolve_properties => true)
inspect_deployment_changes(Psych.load(manifest_yaml),
interactive: interactive?, redact_diff: redact_diff)
inspect_deployment_changes(
Psych.load(manifest_yaml),
interactive: interactive?,
redact_diff: redact_diff
)
say('Please review all changes carefully'.make_yellow) if interactive?
deployment_name = File.basename(deployment)
......
......@@ -4,12 +4,18 @@ describe 'cancel task', type: :integration do
with_reset_sandbox_before_each
it 'creates a task and then successfully cancels it' do
manifest_hash = Bosh::Spec::Deployments.legacy_simple_manifest
manifest_hash['compilation']['workers'] = 1
manifest_hash = Bosh::Spec::Deployments.simple_manifest
manifest_hash['jobs'][0]['template'] = 'job_with_blocking_compilation'
manifest_hash['jobs'][0]['instances'] = 1
deploy_result = deploy_simple(manifest_hash: manifest_hash, no_track: true)
cloud_config_hash = Bosh::Spec::Deployments.simple_cloud_config
cloud_config_hash['compilation']['workers'] = 1
deploy_result = deploy_from_scratch(
cloud_config_hash: cloud_config_hash,
manifest_hash: manifest_hash,
no_track: true
)
task_id = Bosh::Spec::OutputParser.new(deploy_result).task_id('running')
director.wait_for_first_available_vm
......
......@@ -13,9 +13,12 @@ describe 'cli: cloudcheck', type: :integration do
runner.run("upload stemcell #{spec_asset('valid_stemcell.tgz')}")
manifest = Bosh::Spec::Deployments.legacy_simple_manifest
cloud_config_manifest = yaml_file('cloud_manifest', Bosh::Spec::Deployments.simple_cloud_config)
bosh_runner.run("update cloud-config #{cloud_config_manifest.path}")
manifest = Bosh::Spec::Deployments.simple_manifest
manifest['jobs'][0]['persistent_disk'] = 100
deployment_manifest = yaml_file('simple', manifest)
deployment_manifest = yaml_file('deployment_manifest', manifest)
runner.run("deployment #{deployment_manifest.path}")
......
......@@ -27,6 +27,7 @@ describe 'cli: compiled_packages', type: :integration do
target_and_login
bosh_runner.run("upload release #{release_tarball_path}")
upload_stemcell
upload_cloud_config
# deploy must compile the packages
output = deploy_simple_manifest
......@@ -47,6 +48,7 @@ describe 'cli: compiled_packages', type: :integration do
target_and_login
bosh_runner.run("upload release #{release_tarball_path}")
upload_stemcell
upload_cloud_config
bosh_runner.run("import compiled_packages #{compiled_packages_tarball_path}")
......@@ -59,7 +61,10 @@ describe 'cli: compiled_packages', type: :integration do
it 'allows the user to import compiled packages after a previously successful import' do
target_and_login
deployment_manifest = yaml_file('simple_manifest', Bosh::Spec::Deployments.legacy_simple_manifest)
cloud_config_manifest = yaml_file('cloud_manifest', Bosh::Spec::Deployments.simple_cloud_config)
bosh_runner.run("update cloud-config #{cloud_config_manifest.path}")
deployment_manifest = yaml_file('deployment_manifest', Bosh::Spec::Deployments.simple_manifest)
bosh_runner.run("deployment #{deployment_manifest.path}")
bosh_runner.run("upload stemcell #{spec_asset('valid_stemcell.tgz')}")
bosh_runner.run("upload release #{create_release}")
......
......@@ -14,11 +14,11 @@ describe 'cli: deployment process', type: :integration do
parse_release_tarball_path(output)
end
deployment_manifest = yaml_file('simple', Bosh::Spec::Deployments.legacy_simple_manifest)
expect(File).to exist(release_filename)
expect(File).to exist(deployment_manifest.path)
cloud_config_manifest = yaml_file('cloud_manifest', Bosh::Spec::Deployments.simple_cloud_config)
deployment_manifest = yaml_file('deployment_manifest', Bosh::Spec::Deployments.simple_manifest)
target_and_login
bosh_runner.run("update cloud-config #{cloud_config_manifest.path}")
bosh_runner.run("deployment #{deployment_manifest.path}")
bosh_runner.run("upload stemcell #{stemcell_filename}")
bosh_runner.run("upload release #{release_filename}")
......@@ -32,12 +32,14 @@ describe 'cli: deployment process', type: :integration do
context 'given two deployments from one release' do
it 'is successful' do
release_filename = spec_asset('valid_release.tgz')
minimal_manifest = Bosh::Spec::Deployments.legacy_minimal_manifest
deployment_manifest = yaml_file('minimal', minimal_manifest)
minimal_manifest = Bosh::Spec::Deployments.minimal_manifest
deployment_manifest = yaml_file('minimal_deployment', minimal_manifest)
cloud_config_manifest = yaml_file('cloud_manifest', Bosh::Spec::Deployments.minimal_cloud_config)
target_and_login
bosh_runner.run("deployment #{deployment_manifest.path}")
bosh_runner.run("upload release #{release_filename}")
bosh_runner.run("update cloud-config #{cloud_config_manifest.path}")
filename = File.basename(deployment_manifest.path)
expect(bosh_runner.run('deploy')).to match /Deployed `#{filename}' to `Test Director'/
......@@ -52,9 +54,9 @@ describe 'cli: deployment process', type: :integration do
+----------+--------------+-------------+--------------+
| Name | Release(s) | Stemcell(s) | Cloud Config |
+----------+--------------+-------------+--------------+
| minimal | appcloud/0.1 | | none |
| minimal | appcloud/0.1 | | latest |
+----------+--------------+-------------+--------------+
| minimal2 | appcloud/0.1 | | none |
| minimal2 | appcloud/0.1 | | latest |
+----------+--------------+-------------+--------------+
Deployments total: 2
......@@ -66,23 +68,20 @@ describe 'cli: deployment process', type: :integration do
describe 'bosh deployments' do
it 'lists deployment details' do
release_filename = spec_asset('valid_release.tgz')
deployment_manifest = yaml_file('minimal', Bosh::Spec::Deployments.legacy_minimal_manifest)
deployment_manifest = yaml_file('minimal', Bosh::Spec::Deployments.minimal_manifest)
cloud_config_manifest = yaml_file('cloud_manifest', Bosh::Spec::Deployments.minimal_cloud_config)
Dir.mktmpdir do |tmpdir|
cloud_config_path = File.join(tmpdir, 'cloud_config.yml')
File.write(cloud_config_path, "")
target_and_login
bosh_runner.run("update cloud-config #{cloud_config_path}")
bosh_runner.run("deployment #{deployment_manifest.path}")
bosh_runner.run("upload release #{release_filename}")
target_and_login
bosh_runner.run("update cloud-config #{cloud_config_manifest.path}")
bosh_runner.run("deployment #{deployment_manifest.path}")
bosh_runner.run("upload release #{release_filename}")
out = bosh_runner.run('deploy')
filename = File.basename(deployment_manifest.path)
expect(out).to match /Deployed `#{filename}' to `Test Director'/
out = bosh_runner.run('deploy')
filename = File.basename(deployment_manifest.path)
expect(out).to match /Deployed `#{filename}' to `Test Director'/
deployments_output = bosh_runner.run('deployments')
expect(deployments_output).to eq(<<-OUT)
deployments_output = bosh_runner.run('deployments')
expect(deployments_output).to eq(<<-OUT)
+---------+--------------+-------------+--------------+
| Name | Release(s) | Stemcell(s) | Cloud Config |
......@@ -92,16 +91,17 @@ describe 'cli: deployment process', type: :integration do
Deployments total: 1
OUT
end
end
end
describe 'bosh delete deployment' do
it 'deletes an existing deployment' do
release_filename = spec_asset('valid_release.tgz')
deployment_manifest = yaml_file('minimal', Bosh::Spec::Deployments.legacy_minimal_manifest)
deployment_manifest = yaml_file('minimal', Bosh::Spec::Deployments.minimal_manifest)
cloud_config_manifest = yaml_file('cloud_manifest', Bosh::Spec::Deployments.minimal_cloud_config)
target_and_login
bosh_runner.run("update cloud-config #{cloud_config_manifest.path}")
bosh_runner.run("deployment #{deployment_manifest.path}")
bosh_runner.run("upload release #{release_filename}")
......
......@@ -5,9 +5,9 @@ describe 'cli: locks', type: :integration do
context 'when a deployment is in progress' do
before do
manifest_hash = Bosh::Spec::Deployments.legacy_simple_manifest
manifest_hash = Bosh::Spec::Deployments.simple_manifest
manifest_hash['update']['canary_watch_time'] = 6000
deploy_simple(manifest_hash: manifest_hash, no_track: true)
deploy_from_scratch(manifest_hash: manifest_hash, no_track: true)
end
it 'lists a deployment lock' do
......
......@@ -15,10 +15,11 @@ describe 'cli: package compilation', type: :integration do
parse_release_tarball_path(output)
end
deployment_manifest = yaml_file(
'simple_manifest', Bosh::Spec::Deployments.legacy_simple_manifest)
cloud_config_manifest = yaml_file('cloud_manifest', Bosh::Spec::Deployments.simple_cloud_config)
deployment_manifest = yaml_file('deployment_manifest', Bosh::Spec::Deployments.simple_manifest)
target_and_login
bosh_runner.run("update cloud-config #{cloud_config_manifest.path}")
bosh_runner.run("deployment #{deployment_manifest.path}")
bosh_runner.run("upload stemcell #{stemcell_filename}")
bosh_runner.run("upload release #{release_filename}")
......@@ -43,18 +44,22 @@ describe 'cli: package compilation', type: :integration do
end
it 'sends only immediate dependancies to the agent for each package compilation task' do
manifest = Bosh::Spec::Deployments.legacy_simple_manifest
manifest['jobs'][0]['template'] = ['foobar', 'goobaz']
manifest['jobs'][0]['instances'] = 1
manifest['resource_pools'][0]['size'] = 1
cloud_config_hash = Bosh::Spec::Deployments.simple_cloud_config
cloud_config_hash['resource_pools'][0]['size'] = 1
manifest['releases'].first['name'] = 'compilation-test'
manifest_hash = Bosh::Spec::Deployments.simple_manifest
manifest_hash['jobs'][0]['template'] = ['foobar', 'goobaz']
manifest_hash['jobs'][0]['instances'] = 1
manifest_hash['releases'].first['name'] = 'compilation-test'
deployment_manifest = yaml_file('whatevs_manifest', manifest)
cloud_manifest = yaml_file('cloud_manifest', cloud_config_hash)
deployment_manifest = yaml_file('whatevs_manifest', manifest_hash)
target_and_login
bosh_runner.run("upload release #{spec_asset('release_compilation_test.tgz')}")
bosh_runner.run("update cloud-config #{cloud_manifest.path}")
bosh_runner.run("deployment #{deployment_manifest.path}")
bosh_runner.run("upload stemcell #{spec_asset('valid_stemcell.tgz')}")
bosh_runner.run('deploy')
......@@ -100,12 +105,17 @@ describe 'cli: package compilation', type: :integration do
end
it 'returns truncated output' do
manifest_hash = Bosh::Spec::Deployments.legacy_simple_manifest
manifest_hash['compilation']['workers'] = 1
manifest_hash = Bosh::Spec::Deployments.simple_manifest
manifest_hash['jobs'][0]['template'] = 'fails_with_too_much_output'
manifest_hash['jobs'][0]['instances'] = 1
deploy_output = deploy_simple(manifest_hash: manifest_hash, failure_expected: true)
cloud_config_hash = Bosh::Spec::Deployments.simple_cloud_config
cloud_config_hash['compilation']['workers'] = 1
deploy_output = deploy_from_scratch(
cloud_config_hash: cloud_config_hash,
manifest_hash: manifest_hash,
failure_expected: true
)
expect(deploy_output).to include('Truncated stdout: bbbbbbbbbb')
expect(deploy_output).to include('Truncated stderr: yyyyyyyyyy')
......
......@@ -4,9 +4,9 @@ describe 'cli: property management', type: :integration do
with_reset_sandbox_before_each
it 'can get/set/unset deployment properties' do
manifest = Bosh::Spec::Deployments.legacy_simple_manifest
manifest = Bosh::Spec::Deployments.simple_manifest
manifest['jobs'] = []
deploy_simple(manifest_hash: manifest)
deploy_from_scratch(manifest_hash: manifest)
expect(bosh_runner.run('set property foo bar')).to match /Property `foo' set to `bar'/
expect(bosh_runner.run('get property foo')).to match /Property `foo' value is `bar'/
......
......@@ -52,7 +52,7 @@ describe 'cli: stemcell', type: :integration do
context 'when stemcell is in use by a deployment' do
it 'refuses to delete it' do
deploy_simple
deploy_from_scratch
results = bosh_runner.run('delete stemcell ubuntu-stemcell 1', failure_expected: true)
expect(results).to include("Stemcell `ubuntu-stemcell/1' is still in use by: simple")
end
......
......@@ -4,9 +4,9 @@ describe 'cli: vms', type: :integration do
with_reset_sandbox_before_each
it 'should return vms in a deployment' do
manifest_hash = Bosh::Spec::Deployments.legacy_simple_manifest
manifest_hash = Bosh::Spec::Deployments.simple_manifest
manifest_hash['releases'].first['version'] = 'latest'
deploy_simple(manifest_hash: manifest_hash)
deploy_from_scratch(manifest_hash: manifest_hash)
vms = bosh_runner.run('vms')
expect(vms).to match /foobar\/0/
......@@ -16,7 +16,7 @@ describe 'cli: vms', type: :integration do
end
it 'should return vm --vitals' do
deploy_simple
deploy_from_scratch
vitals = director.vms_vitals[0]
expect(vitals[:cpu_user]).to match /\d+\.?\d*[%]/
......
......@@ -30,7 +30,10 @@ describe 'collocating templates from multiple releases', type: :integration do
bosh_runner.run("upload release #{spec_asset('dummy2-release.tgz')}")
bosh_runner.run("upload stemcell #{spec_asset('valid_stemcell.tgz')}")
manifest_hash = Bosh::Spec::Deployments.legacy_simple_manifest.merge(manifest)
cloud_config_manifest = yaml_file('cloud_manifest', Bosh::Spec::Deployments.simple_cloud_config)
bosh_runner.run("update cloud-config #{cloud_config_manifest.path}")
manifest_hash = Bosh::Spec::Deployments.simple_manifest.merge(manifest)
deployment_manifest = yaml_file('simple', manifest_hash)
bosh_runner.run("deployment #{deployment_manifest.path}")
bosh_runner.run("deploy")
......@@ -64,7 +67,10 @@ describe 'collocating templates from multiple releases', type: :integration do
bosh_runner.run("upload release #{spec_asset('dummy2-release.tgz')}")
bosh_runner.run("upload stemcell #{spec_asset('valid_stemcell.tgz')}")
manifest_hash = Bosh::Spec::Deployments.legacy_simple_manifest.merge(manifest)
cloud_config_manifest = yaml_file('cloud_manifest', Bosh::Spec::Deployments.simple_cloud_config)
bosh_runner.run("update cloud-config #{cloud_config_manifest.path}")
manifest_hash = Bosh::Spec::Deployments.simple_manifest.merge(manifest)
deployment_manifest = yaml_file('simple', manifest_hash)
bosh_runner.run("deployment #{deployment_manifest.path}")
......
......@@ -4,9 +4,9 @@ describe 'deploy job template', type: :integration do
with_reset_sandbox_before_each
it 're-evaluates job templates with new manifest job properties' do
manifest_hash = Bosh::Spec::Deployments.legacy_simple_manifest
manifest_hash = Bosh::Spec::Deployments.simple_manifest
manifest_hash['properties'] = { 'test_property' => 1 }
deploy_simple(manifest_hash: manifest_hash)
deploy_from_scratch(manifest_hash: manifest_hash)
foobar_vm = director.vm('foobar/0')
......@@ -21,23 +21,26 @@ describe 'deploy job template', type: :integration do
end
it 're-evaluates job templates with new dynamic network configuration' do
manifest_hash = Bosh::Spec::Deployments.legacy_simple_manifest
manifest_hash['networks'].first['type'] = 'dynamic'
manifest_hash['networks'].first['cloud_properties'] = {}
manifest_hash['networks'].first.delete('subnets')
manifest_hash['resource_pools'].first['size'] = 1
manifest_hash = Bosh::Spec::Deployments.simple_manifest
manifest_hash['jobs'].first['instances'] = 1
manifest_hash['jobs'].first['properties'] = { 'network_name' => 'a' }
cloud_config_hash = Bosh::Spec::Deployments.simple_cloud_config
cloud_config_hash['networks'].first['type'] = 'dynamic'
cloud_config_hash['networks'].first['cloud_properties'] = {}
cloud_config_hash['networks'].first.delete('subnets')
cloud_config_hash['resource_pools'].first['size'] = 1
current_sandbox.cpi.commands.make_create_vm_always_use_dynamic_ip('127.0.0.101')
deploy_simple(manifest_hash: manifest_hash)
deploy_from_scratch(cloud_config_hash: cloud_config_hash, manifest_hash: manifest_hash)
# VM deployed for the first time knows about correct dynamic IP
template = director.vm('foobar/0').read_job_template('foobar', 'bin/foobar_ctl')
expect(template).to include('a_ip=127.0.0.101')
# Force VM recreation
manifest_hash['resource_pools'].first['cloud_properties'] = {'changed' => true}
cloud_config_hash['resource_pools'].first['cloud_properties'] = {'changed' => true}
upload_cloud_config(cloud_config_hash: cloud_config_hash)
current_sandbox.cpi.commands.make_create_vm_always_use_dynamic_ip('127.0.0.102')
deploy_simple_manifest(manifest_hash: manifest_hash)
......@@ -52,8 +55,7 @@ describe 'deploy job template', type: :integration do
after { current_sandbox.health_monitor_process.stop }
it 'creates alerts to mark the start and end of an update deployment' do
manifest_hash = Bosh::Spec::Deployments.legacy_simple_manifest
deploy_simple(manifest_hash: manifest_hash)
deploy_from_scratch
waiter.wait(60) do
expect(health_monitor.read_log).to match(/\[ALERT\] Alert @ .* Begin update deployment for simple/)
......
......@@ -4,11 +4,11 @@ describe 'deploy job update', type: :integration do
with_reset_sandbox_before_each
it 'updates a job with multiple instances in parallel and obeys max_in_flight' do
manifest_hash = Bosh::Spec::Deployments.legacy_simple_manifest
manifest_hash = Bosh::Spec::Deployments.simple_manifest
manifest_hash['update']['canaries'] = 0
manifest_hash['update']['max_in_flight'] = 2
manifest_hash['properties'] = { 'test_property' => 2 }
deploy_simple(manifest_hash: manifest_hash)
deploy_from_scratch(manifest_hash: manifest_hash)
times = start_and_finish_times_for_job_updates('last')
expect(times['foobar/1']['started']).to be >= times['foobar/0']['started']
......@@ -16,34 +16,126 @@ describe 'deploy job update', type: :integration do
expect(times['foobar/2']['started']).to be >= [times['foobar/0']['finished'], times['foobar/1']['finished']].min
end
it 'redacts manifest diff values when requested' do
deploy_simple
describe 'Displaying manifest diffs' do
let(:cloud_config_hash) { Bosh::Spec::Deployments.simple_cloud_config }
let(:manifest_hash) { Bosh::Spec::Deployments.simple_manifest }
manifest_hash = Bosh::Spec::Deployments.legacy_simple_manifest
manifest_hash['update']['canary_watch_time'] = 0
manifest_hash['jobs'][0]['instances'] = 2
manifest_hash['resource_pools'][0]['size'] = 2
it 'only accurately reports deployment configuration changes and not cloud configuration changes' do
deploy_from_scratch
set_deployment(manifest_hash: manifest_hash)
deploy_output = deploy(failure_expected: true, redact_diff: true)
puts deploy_output
expect(deploy_output).to match(/Update\nChanges found - Redacted/m)
expect(deploy_output).to match(/Resource pools\nChanges found - Redacted/m)