diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-16 12:07:51 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-16 12:07:51 +0300 |
commit | 914ea32e0efca21436220df2c10e1bfbe4ed3da9 (patch) | |
tree | e8eb3b97aea2006bd863c586b7ec41d51f654b3b /spec/serializers | |
parent | 3546e1bb0971347e9e9984de0799e3fb53743b33 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/serializers')
-rw-r--r-- | spec/serializers/pipeline_details_entity_spec.rb | 35 | ||||
-rw-r--r-- | spec/serializers/pipeline_serializer_spec.rb | 5 |
2 files changed, 38 insertions, 2 deletions
diff --git a/spec/serializers/pipeline_details_entity_spec.rb b/spec/serializers/pipeline_details_entity_spec.rb index d7c40b8e7b9..b180ede51eb 100644 --- a/spec/serializers/pipeline_details_entity_spec.rb +++ b/spec/serializers/pipeline_details_entity_spec.rb @@ -138,5 +138,40 @@ describe PipelineDetailsEntity do expect(subject[:flags][:yaml_errors]).to be false end end + + context 'when pipeline is triggered by other pipeline' do + let(:pipeline) { create(:ci_empty_pipeline) } + + before do + create(:ci_sources_pipeline, pipeline: pipeline) + end + + it 'contains an information about depedent pipeline' do + expect(subject[:triggered_by]).to be_a(Hash) + expect(subject[:triggered_by][:path]).not_to be_nil + expect(subject[:triggered_by][:details]).not_to be_nil + expect(subject[:triggered_by][:details][:status]).not_to be_nil + expect(subject[:triggered_by][:project]).not_to be_nil + end + end + + context 'when pipeline triggered other pipeline' do + let(:pipeline) { create(:ci_empty_pipeline) } + let(:build) { create(:ci_build, pipeline: pipeline) } + + before do + create(:ci_sources_pipeline, source_job: build) + create(:ci_sources_pipeline, source_job: build) + end + + it 'contains an information about depedent pipeline' do + expect(subject[:triggered]).to be_a(Array) + expect(subject[:triggered].length).to eq(2) + expect(subject[:triggered].first[:path]).not_to be_nil + expect(subject[:triggered].first[:details]).not_to be_nil + expect(subject[:triggered].first[:details][:status]).not_to be_nil + expect(subject[:triggered].first[:project]).not_to be_nil + end + end end end diff --git a/spec/serializers/pipeline_serializer_spec.rb b/spec/serializers/pipeline_serializer_spec.rb index a1d275cfa2a..9762c83ed6a 100644 --- a/spec/serializers/pipeline_serializer_spec.rb +++ b/spec/serializers/pipeline_serializer_spec.rb @@ -158,7 +158,7 @@ describe PipelineSerializer do it 'verifies number of queries', :request_store do recorded = ActiveRecord::QueryRecorder.new { subject } - expected_queries = Gitlab.ee? ? 38 : 31 + expected_queries = Gitlab.ee? ? 38 : 35 expect(recorded.count).to be_within(2).of(expected_queries) expect(recorded.cached_count).to eq(0) @@ -179,7 +179,8 @@ describe PipelineSerializer do # pipeline. With the same ref this check is cached but if refs are # different then there is an extra query per ref # https://gitlab.com/gitlab-org/gitlab-foss/issues/46368 - expected_queries = Gitlab.ee? ? 44 : 38 + expected_queries = Gitlab.ee? ? 44 : 41 + expect(recorded.count).to be_within(2).of(expected_queries) expect(recorded.cached_count).to eq(0) end |