Return untouched hash if no job is parallelized

This commit is contained in:
Matija Čupić 2018-11-07 13:01:33 +01:00
parent e7df959b8f
commit 126fbe580f
No known key found for this signature in database
GPG Key ID: 4BAF84FFACD2E5DE
2 changed files with 12 additions and 2 deletions

View File

@ -9,14 +9,16 @@ module Gitlab
end
def normalize_jobs
extract_parallelized_jobs
extract_parallelized_jobs!
return @jobs_config if @parallelized_jobs.empty?
parallelized_config = parallelize_jobs
parallelize_dependencies(parallelized_config)
end
private
def extract_parallelized_jobs
def extract_parallelized_jobs!
@parallelized_jobs = {}
@jobs_config.each do |job_name, config|

View File

@ -31,6 +31,14 @@ describe Gitlab::Ci::Config::Normalizer do
expect(configs).to all(eq(original_config))
end
context 'when the job is not parallelized' do
let(:job_config) { { script: 'rspec', name: 'rspec' } }
it 'returns the same hash' do
is_expected.to eq(config)
end
end
context 'when there is a job with a slash in it' do
let(:job_name) { :"rspec 35/2" }