diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2016-08-30 23:12:55 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2016-08-30 23:12:55 +0800 |
commit | 4789adc565b08ed4979ef3b876b2fbd6224fa084 (patch) | |
tree | fd1a916dc3cf3d3e3fb924f8a4aa96c58b8e74d5 | |
parent | f10a1e331dc83fe3c973283d9f9a50f75c59d2d5 (diff) | |
download | gitlab-ce-4789adc565b08ed4979ef3b876b2fbd6224fa084.tar.gz |
Add test cases from:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/6084#note_14709761
-rw-r--r-- | spec/lib/gitlab/ci/pipeline_duration_spec.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/lib/gitlab/ci/pipeline_duration_spec.rb b/spec/lib/gitlab/ci/pipeline_duration_spec.rb index 5cd0727f46b..21d5a5c96a2 100644 --- a/spec/lib/gitlab/ci/pipeline_duration_spec.rb +++ b/spec/lib/gitlab/ci/pipeline_duration_spec.rb @@ -85,6 +85,34 @@ describe Gitlab::Ci::PipelineDuration do it_behaves_like 'calculating duration' end + context 'test sample F' do + let(:data) do + [[1, 3], + [2, 4], + [2, 4], + [2, 4], + [5, 8]] + end + + let(:duration) { 6 } + let(:pending_duration) { 1 } + + it_behaves_like 'calculating duration' + end + + context 'test sample G' do + let(:data) do + [[1, 3], + [2, 4], + [6, 7]] + end + + let(:duration) { 4 } + let(:pending_duration) { 2 } + + it_behaves_like 'calculating duration' + end + def create_calculator(data) segments = data.shuffle.map do |(first, last)| Gitlab::Ci::PipelineDuration::Period.new(first, last) |