Skip to content
This repository was archived by the owner on Jun 2, 2021. It is now read-only.

Commit 741ca24

Browse files
piyalibanerjeeJaskanwal Pawar
authored andcommitted
V3 build update action updates droplet process types
- removed what we thought was an unnecessary UPDATE call in a DB transaction, hopefully that doesn't bite us [#171713645] Co-authored-by: Piyali Banerjee <pbanerjee@pivotal.io> Co-authored-by: Jaskanwal Pawar <jpawar@pivotal.io>
1 parent f80e43e commit 741ca24

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

app/actions/build_update.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ def update(build, message)
1717
elsif message.state == VCAP::CloudController::BuildModel::STAGED_STATE
1818
droplet = VCAP::CloudController::DropletCreate.new.create_docker_droplet(build)
1919
droplet.lock!
20-
droplet.update(docker_receipt_image: message.lifecycle.dig(:data, :image))
20+
droplet.docker_receipt_image = message.lifecycle.dig(:data, :image)
21+
droplet.process_types = message.lifecycle.dig(:data, :processTypes)
2122
droplet.mark_as_staged
22-
droplet.process_types = { web: '' }
2323
droplet.save_changes
2424
build.mark_as_staged
2525
build.save_changes

spec/unit/actions/build_update_spec.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,16 +141,21 @@ module VCAP::CloudController
141141
type: 'kpack',
142142
data: {
143143
image: 'some-fake-image:tag',
144+
processTypes: {
145+
foo: 'foo start',
146+
bar: 'bar start',
147+
},
144148
}
145149
}
146150
}
147151
end
148152

149-
it 'updates the state to STAGED' do
153+
it 'updates the build state as STAGED and updates the droplet with correct metadata' do
150154
build_update.update(build, message)
151155

152156
expect(build.state).to eq('STAGED')
153157
expect(build.droplet.docker_receipt_image).to eq('some-fake-image:tag')
158+
expect(build.droplet.process_types).to eq({ 'foo' => 'foo start', 'bar' => 'bar start' })
154159
end
155160
end
156161

0 commit comments

Comments
 (0)