diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2018-12-11 18:42:59 +0300 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2018-12-11 18:42:59 +0300 |
commit | 18a48e348b83f66a1d108a2d6e38ac12c47dcef3 (patch) | |
tree | 219ac450c839c41331aaa87ecc140be463618439 /lib/gitlab/ci | |
parent | de21f2278151be40f3480ed6d06388b3dcfe841a (diff) | |
parent | e6226e8cb3d7e79500482ba2cef604133f667381 (diff) |
Merge branch '7788_parse_license_management_reports_in_be-ce' into 'master'
Generalise test compare service
See merge request gitlab-org/gitlab-ce!22833
Diffstat (limited to 'lib/gitlab/ci')
-rw-r--r-- | lib/gitlab/ci/parsers.rb | 21 | ||||
-rw-r--r-- | lib/gitlab/ci/parsers/parser_error.rb | 9 | ||||
-rw-r--r-- | lib/gitlab/ci/parsers/test.rb | 21 | ||||
-rw-r--r-- | lib/gitlab/ci/parsers/test/junit.rb | 2 |
4 files changed, 31 insertions, 22 deletions
diff --git a/lib/gitlab/ci/parsers.rb b/lib/gitlab/ci/parsers.rb new file mode 100644 index 00000000000..eb63e6c8363 --- /dev/null +++ b/lib/gitlab/ci/parsers.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Gitlab + module Ci + module Parsers + ParserNotFoundError = Class.new(ParserError) + + def self.parsers + { + junit: ::Gitlab::Ci::Parsers::Test::Junit + } + end + + def self.fabricate!(file_type) + parsers.fetch(file_type.to_sym).new + rescue KeyError + raise ParserNotFoundError, "Cannot find any parser matching file type '#{file_type}'" + end + end + end +end diff --git a/lib/gitlab/ci/parsers/parser_error.rb b/lib/gitlab/ci/parsers/parser_error.rb new file mode 100644 index 00000000000..ef327737cdb --- /dev/null +++ b/lib/gitlab/ci/parsers/parser_error.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +module Gitlab + module Ci + module Parsers + ParserError = Class.new(StandardError) + end + end +end diff --git a/lib/gitlab/ci/parsers/test.rb b/lib/gitlab/ci/parsers/test.rb deleted file mode 100644 index c6bc9662b07..00000000000 --- a/lib/gitlab/ci/parsers/test.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -module Gitlab - module Ci - module Parsers - module Test - ParserNotFoundError = Class.new(StandardError) - - PARSERS = { - junit: ::Gitlab::Ci::Parsers::Test::Junit - }.freeze - - def self.fabricate!(file_type) - PARSERS.fetch(file_type.to_sym).new - rescue KeyError - raise ParserNotFoundError, "Cannot find any parser matching file type '#{file_type}'" - end - end - end - end -end diff --git a/lib/gitlab/ci/parsers/test/junit.rb b/lib/gitlab/ci/parsers/test/junit.rb index 2791730fd26..dca60eabc1c 100644 --- a/lib/gitlab/ci/parsers/test/junit.rb +++ b/lib/gitlab/ci/parsers/test/junit.rb @@ -5,7 +5,7 @@ module Gitlab module Parsers module Test class Junit - JunitParserError = Class.new(StandardError) + JunitParserError = Class.new(Gitlab::Ci::Parsers::ParserError) def parse!(xml_data, test_suite) root = Hash.from_xml(xml_data) |