Skip to content

Commit e2fc6df

Browse files
committed
Add deprecation warning in build create
Signed-off-by: Rashed Kamal <rashed.kamal@broadcom.com>
1 parent ac2af87 commit e2fc6df

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

app/controllers/v3/builds_controller.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ def create
6565
}
6666
)
6767

68+
add_warning_headers(build.stack_warnings) if build.stack_warnings&.any?
69+
6870
render status: :created, json: Presenters::V3::BuildPresenter.new(build)
6971
rescue BuildCreate::InvalidPackage => e
7072
bad_request!(e.message)

spec/request/builds_spec.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,16 @@
303303
expect(parsed_response['warnings'][0]['detail']).to include('deprecated')
304304
expect(parsed_response['warnings'][0]['detail']).to include('cflinuxfs3 stack is deprecated')
305305
end
306+
307+
it 'includes warming in response headers' do
308+
post '/v3/builds', create_request.to_json, developer_headers
309+
310+
expect(last_response.status).to eq(201)
311+
expect(last_response.headers['X-Cf-Warnings']).to be_present
312+
warning = CGI.unescape(last_response.headers['X-Cf-Warnings'])
313+
expect(warning).to include('deprecated')
314+
expect(warning).to include('cflinuxfs3 stack is deprecated')
315+
end
306316
end
307317

308318
context 'app has previous builds' do
@@ -322,6 +332,16 @@
322332
expect(parsed_response['warnings'][0]['detail']).to include('cflinuxfs3 stack is deprecated')
323333
expect(app_model.builds_dataset.count).to eq(2)
324334
end
335+
336+
it 'includes warming in response headers' do
337+
post '/v3/builds', create_request.to_json, developer_headers
338+
339+
expect(last_response.status).to eq(201)
340+
expect(last_response.headers['X-Cf-Warnings']).to be_present
341+
warning = CGI.unescape(last_response.headers['X-Cf-Warnings'])
342+
expect(warning).to include('deprecated')
343+
expect(warning).to include('cflinuxfs3 stack is deprecated')
344+
end
325345
end
326346
end
327347
end

0 commit comments

Comments
 (0)