Skip to content
Snippets Groups Projects
Commit f9274efa authored by Fred Cox's avatar Fred Cox Committed by Marius Bobin
Browse files

Allow just one parallel job

Changelog: changed
parent 03da5bfc
No related branches found
No related tags found
2 merge requests!122597doc/gitaly: Remove references to removed metrics,!118774Allow just one parallel job
......@@ -2905,7 +2905,7 @@ Parallel jobs are named sequentially from `job_name 1/N` to `job_name N/N`.
**Possible inputs**:
- A numeric value from `2` to `200`.
- A numeric value from `1` to `200`.
**Example of `parallel`**:
......
......@@ -19,7 +19,7 @@ class ParallelBuilds < ::Gitlab::Config::Entry::Node
validations do
validates :config, numericality: { only_integer: true,
greater_than_or_equal_to: 2,
greater_than_or_equal_to: 1,
less_than_or_equal_to: Entry::Product::Parallel::PARALLEL_LIMIT },
allow_nil: true
......
......@@ -261,13 +261,13 @@
end
end
context 'when it is lower than two' do
let(:config) { { script: 'echo', parallel: 1 } }
context 'when it is lower than one' do
let(:config) { { script: 'echo', parallel: 0 } }
it 'returns error about value too low' do
expect(entry).not_to be_valid
expect(entry.errors)
.to include 'parallel config must be greater than or equal to 2'
.to include 'parallel config must be greater than or equal to 1'
end
end
......
......@@ -27,10 +27,10 @@
it_behaves_like 'invalid config', /should be an integer or a hash/
end
context 'when it is lower than two' do
let(:config) { 1 }
context 'when it is lower than one' do
let(:config) { 0 }
it_behaves_like 'invalid config', /must be greater than or equal to 2/
it_behaves_like 'invalid config', /must be greater than or equal to 1/
end
context 'when it is bigger than 200' do
......
......@@ -53,6 +53,22 @@
end
end
shared_examples 'single parallelized job' do
it { expect(subject.size).to eq(1) }
it 'has attributes' do
expect(subject.map(&:attributes)).to match_array(
[
{ name: 'test 1/1', instance: 1, parallel: { total: 1 } }
]
)
end
it 'has parallelized name' do
expect(subject.map(&:name)).to match_array(['test 1/1'])
end
end
context 'with numbers' do
let(:config) { 3 }
......@@ -64,5 +80,11 @@
it_behaves_like 'parallelized job'
end
context 'with one' do
let(:config) { 1 }
it_behaves_like 'single parallelized job'
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment