diff options
author | Shinya Maeda <shinya@gitlab.com> | 2018-07-19 15:31:42 +0900 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2018-07-19 15:31:42 +0900 |
commit | be2083ff9cceacd6bdd64a9521081278111400a7 (patch) | |
tree | cb0a728cc09b7dcfad1b3fbc0972be30e21a75a1 | |
parent | d47efe84ff6dda79edd00c9b055d752872af1e11 (diff) | |
download | gitlab-ce-be2083ff9cceacd6bdd64a9521081278111400a7.tar.gz |
Add java ant Junit test report in fixtures
-rw-r--r-- | db/fixtures/development/14_pipelines.rb | 38 | ||||
-rw-r--r-- | lib/gitlab/ci/parsers/junit_parser.rb | 2 | ||||
-rw-r--r-- | spec/fixtures/junit/junit_feature_ant.xml.gz | bin | 0 -> 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) | bin | 541 -> 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) | bin | 522 -> 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) | bin | 359 -> 359 bytes | |||
-rw-r--r-- | spec/fixtures/junit/junit_master_ant.xml.gz | bin | 0 -> 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) | bin | 592 -> 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) | bin | 367 -> 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) | bin | 360 -> 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 Binary files differnew file mode 100644 index 00000000000..33c8b0cc240 --- /dev/null +++ b/spec/fixtures/junit/junit_feature_ant.xml.gz diff --git a/spec/fixtures/junit/junit_feature_0_3.xml.gz b/spec/fixtures/junit/junit_feature_rspec_0_3.xml.gz Binary files differindex a41d4f3b9e2..a41d4f3b9e2 100644 --- a/spec/fixtures/junit/junit_feature_0_3.xml.gz +++ b/spec/fixtures/junit/junit_feature_rspec_0_3.xml.gz diff --git a/spec/fixtures/junit/junit_feature_1_3.xml.gz b/spec/fixtures/junit/junit_feature_rspec_1_3.xml.gz Binary files differindex 68091f62a05..68091f62a05 100644 --- a/spec/fixtures/junit/junit_feature_1_3.xml.gz +++ b/spec/fixtures/junit/junit_feature_rspec_1_3.xml.gz diff --git a/spec/fixtures/junit/junit_feature_2_3.xml.gz b/spec/fixtures/junit/junit_feature_rspec_2_3.xml.gz Binary files differindex ca740a35084..ca740a35084 100644 --- a/spec/fixtures/junit/junit_feature_2_3.xml.gz +++ b/spec/fixtures/junit/junit_feature_rspec_2_3.xml.gz diff --git a/spec/fixtures/junit/junit_master_ant.xml.gz b/spec/fixtures/junit/junit_master_ant.xml.gz Binary files differnew file mode 100644 index 00000000000..0741dc6526b --- /dev/null +++ b/spec/fixtures/junit/junit_master_ant.xml.gz diff --git a/spec/fixtures/junit/junit_master_0_3.xml.gz b/spec/fixtures/junit/junit_master_rspec_0_3.xml.gz Binary files differindex 187f2cba63b..187f2cba63b 100644 --- a/spec/fixtures/junit/junit_master_0_3.xml.gz +++ b/spec/fixtures/junit/junit_master_rspec_0_3.xml.gz diff --git a/spec/fixtures/junit/junit_master_1_3.xml.gz b/spec/fixtures/junit/junit_master_rspec_1_3.xml.gz Binary files differindex 405c695cea0..405c695cea0 100644 --- a/spec/fixtures/junit/junit_master_1_3.xml.gz +++ b/spec/fixtures/junit/junit_master_rspec_1_3.xml.gz diff --git a/spec/fixtures/junit/junit_master_2_3.xml.gz b/spec/fixtures/junit/junit_master_rspec_2_3.xml.gz Binary files differindex aca6bcb8e18..aca6bcb8e18 100644 --- a/spec/fixtures/junit/junit_master_2_3.xml.gz +++ b/spec/fixtures/junit/junit_master_rspec_2_3.xml.gz |