summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2018-07-19 15:31:42 +0900
committerShinya Maeda <shinya@gitlab.com>2018-07-19 15:31:42 +0900
commitbe2083ff9cceacd6bdd64a9521081278111400a7 (patch)
treecb0a728cc09b7dcfad1b3fbc0972be30e21a75a1
parentd47efe84ff6dda79edd00c9b055d752872af1e11 (diff)
downloadgitlab-ce-be2083ff9cceacd6bdd64a9521081278111400a7.tar.gz
Add java ant Junit test report in fixtures
-rw-r--r--db/fixtures/development/14_pipelines.rb38
-rw-r--r--lib/gitlab/ci/parsers/junit_parser.rb2
-rw-r--r--spec/fixtures/junit/junit_feature_ant.xml.gzbin0 -> 1823 bytes
-rw-r--r--spec/fixtures/junit/junit_feature_rspec_0_3.xml.gz (renamed from spec/fixtures/junit/junit_feature_0_3.xml.gz)bin541 -> 541 bytes
-rw-r--r--spec/fixtures/junit/junit_feature_rspec_1_3.xml.gz (renamed from spec/fixtures/junit/junit_feature_1_3.xml.gz)bin522 -> 522 bytes
-rw-r--r--spec/fixtures/junit/junit_feature_rspec_2_3.xml.gz (renamed from spec/fixtures/junit/junit_feature_2_3.xml.gz)bin359 -> 359 bytes
-rw-r--r--spec/fixtures/junit/junit_master_ant.xml.gzbin0 -> 1975 bytes
-rw-r--r--spec/fixtures/junit/junit_master_rspec_0_3.xml.gz (renamed from spec/fixtures/junit/junit_master_0_3.xml.gz)bin592 -> 592 bytes
-rw-r--r--spec/fixtures/junit/junit_master_rspec_1_3.xml.gz (renamed from spec/fixtures/junit/junit_master_1_3.xml.gz)bin367 -> 367 bytes
-rw-r--r--spec/fixtures/junit/junit_master_rspec_2_3.xml.gz (renamed from spec/fixtures/junit/junit_master_2_3.xml.gz)bin360 -> 360 bytes
10 files changed, 29 insertions, 11 deletions
diff --git a/db/fixtures/development/14_pipelines.rb b/db/fixtures/development/14_pipelines.rb
index d602b0309e8..e80a32903be 100644
--- a/db/fixtures/development/14_pipelines.rb
+++ b/db/fixtures/development/14_pipelines.rb
@@ -30,6 +30,8 @@ class Gitlab::Seeder::Pipelines
queued_at: 8.hour.ago, started_at: 8.hour.ago, finished_at: 7.hour.ago },
{ name: 'spinach:osx', stage: 'test', status: :failed, allow_failure: true,
queued_at: 8.hour.ago, started_at: 8.hour.ago, finished_at: 7.hour.ago },
+ { name: 'java ant', stage: 'test', status: :failed, allow_failure: true,
+ queued_at: 8.hour.ago, started_at: 8.hour.ago, finished_at: 7.hour.ago },
# deploy stage
{ name: 'staging', stage: 'deploy', environment: 'staging', status_event: :success,
@@ -129,14 +131,24 @@ class Gitlab::Seeder::Pipelines
def setup_test_reports(build)
if build.ref == build.project.default_branch
- artifacts_junit_master_path(build.name).try do |path|
- artifacts_cache_file(path) do |file|
+ if build.name.include?('rspec:linux')
+ artifacts_cache_file(artifacts_rspec_junit_master_path(build.name)) do |file|
+ build.job_artifacts.build(project: build.project, file_type: :junit, file_format: :gzip, file: file)
+ end
+ elsif build.name.include?('java ant')
+ artifacts_cache_file(artifacts_ant_junit_master_path) do |file|
build.job_artifacts.build(project: build.project, file_type: :junit, file_format: :gzip, file: file)
end
end
else
- artifacts_junit_feature_path(build.name).try do |path|
- artifacts_cache_file(path) do |file|
+ if build.name.include?('rspec:linux')
+ artifacts_rspec_junit_feature_path(build.name).try do |path|
+ artifacts_cache_file(path) do |file|
+ build.job_artifacts.build(project: build.project, file_type: :junit, file_format: :gzip, file: file)
+ end
+ end
+ elsif build.name.include?('java ant')
+ artifacts_cache_file(artifacts_ant_junit_feature_path) do |file|
build.job_artifacts.build(project: build.project, file_type: :junit, file_format: :gzip, file: file)
end
end
@@ -182,18 +194,22 @@ class Gitlab::Seeder::Pipelines
Rails.root + 'spec/fixtures/ci_build_artifacts_metadata.gz'
end
- def artifacts_junit_master_path(build_name)
+ def artifacts_rspec_junit_master_path(build_name)
index, total = build_name.scan(/ (\d) (\d)/).first
- return unless index && total
-
- Rails.root + "spec/fixtures/junit/junit_master_#{index}_#{total}.xml.gz"
+ Rails.root + "spec/fixtures/junit/junit_master_rspec_#{index}_#{total}.xml.gz"
end
- def artifacts_junit_feature_path(build_name)
+ def artifacts_rspec_junit_feature_path(build_name)
index, total = build_name.scan(/ (\d) (\d)/).first
- return unless index && total
+ Rails.root + "spec/fixtures/junit/junit_feature_rspec_#{index}_#{total}.xml.gz"
+ end
+
+ def artifacts_ant_junit_master_path
+ Rails.root + "spec/fixtures/junit/junit_master_ant.xml.gz"
+ end
- Rails.root + "spec/fixtures/junit/junit_feature_#{index}_#{total}.xml.gz"
+ def artifacts_ant_junit_feature_path
+ Rails.root + "spec/fixtures/junit/junit_feature_ant.xml.gz"
end
def artifacts_cache_file(file_path)
diff --git a/lib/gitlab/ci/parsers/junit_parser.rb b/lib/gitlab/ci/parsers/junit_parser.rb
index f554ff9a20f..0ead2121aab 100644
--- a/lib/gitlab/ci/parsers/junit_parser.rb
+++ b/lib/gitlab/ci/parsers/junit_parser.rb
@@ -15,6 +15,8 @@ module Gitlab
test_suite.add_result(test_case)
end
end
+ rescue
+ Rails.logger.error "Failed to parse Junit file" # Since xml_data is user-generated contents, parser could fail if they include corrupted-data
end
private
diff --git a/spec/fixtures/junit/junit_feature_ant.xml.gz b/spec/fixtures/junit/junit_feature_ant.xml.gz
new file mode 100644
index 00000000000..33c8b0cc240
--- /dev/null
+++ b/spec/fixtures/junit/junit_feature_ant.xml.gz
Binary files differ
diff --git a/spec/fixtures/junit/junit_feature_0_3.xml.gz b/spec/fixtures/junit/junit_feature_rspec_0_3.xml.gz
index a41d4f3b9e2..a41d4f3b9e2 100644
--- a/spec/fixtures/junit/junit_feature_0_3.xml.gz
+++ b/spec/fixtures/junit/junit_feature_rspec_0_3.xml.gz
Binary files differ
diff --git a/spec/fixtures/junit/junit_feature_1_3.xml.gz b/spec/fixtures/junit/junit_feature_rspec_1_3.xml.gz
index 68091f62a05..68091f62a05 100644
--- a/spec/fixtures/junit/junit_feature_1_3.xml.gz
+++ b/spec/fixtures/junit/junit_feature_rspec_1_3.xml.gz
Binary files differ
diff --git a/spec/fixtures/junit/junit_feature_2_3.xml.gz b/spec/fixtures/junit/junit_feature_rspec_2_3.xml.gz
index ca740a35084..ca740a35084 100644
--- a/spec/fixtures/junit/junit_feature_2_3.xml.gz
+++ b/spec/fixtures/junit/junit_feature_rspec_2_3.xml.gz
Binary files differ
diff --git a/spec/fixtures/junit/junit_master_ant.xml.gz b/spec/fixtures/junit/junit_master_ant.xml.gz
new file mode 100644
index 00000000000..0741dc6526b
--- /dev/null
+++ b/spec/fixtures/junit/junit_master_ant.xml.gz
Binary files differ
diff --git a/spec/fixtures/junit/junit_master_0_3.xml.gz b/spec/fixtures/junit/junit_master_rspec_0_3.xml.gz
index 187f2cba63b..187f2cba63b 100644
--- a/spec/fixtures/junit/junit_master_0_3.xml.gz
+++ b/spec/fixtures/junit/junit_master_rspec_0_3.xml.gz
Binary files differ
diff --git a/spec/fixtures/junit/junit_master_1_3.xml.gz b/spec/fixtures/junit/junit_master_rspec_1_3.xml.gz
index 405c695cea0..405c695cea0 100644
--- a/spec/fixtures/junit/junit_master_1_3.xml.gz
+++ b/spec/fixtures/junit/junit_master_rspec_1_3.xml.gz
Binary files differ
diff --git a/spec/fixtures/junit/junit_master_2_3.xml.gz b/spec/fixtures/junit/junit_master_rspec_2_3.xml.gz
index aca6bcb8e18..aca6bcb8e18 100644
--- a/spec/fixtures/junit/junit_master_2_3.xml.gz
+++ b/spec/fixtures/junit/junit_master_rspec_2_3.xml.gz
Binary files differ