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

Commit 8f0238c

Browse files
weymanfsethboyles
andcommitted
users should not see manifest diffs for unchanged sidecar memory
[#174829325] Co-authored-by: Weyman Fung <weymanf@vmware.com> Co-authored-by: Seth Boyles <sboyles@pivotal.io>
1 parent d80813b commit 8f0238c

2 files changed

Lines changed: 34 additions & 1 deletion

File tree

app/presenters/v3/app_manifest_presenters/sidecar_properties_presenter.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,17 @@ def to_hash(app:, **_)
99
end
1010

1111
def sidecar_hash(sidecar)
12-
{
12+
hash = {
1313
'name' => sidecar.name,
1414
'process_types' => sidecar.process_types,
1515
'command' => sidecar.command,
1616
}
17+
18+
if sidecar.memory.present?
19+
hash['memory'] = "#{sidecar.memory}M"
20+
end
21+
22+
hash
1723
end
1824
end
1925
end

spec/unit/actions/space_diff_manifest_spec.rb

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,33 @@ module VCAP::CloudController
147147
end
148148
end
149149

150+
context 'when changing sidecar properties on an existing sidecar' do
151+
let!(:sidecar) { SidecarModel.make(app: app1_model, memory: 500, name: 'sidecar1') }
152+
let!(:sidecar_process_type_model) { SidecarProcessTypeModel.make(type: 'web', sidecar: sidecar) }
153+
154+
before do
155+
default_manifest['applications'][0]['sidecars'] = [
156+
{
157+
'name' => 'sidecar1',
158+
'command' => 'bundle exec rake lol',
159+
'process_types' => ['web'],
160+
'memory' => '500M',
161+
}
162+
]
163+
end
164+
165+
it 'returns the correct diff' do
166+
expect(subject).to eq([
167+
{
168+
'op' => 'replace',
169+
'path' => '/applications/0/sidecars/0/command',
170+
'value' => 'bundle exec rake lol',
171+
'was' => 'bundle exec rackup',
172+
},
173+
])
174+
end
175+
end
176+
150177
context 'when there is an unrecognized field in a nested hash' do
151178
before do
152179
default_manifest['applications'][0]['processes'][0]['foo'] = 'bar'

0 commit comments

Comments
 (0)