Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/ci/pipeline_spec.rb')
-rw-r--r--spec/models/ci/pipeline_spec.rb43
1 files changed, 33 insertions, 10 deletions
diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb
index 3512ba6aee5..77b7332a761 100644
--- a/spec/models/ci/pipeline_spec.rb
+++ b/spec/models/ci/pipeline_spec.rb
@@ -1856,9 +1856,7 @@ describe Ci::Pipeline, :mailer do
context 'when pipeline has builds with test reports' do
before do
- create(:ci_build, pipeline: pipeline, project: project).tap do |build|
- create(:ci_job_artifact, :junit, job: build, project: build.project)
- end
+ create(:ci_build, :test_reports, pipeline: pipeline, project: project)
end
context 'when pipeline status is running' do
@@ -1875,6 +1873,22 @@ describe Ci::Pipeline, :mailer do
end
context 'when pipeline does not have builds with test reports' do
+ before do
+ create(:ci_build, :artifacts, pipeline: pipeline, project: project)
+ end
+
+ let(:pipeline) { create(:ci_pipeline, :success, project: project) }
+
+ it { is_expected.to be_falsey }
+ end
+
+ context 'when retried build has test reports' do
+ before do
+ create(:ci_build, :retried, :test_reports, pipeline: pipeline, project: project)
+ end
+
+ let(:pipeline) { create(:ci_pipeline, :success, project: project) }
+
it { is_expected.to be_falsey }
end
end
@@ -1883,14 +1897,12 @@ describe Ci::Pipeline, :mailer do
subject { pipeline.test_reports }
context 'when pipeline has multiple builds with test reports' do
- before do
- create(:ci_build, :success, name: 'rspec', pipeline: pipeline, project: project).tap do |build|
- create(:ci_job_artifact, :junit, job: build, project: build.project)
- end
+ let!(:build_rspec) { create(:ci_build, :success, name: 'rspec', pipeline: pipeline, project: project) }
+ let!(:build_java) { create(:ci_build, :success, name: 'java', pipeline: pipeline, project: project) }
- create(:ci_build, :success, name: 'java', pipeline: pipeline, project: project).tap do |build|
- create(:ci_job_artifact, :junit_with_ant, job: build, project: build.project)
- end
+ before do
+ create(:ci_job_artifact, :junit, job: build_rspec, project: project)
+ create(:ci_job_artifact, :junit_with_ant, job: build_java, project: project)
end
it 'returns test reports with collected data' do
@@ -1898,6 +1910,17 @@ describe Ci::Pipeline, :mailer do
expect(subject.success_count).to be(5)
expect(subject.failed_count).to be(2)
end
+
+ context 'when builds are retried' do
+ let!(:build_rspec) { create(:ci_build, :retried, :success, name: 'rspec', pipeline: pipeline, project: project) }
+ let!(:build_java) { create(:ci_build, :retried, :success, name: 'java', pipeline: pipeline, project: project) }
+
+ it 'does not take retried builds into account' do
+ expect(subject.total_count).to be(0)
+ expect(subject.success_count).to be(0)
+ expect(subject.failed_count).to be(0)
+ end
+ end
end
context 'when pipeline does not have any builds with test reports' do