gitlab_quality-test_tooling 0.1.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +9 -4
- data/Gemfile.lock +1 -1
- data/Guardfile +0 -22
- data/README.md +150 -9
- data/exe/generate-test-session +50 -0
- data/exe/post-to-slack +58 -0
- data/exe/prepare-stage-reports +38 -0
- data/exe/relate-failure-issue +59 -0
- data/exe/report-results +56 -0
- data/exe/update-screenshot-paths +38 -0
- data/lib/gitlab_quality/test_tooling/gitlab_issue_client.rb +194 -0
- data/lib/gitlab_quality/test_tooling/gitlab_issue_dry_client.rb +26 -0
- data/lib/gitlab_quality/test_tooling/report/concerns/find_set_dri.rb +51 -0
- data/lib/gitlab_quality/test_tooling/report/concerns/results_reporter.rb +75 -0
- data/lib/gitlab_quality/test_tooling/report/concerns/utils.rb +49 -0
- data/lib/gitlab_quality/test_tooling/report/generate_test_session.rb +275 -0
- data/lib/gitlab_quality/test_tooling/report/prepare_stage_reports.rb +78 -0
- data/lib/gitlab_quality/test_tooling/report/relate_failure_issue.rb +377 -0
- data/lib/gitlab_quality/test_tooling/report/report_as_issue.rb +134 -0
- data/lib/gitlab_quality/test_tooling/report/report_results.rb +83 -0
- data/lib/gitlab_quality/test_tooling/report/results_in_issues.rb +130 -0
- data/lib/gitlab_quality/test_tooling/report/results_in_testcases.rb +113 -0
- data/lib/gitlab_quality/test_tooling/report/update_screenshot_path.rb +81 -0
- data/lib/gitlab_quality/test_tooling/runtime/env.rb +113 -0
- data/lib/gitlab_quality/test_tooling/runtime/logger.rb +92 -0
- data/lib/gitlab_quality/test_tooling/runtime/token_finder.rb +44 -0
- data/lib/gitlab_quality/test_tooling/slack/post_to_slack.rb +36 -0
- data/lib/gitlab_quality/test_tooling/summary_table.rb +41 -0
- data/lib/gitlab_quality/test_tooling/support/http_request.rb +34 -0
- data/lib/gitlab_quality/test_tooling/system_logs/finders/json_log_finder.rb +65 -0
- data/lib/gitlab_quality/test_tooling/system_logs/finders/rails/api_log_finder.rb +21 -0
- data/lib/gitlab_quality/test_tooling/system_logs/finders/rails/application_log_finder.rb +21 -0
- data/lib/gitlab_quality/test_tooling/system_logs/finders/rails/exception_log_finder.rb +21 -0
- data/lib/gitlab_quality/test_tooling/system_logs/finders/rails/graphql_log_finder.rb +21 -0
- data/lib/gitlab_quality/test_tooling/system_logs/log_types/log.rb +38 -0
- data/lib/gitlab_quality/test_tooling/system_logs/log_types/rails/api_log.rb +34 -0
- data/lib/gitlab_quality/test_tooling/system_logs/log_types/rails/application_log.rb +27 -0
- data/lib/gitlab_quality/test_tooling/system_logs/log_types/rails/exception_log.rb +23 -0
- data/lib/gitlab_quality/test_tooling/system_logs/log_types/rails/graphql_log.rb +30 -0
- data/lib/gitlab_quality/test_tooling/system_logs/shared_fields.rb +29 -0
- data/lib/gitlab_quality/test_tooling/system_logs/system_logs_formatter.rb +65 -0
- data/lib/gitlab_quality/test_tooling/test_results/base_test_results.rb +39 -0
- data/lib/gitlab_quality/test_tooling/test_results/builder.rb +35 -0
- data/lib/gitlab_quality/test_tooling/test_results/j_unit_test_results.rb +27 -0
- data/lib/gitlab_quality/test_tooling/test_results/json_test_results.rb +29 -0
- data/lib/gitlab_quality/test_tooling/test_results/test_result.rb +184 -0
- data/lib/gitlab_quality/test_tooling/version.rb +1 -1
- data/lib/gitlab_quality/test_tooling.rb +11 -2
- metadata +51 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db0c200678a2bb9d3eea994129fd3db411c9af0647225f451d548b02005e69e0
|
4
|
+
data.tar.gz: 356fcd2142b1f62507e9b4ff76903d21dfbee980a8a41662a2cd02255bc2831f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2fceda952ea6665034e2c0fd4f55fbbadb3226b953613a9bc3cb3b2c3b0332b59f2043a1277a73749c8fc449bb0ea5a919b1cf278bf6a4ad92978ffa6e748fe5
|
7
|
+
data.tar.gz: cdca3c8f902068f205379836272146a61e361ca4dcd13d86b7f22372fb0a7549ed798c40e0419400ba7a2cffff3cacb726339557ac108c1b55e0edc71b72e308
|
data/.rubocop.yml
CHANGED
@@ -19,6 +19,12 @@ AllCops:
|
|
19
19
|
MaxFilesInCache: 1_000_000
|
20
20
|
NewCops: enable
|
21
21
|
|
22
|
+
CodeReuse/ActiveRecord:
|
23
|
+
Enabled: false
|
24
|
+
|
25
|
+
Gemspec/RequiredRubyVersion:
|
26
|
+
Enabled: false
|
27
|
+
|
22
28
|
Gemspec/RequireMFA:
|
23
29
|
Enabled: false
|
24
30
|
|
@@ -49,12 +55,11 @@ Style/ModuleFunction:
|
|
49
55
|
Style/SignalException:
|
50
56
|
Enabled: false
|
51
57
|
|
58
|
+
Layout/LineLength:
|
59
|
+
Max: 180
|
60
|
+
|
52
61
|
Layout/SpaceBeforeFirstArg:
|
53
62
|
Enabled: false
|
54
63
|
|
55
64
|
RSpec/MultipleMemoizedHelpers:
|
56
65
|
Enabled: false
|
57
|
-
|
58
|
-
CodeReuse/ActiveRecord:
|
59
|
-
Exclude:
|
60
|
-
- 'spec/**/*_spec.rb'
|
data/Gemfile.lock
CHANGED
data/Guardfile
CHANGED
@@ -42,28 +42,6 @@ guard :rspec, cmd: "bundle exec rspec" do
|
|
42
42
|
ruby = dsl.ruby
|
43
43
|
dsl.watch_spec_files_for(ruby.lib_files)
|
44
44
|
|
45
|
-
# Rails files
|
46
|
-
rails = dsl.rails(view_extensions: %w[erb haml slim])
|
47
|
-
dsl.watch_spec_files_for(rails.app_files)
|
48
|
-
dsl.watch_spec_files_for(rails.views)
|
49
|
-
|
50
|
-
watch(rails.controllers) do |m|
|
51
|
-
[
|
52
|
-
rspec.spec.call("routing/#{m[1]}_routing"),
|
53
|
-
rspec.spec.call("controllers/#{m[1]}_controller"),
|
54
|
-
rspec.spec.call("acceptance/#{m[1]}")
|
55
|
-
]
|
56
|
-
end
|
57
|
-
|
58
|
-
# Rails config changes
|
59
|
-
watch(rails.spec_helper) { rspec.spec_dir }
|
60
|
-
watch(rails.routes) { "#{rspec.spec_dir}/routing" }
|
61
|
-
watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
|
62
|
-
|
63
|
-
# Capybara features specs
|
64
|
-
watch(rails.view_dirs) { |m| rspec.spec.call("features/#{m[1]}") }
|
65
|
-
watch(rails.layouts) { |m| rspec.spec.call("features/#{m[1]}") }
|
66
|
-
|
67
45
|
# Turnip features and steps
|
68
46
|
watch(%r{^spec/acceptance/(.+)\.feature$})
|
69
47
|
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
|
data/README.md
CHANGED
@@ -1,28 +1,169 @@
|
|
1
1
|
# `GitlabQuality::TestTooling`
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/gitlab_quality/test_tooling`. To experiment with that code, run `bin/console` for an interactive prompt.
|
3
|
+
This gem provides test tooling that can be used by different projects or different part of the same project, mostly in CI scripts.
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
9
|
-
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'gitlab_quality-test_tooling', require: false
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
10
14
|
|
11
|
-
|
15
|
+
```sh
|
16
|
+
$ bundle install
|
17
|
+
```
|
12
18
|
|
13
|
-
|
19
|
+
Or install it yourself as:
|
14
20
|
|
15
|
-
|
21
|
+
```sh
|
22
|
+
$ gem install gitlab_quality-test_tooling
|
23
|
+
```
|
16
24
|
|
17
25
|
## Usage
|
18
26
|
|
19
|
-
|
27
|
+
The gem provides the following executables.
|
28
|
+
|
29
|
+
### `generate-test-session`
|
30
|
+
|
31
|
+
```shell
|
32
|
+
Purpose: Generate test session report based on RSpec report files (JSON or JUnit XML)
|
33
|
+
Usage: exe/generate-test-session [options]
|
34
|
+
-i, --input-files FILES RSpec report files (JSON or JUnit XML)
|
35
|
+
-p, --project PROJECT Can be an integer or a group/project string
|
36
|
+
-t, --token ACCESS_TOKEN A valid access token with Reporter permission in PROJECT
|
37
|
+
--dry-run Perform a dry-run (don't create or update issues or test cases)
|
38
|
+
-v, --version Show the version
|
39
|
+
-h, --help Show the usage
|
40
|
+
```
|
41
|
+
|
42
|
+
### `post-to-slack`
|
43
|
+
|
44
|
+
```shell
|
45
|
+
$ exe/post-to-slack -h
|
46
|
+
Purpose: Post a message to Slack, and optionally add a test summary table based on RSpec report files (JUnit XML)
|
47
|
+
Usage: exe/post-to-slack [options]
|
48
|
+
-w SLACK_WEBHOOK_URL, Slack webhook URL
|
49
|
+
--slack-webhook-url
|
50
|
+
-c, --channel CHANNEL Slack channel to post the message to
|
51
|
+
-m, --message MESSAGE Post message to Slack
|
52
|
+
-t FILES, Add a test summary table based on RSpec report files (JUnit XML)
|
53
|
+
--include-summary-table
|
54
|
+
-u, --username USERNAME Username to use for the Slack message
|
55
|
+
-i, --icon-emoji ICON_EMOJI Icon emoji to use for the Slack message
|
56
|
+
-v, --version Show the version
|
57
|
+
-h, --help Show the usage
|
58
|
+
```
|
59
|
+
|
60
|
+
### `prepare-stage-reports`
|
61
|
+
|
62
|
+
```shell
|
63
|
+
$ exe/prepare-stage-reports -h
|
64
|
+
Purpose: Prepare separate reports for each DevOps stage from the provided RSpec report files (JUnit XML)
|
65
|
+
Usage: exe/prepare-stage-reports [options]
|
66
|
+
-j, --junit-files FILES RSpec report files (JUnit XML)
|
67
|
+
-v, --version Show the version
|
68
|
+
-h, --help Show the usage
|
69
|
+
```
|
70
|
+
|
71
|
+
### `relate-failure-issue`
|
72
|
+
|
73
|
+
```shell
|
74
|
+
$ exe/relate-failure-issue -h
|
75
|
+
Purpose: Relate test failures to failure issues from RSpec report files (JSON or JUnit XML)
|
76
|
+
Usage: exe/relate-failure-issue [options]
|
77
|
+
-i, --input-files FILES RSpec report files (JSON or JUnit XML)
|
78
|
+
--max-diff-ratio DIFF_RATO Max stacktrace diff ratio for QA failure issues detection
|
79
|
+
-p, --project PROJECT Can be an integer or a group/project string
|
80
|
+
-t, --token ACCESS_TOKEN A valid access token with Reporter permission in PROJECT
|
81
|
+
--system-log-files SYSTEM_LOG_FILES
|
82
|
+
Include errors from system logs in failure issues
|
83
|
+
--dry-run Perform a dry-run (don't create or update issues)
|
84
|
+
-v, --version Show the version
|
85
|
+
-h, --help Show the usage
|
86
|
+
```
|
87
|
+
|
88
|
+
### `report-results`
|
89
|
+
|
90
|
+
```shell
|
91
|
+
$ exe/report-results -h
|
92
|
+
Purpose: Report test results from RSpec report files (JSON or JUnit XML) in GitLab test cases and result issues
|
93
|
+
Usage: exe/report-results [options]
|
94
|
+
-i, --input-files FILES RSpec report files (JSON or JUnit XML)
|
95
|
+
--test-case-project TEST_CASE_PROJECT
|
96
|
+
Can be an integer or a group/project string
|
97
|
+
--results-issue-project RESULTS_ISSUE_PROJECT
|
98
|
+
Can be an integer or a group/project string
|
99
|
+
-t, --token ACCESS_TOKEN A valid access token
|
100
|
+
--dry-run Perform a dry-run (don't create or update issues or test cases)
|
101
|
+
-v, --version Show the version
|
102
|
+
-h, --help Show the usage
|
103
|
+
```
|
104
|
+
|
105
|
+
### `update-screenshot-paths`
|
106
|
+
|
107
|
+
```shell
|
108
|
+
$ exe/update-screenshot-paths -h
|
109
|
+
Purpose: Update the path to screenshots to container's host from RSpec report files (JSON or JUnit XML)
|
110
|
+
Usage: exe/update-screenshot-paths [options]
|
111
|
+
-i, --input-files FILES RSpec report files (JSON or JUnit XML)
|
112
|
+
-v, --version Show the version
|
113
|
+
-h, --help Show the usage
|
114
|
+
```
|
20
115
|
|
21
116
|
## Development
|
22
117
|
|
118
|
+
### Initial setup
|
119
|
+
|
23
120
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
24
121
|
|
25
|
-
To install this gem onto your local machine, run `bundle exec rake install`.
|
122
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
123
|
+
|
124
|
+
### Activate lefthook locally
|
125
|
+
|
126
|
+
```shell
|
127
|
+
lefthook install
|
128
|
+
```
|
129
|
+
|
130
|
+
### Testing unreleased changes in merge requests
|
131
|
+
|
132
|
+
To test an unreleased change in an actual merge request, you can create a merge request that will install the unreleased version of `gitlab_quality-test_tooling`. Bundler can install gems by specifying a repository and a revision from Git.
|
133
|
+
|
134
|
+
For example, to test `gitlab_quality-test_tooling` changes from the `your-branch-name` branch in [`gitlab-org/gitlab`](https://gitlab.com/gitlab-org/gitlab), in the `Gemfile`:
|
135
|
+
|
136
|
+
```ruby
|
137
|
+
group :development, :test, :danger do
|
138
|
+
gem 'gitlab_quality-test_tooling', '~> 3.4.3', require: false,
|
139
|
+
git: 'https://gitlab.com/gitlab-org/ruby/gems/gitlab_quality-test_tooling.git',
|
140
|
+
ref: 'your-branch-name'
|
141
|
+
end
|
142
|
+
```
|
143
|
+
|
144
|
+
See an [example](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/92580) for more details.
|
145
|
+
|
146
|
+
## Release
|
147
|
+
|
148
|
+
[Automated gem release process](https://gitlab.com/gitlab-org/quality/pipeline-common#release-process) is used to release new version of `gitlab_quality-test_tooling` through pipelines, and this will:
|
149
|
+
|
150
|
+
- Publish the gem: https://rubygems.org/gems/gitlab_quality-test_tooling
|
151
|
+
- Add a release in the `gitlab_quality-test_tooling` project: https://gitlab.com/gitlab-org/ruby/gems/gitlab_quality-test_tooling/-/releases
|
152
|
+
- Populate the release log with the API contents. For example: https://gitlab.com/api/v4/projects/19861191/repository/changelog?version=3.4.4
|
153
|
+
|
154
|
+
### Before release
|
155
|
+
|
156
|
+
Make sure to include a changelog entry in your commit message and read the [changelog entries section](https://docs.gitlab.com/ee/development/changelog.html).
|
157
|
+
|
158
|
+
If you forget to set the changelog entry in your commit messages, you can also edit the release notes after it's being released.
|
159
|
+
|
160
|
+
### Steps to release
|
161
|
+
|
162
|
+
Use a `Release` merge request template and create a merge requet to update the version number in `version.rb`, and get the merge request merged by a maintainer.
|
163
|
+
|
164
|
+
This will then be packaged into a gem and pushed to [rubygems.org](https://rubygems.org) by the CI/CD.
|
165
|
+
|
166
|
+
For example: [Bump version to 3.4.3](https://gitlab.com/gitlab-org/ruby/gems/gitlab-dangerfiles/-/merge_requests/149).
|
26
167
|
|
27
168
|
## License
|
28
169
|
|
@@ -0,0 +1,50 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "bundler/setup"
|
5
|
+
require "optparse"
|
6
|
+
|
7
|
+
require_relative "../lib/gitlab_quality/test_tooling"
|
8
|
+
|
9
|
+
params = {}
|
10
|
+
|
11
|
+
options = OptionParser.new do |opts|
|
12
|
+
opts.banner = "Usage: #{$PROGRAM_NAME} [options]"
|
13
|
+
|
14
|
+
opts.on('-i', '--input-files FILES', String, 'RSpec report files (JSON or JUnit XML)') do |input_files|
|
15
|
+
params[:input_files] = input_files
|
16
|
+
end
|
17
|
+
|
18
|
+
opts.on('-p', '--project PROJECT', String, 'Can be an integer or a group/project string') do |project|
|
19
|
+
params[:project] = project
|
20
|
+
end
|
21
|
+
|
22
|
+
opts.on('-t', '--token ACCESS_TOKEN', String, 'A valid access token with Reporter permission in PROJECT') do |token|
|
23
|
+
params[:token] = GitlabQuality::TestTooling::Runtime::TokenFinder.find_token!(token)
|
24
|
+
end
|
25
|
+
|
26
|
+
opts.on('--dry-run', "Perform a dry-run (don't create or update issues or test cases)") do
|
27
|
+
params[:dry_run] = true
|
28
|
+
end
|
29
|
+
|
30
|
+
opts.on_tail('-v', '--version', 'Show the version') do
|
31
|
+
require_relative "../lib/gitlab_quality/test_tooling/version"
|
32
|
+
puts "#{$PROGRAM_NAME} : #{GitlabQuality::TestTooling::VERSION}"
|
33
|
+
exit
|
34
|
+
end
|
35
|
+
|
36
|
+
opts.on_tail('-h', '--help', 'Show the usage') do
|
37
|
+
puts "Purpose: Generate test session report based on RSpec report files (JSON or JUnit XML)"
|
38
|
+
puts opts
|
39
|
+
exit
|
40
|
+
end
|
41
|
+
|
42
|
+
opts.parse(ARGV)
|
43
|
+
end
|
44
|
+
|
45
|
+
if params.any?
|
46
|
+
GitlabQuality::TestTooling::Report::GenerateTestSession.new(**params).invoke!
|
47
|
+
else
|
48
|
+
puts options
|
49
|
+
exit 1
|
50
|
+
end
|
data/exe/post-to-slack
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "bundler/setup"
|
5
|
+
require "optparse"
|
6
|
+
|
7
|
+
require_relative "../lib/gitlab_quality/test_tooling"
|
8
|
+
|
9
|
+
params = {}
|
10
|
+
|
11
|
+
options = OptionParser.new do |opts|
|
12
|
+
opts.banner = "Usage: #{$PROGRAM_NAME} [options]"
|
13
|
+
|
14
|
+
opts.on('-w', '--slack-webhook-url SLACK_WEBHOOK_URL', String, 'Slack webhook URL') do |slack_webhook_url|
|
15
|
+
params[:slack_webhook_url] = slack_webhook_url
|
16
|
+
end
|
17
|
+
|
18
|
+
opts.on('-c', '--channel CHANNEL', String, 'Slack channel to post the message to') do |channel|
|
19
|
+
params[:channel] = channel
|
20
|
+
end
|
21
|
+
|
22
|
+
opts.on('-m', '--message MESSAGE', String, 'Post message to Slack') do |message|
|
23
|
+
params[:message] = message
|
24
|
+
end
|
25
|
+
|
26
|
+
opts.on('-t', '--include-summary-table FILES', String, 'Add a test summary table based on RSpec report files (JUnit XML)') do |files|
|
27
|
+
params[:message] += "\n\n#{GitlabQuality::TestTooling::SummaryTable.create(input_files: files)}"
|
28
|
+
end
|
29
|
+
|
30
|
+
opts.on('-u', '--username USERNAME', String, 'Username to use for the Slack message') do |username|
|
31
|
+
params[:username] = username
|
32
|
+
end
|
33
|
+
|
34
|
+
opts.on('-i', '--icon-emoji ICON_EMOJI', String, 'Icon emoji to use for the Slack message') do |icon_emoji|
|
35
|
+
params[:icon_emoji] = icon_emoji
|
36
|
+
end
|
37
|
+
|
38
|
+
opts.on_tail('-v', '--version', 'Show the version') do
|
39
|
+
require_relative "../lib/gitlab_quality/test_tooling/version"
|
40
|
+
puts "#{$PROGRAM_NAME} : #{GitlabQuality::TestTooling::VERSION}"
|
41
|
+
exit
|
42
|
+
end
|
43
|
+
|
44
|
+
opts.on_tail('-h', '--help', 'Show the usage') do
|
45
|
+
puts "Purpose: Post a message to Slack, and optionally add a test summary table based on RSpec report files (JUnit XML)"
|
46
|
+
puts opts
|
47
|
+
exit
|
48
|
+
end
|
49
|
+
|
50
|
+
opts.parse(ARGV)
|
51
|
+
end
|
52
|
+
|
53
|
+
if params.any?
|
54
|
+
GitlabQuality::TestTooling::Slack::PostToSlack.new(**params).invoke!
|
55
|
+
else
|
56
|
+
puts options
|
57
|
+
exit 1
|
58
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "bundler/setup"
|
5
|
+
require "optparse"
|
6
|
+
|
7
|
+
require_relative "../lib/gitlab_quality/test_tooling"
|
8
|
+
|
9
|
+
params = {}
|
10
|
+
|
11
|
+
options = OptionParser.new do |opts|
|
12
|
+
opts.banner = "Usage: #{$PROGRAM_NAME} [options]"
|
13
|
+
|
14
|
+
opts.on('-j', '--junit-files FILES', String, 'RSpec report files (JUnit XML)') do |junit_files|
|
15
|
+
params[:junit_files] = junit_files
|
16
|
+
end
|
17
|
+
|
18
|
+
opts.on_tail('-v', '--version', 'Show the version') do
|
19
|
+
require_relative "../lib/gitlab_quality/test_tooling/version"
|
20
|
+
puts "#{$PROGRAM_NAME} : #{GitlabQuality::TestTooling::VERSION}"
|
21
|
+
exit
|
22
|
+
end
|
23
|
+
|
24
|
+
opts.on_tail('-h', '--help', 'Show the usage') do
|
25
|
+
puts "Purpose: Prepare separate reports for each DevOps stage from the provided RSpec report files (JUnit XML)"
|
26
|
+
puts opts
|
27
|
+
exit
|
28
|
+
end
|
29
|
+
|
30
|
+
opts.parse(ARGV)
|
31
|
+
end
|
32
|
+
|
33
|
+
if params.any?
|
34
|
+
GitlabQuality::TestTooling::Report::PrepareStageReports.new(**params).invoke!
|
35
|
+
else
|
36
|
+
puts options
|
37
|
+
exit 1
|
38
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "bundler/setup"
|
5
|
+
require "optparse"
|
6
|
+
|
7
|
+
require_relative "../lib/gitlab_quality/test_tooling"
|
8
|
+
|
9
|
+
params = {}
|
10
|
+
|
11
|
+
options = OptionParser.new do |opts|
|
12
|
+
opts.banner = "Usage: #{$PROGRAM_NAME} [options]"
|
13
|
+
|
14
|
+
opts.on('-i', '--input-files FILES', String, 'RSpec report files (JSON or JUnit XML)') do |input_files|
|
15
|
+
params[:input_files] = input_files
|
16
|
+
end
|
17
|
+
|
18
|
+
opts.on('--max-diff-ratio DIFF_RATO', Float, 'Max stacktrace diff ratio for QA failure issues detection') do |value|
|
19
|
+
params[:max_diff_ratio] = value
|
20
|
+
end
|
21
|
+
|
22
|
+
opts.on('-p', '--project PROJECT', String, 'Can be an integer or a group/project string') do |project|
|
23
|
+
params[:project] = project
|
24
|
+
end
|
25
|
+
|
26
|
+
opts.on('-t', '--token ACCESS_TOKEN', String, 'A valid access token with Reporter permission in PROJECT') do |token|
|
27
|
+
params[:token] = GitlabQuality::TestTooling::Runtime::TokenFinder.find_token!(token)
|
28
|
+
end
|
29
|
+
|
30
|
+
opts.on('--system-log-files SYSTEM_LOG_FILES', String,
|
31
|
+
'Include errors from system logs in failure issues') do |system_log_files|
|
32
|
+
params[:system_logs] = system_log_files
|
33
|
+
end
|
34
|
+
|
35
|
+
opts.on('--dry-run', "Perform a dry-run (don't create or update issues)") do
|
36
|
+
params[:dry_run] = true
|
37
|
+
end
|
38
|
+
|
39
|
+
opts.on_tail('-v', '--version', 'Show the version') do
|
40
|
+
require_relative "../lib/gitlab_quality/test_tooling/version"
|
41
|
+
puts "#{$PROGRAM_NAME} : #{GitlabQuality::TestTooling::VERSION}"
|
42
|
+
exit
|
43
|
+
end
|
44
|
+
|
45
|
+
opts.on_tail('-h', '--help', 'Show the usage') do
|
46
|
+
puts "Purpose: Relate test failures to failure issues from RSpec report files (JSON or JUnit XML)"
|
47
|
+
puts opts
|
48
|
+
exit
|
49
|
+
end
|
50
|
+
|
51
|
+
opts.parse(ARGV)
|
52
|
+
end
|
53
|
+
|
54
|
+
if params.any?
|
55
|
+
GitlabQuality::TestTooling::Report::RelateFailureIssue.new(**params).invoke!
|
56
|
+
else
|
57
|
+
puts options
|
58
|
+
exit 1
|
59
|
+
end
|
data/exe/report-results
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "bundler/setup"
|
5
|
+
require "optparse"
|
6
|
+
|
7
|
+
require_relative "../lib/gitlab_quality/test_tooling"
|
8
|
+
|
9
|
+
params = {}
|
10
|
+
|
11
|
+
options = OptionParser.new do |opts|
|
12
|
+
opts.banner = "Usage: #{$PROGRAM_NAME} [options]"
|
13
|
+
|
14
|
+
opts.on('-i', '--input-files FILES', String, 'RSpec report files (JSON or JUnit XML)') do |input_files|
|
15
|
+
params[:input_files] = input_files
|
16
|
+
end
|
17
|
+
|
18
|
+
opts.on('--test-case-project TEST_CASE_PROJECT', String,
|
19
|
+
'Can be an integer or a group/project string') do |test_case_project|
|
20
|
+
params[:test_case_project] = test_case_project
|
21
|
+
end
|
22
|
+
|
23
|
+
opts.on('--results-issue-project RESULTS_ISSUE_PROJECT', String,
|
24
|
+
'Can be an integer or a group/project string') do |results_issue_project|
|
25
|
+
params[:results_issue_project] = results_issue_project
|
26
|
+
end
|
27
|
+
|
28
|
+
opts.on('-t', '--token ACCESS_TOKEN', String, 'A valid access token') do |token|
|
29
|
+
params[:token] = GitlabQuality::TestTooling::Runtime::TokenFinder.find_token!(token)
|
30
|
+
end
|
31
|
+
|
32
|
+
opts.on('--dry-run', "Perform a dry-run (don't create or update issues or test cases)") do
|
33
|
+
params[:dry_run] = true
|
34
|
+
end
|
35
|
+
|
36
|
+
opts.on_tail('-v', '--version', 'Show the version') do
|
37
|
+
require_relative "../lib/gitlab_quality/test_tooling/version"
|
38
|
+
puts "#{$PROGRAM_NAME} : #{GitlabQuality::TestTooling::VERSION}"
|
39
|
+
exit
|
40
|
+
end
|
41
|
+
|
42
|
+
opts.on_tail('-h', '--help', 'Show the usage') do
|
43
|
+
puts "Purpose: Report test results from RSpec report files (JSON or JUnit XML) in GitLab test cases and result issues"
|
44
|
+
puts opts
|
45
|
+
exit
|
46
|
+
end
|
47
|
+
|
48
|
+
opts.parse(ARGV)
|
49
|
+
end
|
50
|
+
|
51
|
+
if params.any?
|
52
|
+
GitlabQuality::TestTooling::Report::ReportResults.new(**params).invoke!
|
53
|
+
else
|
54
|
+
puts options
|
55
|
+
exit 1
|
56
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "bundler/setup"
|
5
|
+
require "optparse"
|
6
|
+
|
7
|
+
require_relative "../lib/gitlab_quality/test_tooling"
|
8
|
+
|
9
|
+
params = {}
|
10
|
+
|
11
|
+
options = OptionParser.new do |opts|
|
12
|
+
opts.banner = "Usage: #{$PROGRAM_NAME} [options]"
|
13
|
+
|
14
|
+
opts.on('-i', '--input-files FILES', String, 'RSpec report files (JSON or JUnit XML)') do |input_files|
|
15
|
+
params[:junit_files] = input_files
|
16
|
+
end
|
17
|
+
|
18
|
+
opts.on_tail('-v', '--version', 'Show the version') do
|
19
|
+
require_relative "../lib/gitlab_quality/test_tooling/version"
|
20
|
+
puts "#{$PROGRAM_NAME} : #{GitlabQuality::TestTooling::VERSION}"
|
21
|
+
exit
|
22
|
+
end
|
23
|
+
|
24
|
+
opts.on_tail('-h', '--help', 'Show the usage') do
|
25
|
+
puts "Purpose: Update the path to screenshots to container's host from RSpec report files (JSON or JUnit XML)"
|
26
|
+
puts opts
|
27
|
+
exit
|
28
|
+
end
|
29
|
+
|
30
|
+
opts.parse(ARGV)
|
31
|
+
end
|
32
|
+
|
33
|
+
if params.any?
|
34
|
+
GitlabQuality::TestTooling::Report::UpdateScreenshotPath.new(**params).invoke!
|
35
|
+
else
|
36
|
+
puts options
|
37
|
+
exit 1
|
38
|
+
end
|