diff --git a/jobs/cloud_controller_ng/spec b/jobs/cloud_controller_ng/spec index 15cf620136..ec7c223390 100644 --- a/jobs/cloud_controller_ng/spec +++ b/jobs/cloud_controller_ng/spec @@ -368,6 +368,8 @@ properties: cc.jobs.global.timeout_in_seconds: description: "The longest any job can take before it is cancelled unless overridden per job" default: 14400 # 4 hours + cc.jobs.queues.cc_generic.timeout_in_seconds: + description: "The longest jobs in the cc-generic queue can take before they are cancelled" cc.jobs.blobstore_delete.timeout_in_seconds: description: "The longest this job can take before it is cancelled" cc.jobs.droplet_upload.timeout_in_seconds: diff --git a/jobs/cloud_controller_ng/templates/cloud_controller_ng.yml.erb b/jobs/cloud_controller_ng/templates/cloud_controller_ng.yml.erb index c4cc44f9cd..c4c2b3a8b2 100644 --- a/jobs/cloud_controller_ng/templates/cloud_controller_ng.yml.erb +++ b/jobs/cloud_controller_ng/templates/cloud_controller_ng.yml.erb @@ -83,6 +83,11 @@ jobs: enable_dynamic_job_priorities: <%= p("cc.jobs.enable_dynamic_job_priorities") %> global: timeout_in_seconds: <%= p("cc.jobs.global.timeout_in_seconds") %> + queues: + <% if_p("cc.jobs.queues.cc_generic.timeout_in_seconds") do |timeout| %> + cc_generic: + timeout_in_seconds: <%= timeout %> + <% end %> <% if_p("cc.jobs.blobstore_delete.timeout_in_seconds") do |timeout| %> blobstore_delete: timeout_in_seconds: <%= timeout %> diff --git a/spec/cloud_controller_ng/cloud_controller_ng_spec.rb b/spec/cloud_controller_ng/cloud_controller_ng_spec.rb index 92dcce008c..1b250734c5 100644 --- a/spec/cloud_controller_ng/cloud_controller_ng_spec.rb +++ b/spec/cloud_controller_ng/cloud_controller_ng_spec.rb @@ -721,6 +721,24 @@ module Test end end end + + describe 'cc_jobs_queues' do + context 'when cc.jobs.queues is not set' do + it 'does not render ccng config' do + template_hash = YAML.safe_load(template.render(merged_manifest_properties, consumes: links)) + expect(template_hash['jobs']['queues']).to be_nil + end + end + + context "when 'cc.jobs.queues.cc_generic.timeout_in_seconds' is set" do + before { merged_manifest_properties['cc']['jobs'] = { 'queues' => { 'cc_generic' => { 'timeout_in_seconds' => 10 } } } } + + it 'renders the correct value into the ccng config' do + template_hash = YAML.safe_load(template.render(merged_manifest_properties, consumes: links)) + expect(template_hash['jobs']['queues']['cc_generic']['timeout_in_seconds']).to eq(10) + end + end + end end end end