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:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-10-23 21:08:31 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-10-23 21:08:31 +0300
commit7e1e5ca371cbfe77bdf56fcf65a4e749e6e86a06 (patch)
treec40953fc74404b5d86bb2ef72bab89526c5ca7d6 /spec/factories/ci
parent9086e66ee72527839053ec6db19ed321a3b3a61b (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/factories/ci')
-rw-r--r--spec/factories/ci/builds.rb6
-rw-r--r--spec/factories/ci/job_artifacts.rb10
-rw-r--r--spec/factories/ci/reports/test_case.rb41
-rw-r--r--spec/factories/ci/test_case.rb39
-rw-r--r--spec/factories/ci/test_case_failure.rb9
5 files changed, 69 insertions, 36 deletions
diff --git a/spec/factories/ci/builds.rb b/spec/factories/ci/builds.rb
index 73920b76025..07bfde25fd9 100644
--- a/spec/factories/ci/builds.rb
+++ b/spec/factories/ci/builds.rb
@@ -332,6 +332,12 @@ FactoryBot.define do
end
end
+ trait :test_reports_with_duplicate_failed_test_names do
+ after(:build) do |build|
+ build.job_artifacts << create(:ci_job_artifact, :junit_with_duplicate_failed_test_names, job: build)
+ end
+ end
+
trait :accessibility_reports do
after(:build) do |build|
build.job_artifacts << create(:ci_job_artifact, :accessibility, job: build)
diff --git a/spec/factories/ci/job_artifacts.rb b/spec/factories/ci/job_artifacts.rb
index 1bd4b2826c4..de505ef8203 100644
--- a/spec/factories/ci/job_artifacts.rb
+++ b/spec/factories/ci/job_artifacts.rb
@@ -109,6 +109,16 @@ FactoryBot.define do
end
end
+ trait :junit_with_duplicate_failed_test_names do
+ file_type { :junit }
+ file_format { :gzip }
+
+ after(:build) do |artifact, evaluator|
+ artifact.file = fixture_file_upload(
+ Rails.root.join('spec/fixtures/junit/junit_with_duplicate_failed_test_names.xml.gz'), 'application/x-gzip')
+ end
+ end
+
trait :junit_with_ant do
file_type { :junit }
file_format { :gzip }
diff --git a/spec/factories/ci/reports/test_case.rb b/spec/factories/ci/reports/test_case.rb
new file mode 100644
index 00000000000..0626de9d6dc
--- /dev/null
+++ b/spec/factories/ci/reports/test_case.rb
@@ -0,0 +1,41 @@
+# frozen_string_literal: true
+
+FactoryBot.define do
+ factory :report_test_case, class: 'Gitlab::Ci::Reports::TestCase' do
+ suite_name { "rspec" }
+ name { "test-1" }
+ classname { "trace" }
+ file { "spec/trace_spec.rb" }
+ execution_time { 1.23 }
+ status { Gitlab::Ci::Reports::TestCase::STATUS_SUCCESS }
+ system_output { nil }
+ attachment { nil }
+ association :job, factory: :ci_build
+
+ trait :failed do
+ status { Gitlab::Ci::Reports::TestCase::STATUS_FAILED }
+ system_output { "Failure/Error: is_expected.to eq(300) expected: 300 got: -100" }
+ end
+
+ trait :failed_with_attachment do
+ status { Gitlab::Ci::Reports::TestCase::STATUS_FAILED }
+ attachment { "some/path.png" }
+ end
+
+ skip_create
+
+ initialize_with do
+ new(
+ suite_name: suite_name,
+ name: name,
+ classname: classname,
+ file: file,
+ execution_time: execution_time,
+ status: status,
+ system_output: system_output,
+ attachment: attachment,
+ job: job
+ )
+ end
+ end
+end
diff --git a/spec/factories/ci/test_case.rb b/spec/factories/ci/test_case.rb
index 7f99f0e123e..601a3fae970 100644
--- a/spec/factories/ci/test_case.rb
+++ b/spec/factories/ci/test_case.rb
@@ -1,41 +1,8 @@
# frozen_string_literal: true
FactoryBot.define do
- factory :test_case, class: 'Gitlab::Ci::Reports::TestCase' do
- suite_name { "rspec" }
- name { "test-1" }
- classname { "trace" }
- file { "spec/trace_spec.rb" }
- execution_time { 1.23 }
- status { Gitlab::Ci::Reports::TestCase::STATUS_SUCCESS }
- system_output { nil }
- attachment { nil }
- association :job, factory: :ci_build
-
- trait :failed do
- status { Gitlab::Ci::Reports::TestCase::STATUS_FAILED }
- system_output { "Failure/Error: is_expected.to eq(300) expected: 300 got: -100" }
- end
-
- trait :failed_with_attachment do
- status { Gitlab::Ci::Reports::TestCase::STATUS_FAILED }
- attachment { "some/path.png" }
- end
-
- skip_create
-
- initialize_with do
- new(
- suite_name: suite_name,
- name: name,
- classname: classname,
- file: file,
- execution_time: execution_time,
- status: status,
- system_output: system_output,
- attachment: attachment,
- job: job
- )
- end
+ factory :ci_test_case, class: 'Ci::TestCase' do
+ project
+ key_hash { Digest::SHA256.hexdigest(SecureRandom.hex) }
end
end
diff --git a/spec/factories/ci/test_case_failure.rb b/spec/factories/ci/test_case_failure.rb
new file mode 100644
index 00000000000..11fb002804b
--- /dev/null
+++ b/spec/factories/ci/test_case_failure.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+FactoryBot.define do
+ factory :ci_test_case_failure, class: 'Ci::TestCaseFailure' do
+ build factory: :ci_build
+ test_case factory: :ci_test_case
+ failed_at { Time.current }
+ end
+end