diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-10-26 11:34:40 +0200 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-10-26 11:37:23 +0200 |
commit | d8aed6a27bc6e5e5cd14a10219473c34ba424949 (patch) | |
tree | 5ab4ed9eb1bd19ca2186105148708bf727259fae /spec/models/ci | |
parent | 47b2add4f62d64d1a46109910c86805728e548c4 (diff) | |
download | gitlab-ce-d8aed6a27bc6e5e5cd14a10219473c34ba424949.tar.gz |
Fix optimistic locking
Diffstat (limited to 'spec/models/ci')
-rw-r--r-- | spec/models/ci/pipeline_spec.rb | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb index 43397c5ae39..e13cd8c1dd0 100644 --- a/spec/models/ci/pipeline_spec.rb +++ b/spec/models/ci/pipeline_spec.rb @@ -138,9 +138,9 @@ describe Ci::Pipeline, models: true do describe 'state machine' do let(:current) { Time.now.change(usec: 0) } - let(:build) { create_build('build1', current, 10) } - let(:build_b) { create_build('build2', current, 20) } - let(:build_c) { create_build('build3', current + 50, 10) } + let(:build) { create_build('build1', 0) } + let(:build_b) { create_build('build2', 0) } + let(:build_c) { create_build('build3', 0) } describe '#duration' do before do @@ -163,11 +163,12 @@ describe Ci::Pipeline, models: true do build_c.success end - pipeline.drop + # We have to reload pipeline, because its status is updated by processing builds + pipeline.reload.drop end it 'matches sum of builds duration' do - pipeline.reload + binding.pry expect(pipeline.duration).to eq(40) end @@ -455,7 +456,9 @@ describe Ci::Pipeline, models: true do context 'when all builds succeed' do before do build_a.success - build_b.success + + # We have to reload build_b as this is in next stage and it gets triggered by PipelineProcessWorker + build_b.reload.success end it 'receives a success event once' do |