summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzegorz@gitlab.com>2019-08-14 08:37:16 +0000
committerGrzegorz Bizon <grzegorz@gitlab.com>2019-08-14 08:37:16 +0000
commitd1e80af6035d6f726cb75dde00b6a6bde256b5a3 (patch)
treea67b411facd25f5aa804f8dbef3020535cc0c555 /spec
parent94cf543fe3909a0a12771765a85c3c596f318046 (diff)
parent93e951821543b0cbb12807cc710d3e21d7db8993 (diff)
downloadgitlab-ce-d1e80af6035d6f726cb75dde00b6a6bde256b5a3.tar.gz
Merge branch 'require-needs-to-be-present' into 'master'
Require `needs:` to be present Closes #65839 See merge request gitlab-org/gitlab-ce!31761
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/gitlab/ci/pipeline/seed/build_spec.rb17
-rw-r--r--spec/lib/gitlab/ci/pipeline/seed/stage_spec.rb10
-rw-r--r--spec/services/ci/create_pipeline_service_spec.rb3
3 files changed, 27 insertions, 3 deletions
diff --git a/spec/lib/gitlab/ci/pipeline/seed/build_spec.rb b/spec/lib/gitlab/ci/pipeline/seed/build_spec.rb
index 762025f9bd9..e0fbd2e7369 100644
--- a/spec/lib/gitlab/ci/pipeline/seed/build_spec.rb
+++ b/spec/lib/gitlab/ci/pipeline/seed/build_spec.rb
@@ -396,7 +396,14 @@ describe Gitlab::Ci::Pipeline::Seed::Build do
end
context 'when build job is not present in prior stages' do
- it { is_expected.not_to be_included }
+ it "is included" do
+ is_expected.to be_included
+ end
+
+ it "returns an error" do
+ expect(subject.errors).to contain_exactly(
+ "rspec: needs 'build'")
+ end
end
context 'when build job is part of prior stages' do
@@ -414,7 +421,13 @@ describe Gitlab::Ci::Pipeline::Seed::Build do
let(:previous_stages) { [stage_seed] }
- it { is_expected.to be_included }
+ it "is included" do
+ is_expected.to be_included
+ end
+
+ it "does not have errors" do
+ expect(subject.errors).to be_empty
+ end
end
end
end
diff --git a/spec/lib/gitlab/ci/pipeline/seed/stage_spec.rb b/spec/lib/gitlab/ci/pipeline/seed/stage_spec.rb
index 6fba9f37d91..a13335f63d5 100644
--- a/spec/lib/gitlab/ci/pipeline/seed/stage_spec.rb
+++ b/spec/lib/gitlab/ci/pipeline/seed/stage_spec.rb
@@ -121,6 +121,16 @@ describe Gitlab::Ci::Pipeline::Seed::Stage do
end
end
+ describe '#seeds_errors' do
+ it 'returns all errors from seeds' do
+ expect(subject.seeds.first)
+ .to receive(:errors) { ["build error"] }
+
+ expect(subject.errors).to contain_exactly(
+ "build error")
+ end
+ end
+
describe '#to_resource' do
it 'builds a valid stage object with all builds' do
subject.to_resource.save!
diff --git a/spec/services/ci/create_pipeline_service_spec.rb b/spec/services/ci/create_pipeline_service_spec.rb
index 7e2f311a065..deb68899309 100644
--- a/spec/services/ci/create_pipeline_service_spec.rb
+++ b/spec/services/ci/create_pipeline_service_spec.rb
@@ -1113,7 +1113,7 @@ describe Ci::CreatePipelineService do
test_a: {
stage: "test",
script: "ls",
- only: %w[master feature tags],
+ only: %w[master feature],
needs: %w[build_a]
},
deploy: {
@@ -1143,6 +1143,7 @@ describe Ci::CreatePipelineService do
it 'does not create a pipeline as test_a depends on build_a' do
expect(pipeline).not_to be_persisted
expect(pipeline.builds).to be_empty
+ expect(pipeline.errors[:base]).to contain_exactly("test_a: needs 'build_a'")
end
end