From 16084ee9d3fdfc333a113e4cbcd3f6d2fc402628 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matija=20=C4=8Cupi=C4=87?= Date: Wed, 31 Jul 2019 17:36:57 +0200 Subject: Port changes from EE Ports changes from https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/12343 --- spec/lib/gitlab/ci/pipeline/seed/build_spec.rb | 24 ++++++++++++++++++++---- spec/lib/gitlab/ci/yaml_processor_spec.rb | 5 ++++- 2 files changed, 24 insertions(+), 5 deletions(-) (limited to 'spec/lib') diff --git a/spec/lib/gitlab/ci/pipeline/seed/build_spec.rb b/spec/lib/gitlab/ci/pipeline/seed/build_spec.rb index 762025f9bd9..1b8e86b1f18 100644 --- a/spec/lib/gitlab/ci/pipeline/seed/build_spec.rb +++ b/spec/lib/gitlab/ci/pipeline/seed/build_spec.rb @@ -20,20 +20,36 @@ describe Gitlab::Ci::Pipeline::Seed::Build do describe '#bridge?' do subject { seed_build.bridge? } - context 'when job is a bridge' do + context 'when job is a downstream bridge' do let(:attributes) do { name: 'rspec', ref: 'master', options: { trigger: 'my/project' } } end it { is_expected.to be_truthy } + + context 'when trigger definition is empty' do + let(:attributes) do + { name: 'rspec', ref: 'master', options: { trigger: '' } } + end + + it { is_expected.to be_falsey } + end end - context 'when trigger definition is empty' do + context 'when job is an upstream bridge' do let(:attributes) do - { name: 'rspec', ref: 'master', options: { trigger: '' } } + { name: 'rspec', ref: 'master', options: { bridge_needs: { pipeline: 'my/project' } } } end - it { is_expected.to be_falsey } + it { is_expected.to be_truthy } + + context 'when upstream definition is empty' do + let(:attributes) do + { name: 'rspec', ref: 'master', options: { bridge_needs: { pipeline: '' } } } + end + + it { is_expected.to be_falsey } + end end context 'when job is not a bridge' do diff --git a/spec/lib/gitlab/ci/yaml_processor_spec.rb b/spec/lib/gitlab/ci/yaml_processor_spec.rb index 4ffa1fc9fd8..d5567b4f166 100644 --- a/spec/lib/gitlab/ci/yaml_processor_spec.rb +++ b/spec/lib/gitlab/ci/yaml_processor_spec.rb @@ -1153,7 +1153,10 @@ module Gitlab stage_idx: 1, name: "test1", options: { - script: ["test"] + script: ["test"], + # This does not make sense, there is a follow-up: + # https://gitlab.com/gitlab-org/gitlab-ce/issues/65569 + bridge_needs: %w[build1 build2] }, needs_attributes: [ { name: "build1" }, -- cgit v1.2.1