gitlab-qa 4.17.0 → 4.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitlab-ci.yml +18 -6
- data/docs/run_qa_against_gdk.md +22 -15
- data/gitlab-qa.gemspec +1 -0
- data/lib/gitlab/qa.rb +4 -0
- data/lib/gitlab/qa/component/elasticsearch.rb +1 -1
- data/lib/gitlab/qa/report/prepare_stage_reports.rb +81 -0
- data/lib/gitlab/qa/runner.rb +14 -0
- data/lib/gitlab/qa/scenario/test/integration/object_storage.rb +21 -18
- data/lib/gitlab/qa/version.rb +1 -1
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b8e33bf4d877487bb51ea8065ebf88f3d994d185e7ae726231de792f940eb7b
|
4
|
+
data.tar.gz: 629036685c9ca7bb1e5bb95e2969bf406b91968d237f80af57e312c7a68b9018
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3bd1fa727d5b757183ab56eec1caedc7371abc2721db21d5d461fee75dde415788437162211ab7aa7bdaf21c1cf754fb7a040a0296a1c1ae9fd4494156feb3a
|
7
|
+
data.tar.gz: 459de3a08075be669907795af61fb2dd253268f90b9600e15b0386a1d8f61192e5e203ec3fe9b3ec1c2332140b9fe1bf3bb8e7c07ec5ddb00ab347fa8a95c7f8
|
data/.gitlab-ci.yml
CHANGED
@@ -61,12 +61,16 @@ check:rspec:
|
|
61
61
|
junit: gitlab-qa-run-*/**/rspec-*.xml
|
62
62
|
|
63
63
|
.ce-qa:
|
64
|
+
variables:
|
65
|
+
DEFAULT_RELEASE: "CE"
|
64
66
|
only:
|
65
67
|
variables:
|
66
68
|
- $RELEASE == null
|
67
69
|
- $RELEASE =~ /gitlab-ce/
|
68
70
|
|
69
71
|
.ee-qa:
|
72
|
+
variables:
|
73
|
+
DEFAULT_RELEASE: "EE"
|
70
74
|
only:
|
71
75
|
variables:
|
72
76
|
- $RELEASE == null
|
@@ -98,6 +102,14 @@ check:rspec:
|
|
98
102
|
allow_failure: true
|
99
103
|
when: manual
|
100
104
|
|
105
|
+
.echo-custom-variables-before-calling-gitlab-qa:
|
106
|
+
script:
|
107
|
+
- echo "${QA_SCENARIO:=Test::Instance::Image}"
|
108
|
+
- echo "${QA_TESTS}"
|
109
|
+
- echo "${QA_RSPEC_TAGS}"
|
110
|
+
- echo "${RELEASE:=$DEFAULT_RELEASE}"
|
111
|
+
- exe/gitlab-qa ${QA_SCENARIO} ${RELEASE} -- ${QA_TESTS} ${QA_RSPEC_TAGS} $RSPEC_REPORT_OPTS
|
112
|
+
|
101
113
|
ce:sanity-framework:
|
102
114
|
script:
|
103
115
|
- ./bin/expect_exit_code_and_text "exe/gitlab-qa Test::Instance::Image ${RELEASE:=CE} -- --tag framework" 1 "2 examples, 1 failure"
|
@@ -114,25 +126,25 @@ ee:sanity-framework:
|
|
114
126
|
- .high-capacity
|
115
127
|
- .ee-qa
|
116
128
|
|
117
|
-
ce:custom:
|
118
|
-
script:
|
119
|
-
- exe/gitlab-qa ${QA_SCENARIO:=Test::Instance::Image} ${RELEASE:=CE} -- ${QA_TESTS} ${QA_RSPEC_TAGS} $RSPEC_REPORT_OPTS
|
129
|
+
ce:custom-parallel:
|
120
130
|
extends:
|
121
131
|
- .test
|
122
132
|
- .high-capacity
|
123
133
|
- .ce-qa
|
124
134
|
- .rspec-report-opts
|
135
|
+
- .echo-custom-variables-before-calling-gitlab-qa
|
125
136
|
when: manual
|
137
|
+
parallel: 10
|
126
138
|
|
127
|
-
ee:custom:
|
128
|
-
script:
|
129
|
-
- exe/gitlab-qa ${QA_SCENARIO:=Test::Instance::Image} ${RELEASE:=EE} -- ${QA_TESTS} ${QA_RSPEC_TAGS} $RSPEC_REPORT_OPTS
|
139
|
+
ee:custom-parallel:
|
130
140
|
extends:
|
131
141
|
- .test
|
132
142
|
- .high-capacity
|
133
143
|
- .ee-qa
|
134
144
|
- .rspec-report-opts
|
145
|
+
- .echo-custom-variables-before-calling-gitlab-qa
|
135
146
|
when: manual
|
147
|
+
parallel: 10
|
136
148
|
|
137
149
|
ce:instance:
|
138
150
|
script:
|
data/docs/run_qa_against_gdk.md
CHANGED
@@ -4,21 +4,28 @@ To run the `Test::Instance::Any` scenario against your local GDK, you'll need to
|
|
4
4
|
make a few changes to your `gdk/gitlab/config/gitlab.yml` file.
|
5
5
|
|
6
6
|
1. Retrieve your current local IP with `ifconfig`, e.g. `192.168.0.12`.
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
7
|
+
2. In your gdk directory, create file `gdk.yml`. Within `gdk.yml` add:
|
8
|
+
```yaml
|
9
|
+
---
|
10
|
+
gdk:
|
11
|
+
overwrite_changes: true
|
12
|
+
hostname: 192.168.0.12
|
13
|
+
sshd:
|
14
|
+
enabled: true
|
15
|
+
listen_address: 192.168.0.12
|
16
|
+
webpack:
|
17
|
+
host: 192.168.0.12
|
18
|
+
```
|
19
|
+
3. Run `gdk reconfigure`
|
20
|
+
- This should update `localhost` in your `gitlab/config/gitlab.yml`.
|
21
|
+
and `gdk/Procfile` as well as `gdk/openssh/sshd_config` to the provided IP address.
|
22
|
+
4. Edit `gdk/gitlab/config/gitlab.yml` and
|
23
|
+
- Replace `ssh_host: localhost` under `production:gitlab_shell` with `ssh_host: 192.168.0.12`.
|
24
|
+
5. Edit `openssh/sshd_config` in your GDK directory and
|
25
|
+
- Add `AcceptEnv GIT_PROTOCOL` to allow the use of the [Git protocol v2][Git protocol]
|
26
|
+
6. Restart your GDK by running `gdk restart`
|
27
|
+
- If reconfigure is successful, you should now be able to browse to `http://192.168.0.12:3000` instead of `http://localhost:3000`
|
28
|
+
7. Run the QA scenario as follows:
|
22
29
|
|
23
30
|
```
|
24
31
|
$ gitlab-qa Test::Instance::Any CE http://192.168.0.12:3000 -- qa/specs/features/browser_ui/1_manage/login/log_in_spec.rb
|
data/gitlab-qa.gemspec
CHANGED
data/lib/gitlab/qa.rb
CHANGED
@@ -0,0 +1,81 @@
|
|
1
|
+
require 'nokogiri'
|
2
|
+
|
3
|
+
module Gitlab
|
4
|
+
module QA
|
5
|
+
module Report
|
6
|
+
class PrepareStageReports
|
7
|
+
def initialize(input_files:)
|
8
|
+
@input_files = input_files
|
9
|
+
end
|
10
|
+
|
11
|
+
# Create a new JUnit report file for each Stage, containing tests from that Stage alone
|
12
|
+
def invoke!
|
13
|
+
collate_test_cases(@input_files).each do |stage, tests|
|
14
|
+
filename = "#{stage}.xml"
|
15
|
+
|
16
|
+
File.write(filename, new_junit_report(tests))
|
17
|
+
|
18
|
+
puts "Saved #{filename}"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def collate_test_cases(input_files)
|
25
|
+
# Collect the test cases from the original reports and group them by Stage
|
26
|
+
testcases = {}
|
27
|
+
|
28
|
+
Dir.glob(input_files).each do |rspec_report_file|
|
29
|
+
report = Nokogiri::XML(File.open(rspec_report_file))
|
30
|
+
report.xpath('//testcase').each do |test|
|
31
|
+
# The test file paths could start with any of
|
32
|
+
# /qa/specs/features/api/<stage>
|
33
|
+
# /qa/specs/features/browser_ui/<stage>
|
34
|
+
# /qa/specs/features/ee/api/<stage>
|
35
|
+
# /qa/specs/features/ee/browser_ui/<stage>
|
36
|
+
# For now we assume the Stage is whatever follows api/ or browser_ui/
|
37
|
+
stage = strip_number_prefix(test['file'].match(%r{(api|browser_ui)/([a-z0-9_]+)}i)[2])
|
38
|
+
testcases[stage] = [] unless testcases.key?(stage)
|
39
|
+
testcases[stage] << test
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
testcases
|
44
|
+
end
|
45
|
+
|
46
|
+
def strip_number_prefix(stage)
|
47
|
+
stage.sub(/^\d+_/, '')
|
48
|
+
end
|
49
|
+
|
50
|
+
def new_junit_report(testcases)
|
51
|
+
report = Nokogiri::XML::Document.new
|
52
|
+
testsuite_node = report.create_element('testsuite', name: 'rspec', **collect_stats(testcases))
|
53
|
+
report.root = testsuite_node
|
54
|
+
|
55
|
+
testcases.each do |test|
|
56
|
+
testsuite_node.add_child(test)
|
57
|
+
end
|
58
|
+
|
59
|
+
report.to_s
|
60
|
+
end
|
61
|
+
|
62
|
+
def collect_stats(testcases)
|
63
|
+
stats = {
|
64
|
+
tests: testcases.size,
|
65
|
+
failures: 0,
|
66
|
+
errors: 0,
|
67
|
+
skipped: 0
|
68
|
+
}
|
69
|
+
|
70
|
+
testcases.each do |test|
|
71
|
+
stats[:failures] += 1 unless test.search('failure').empty?
|
72
|
+
stats[:errors] += 1 unless test.search('error').empty?
|
73
|
+
stats[:skipped] += 1 unless test.search('skipped').empty?
|
74
|
+
end
|
75
|
+
|
76
|
+
stats
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
data/lib/gitlab/qa/runner.rb
CHANGED
@@ -15,6 +15,8 @@ module Gitlab
|
|
15
15
|
|
16
16
|
# rubocop:disable Metrics/AbcSize
|
17
17
|
def self.run(args)
|
18
|
+
report_options = {}
|
19
|
+
|
18
20
|
options = OptionParser.new do |opts|
|
19
21
|
opts.banner = 'Usage: gitlab-qa [options] Scenario URL [[--] path] [rspec_options]'
|
20
22
|
|
@@ -22,6 +24,11 @@ module Gitlab
|
|
22
24
|
opts.on(*opt)
|
23
25
|
end
|
24
26
|
|
27
|
+
opts.on('--prepare-stage-reports FILES', 'Prepare separate reports for each Stage from the provided JUnit XML files') do |files|
|
28
|
+
report_options[:prepare_stage_reports] = true
|
29
|
+
report_options[:input_files] = files if files
|
30
|
+
end
|
31
|
+
|
25
32
|
opts.on_tail('-v', '--version', 'Show the version') do
|
26
33
|
require 'gitlab/qa/version'
|
27
34
|
puts "#{$PROGRAM_NAME} : #{VERSION}"
|
@@ -37,6 +44,13 @@ module Gitlab
|
|
37
44
|
end
|
38
45
|
|
39
46
|
if args.size >= 1
|
47
|
+
if report_options[:prepare_stage_reports]
|
48
|
+
report_options.delete(:prepare_stage_reports)
|
49
|
+
Gitlab::QA::Report::PrepareStageReports.new(**report_options).invoke!
|
50
|
+
|
51
|
+
exit
|
52
|
+
end
|
53
|
+
|
40
54
|
Scenario
|
41
55
|
.const_get(args.shift)
|
42
56
|
.perform(*args)
|
@@ -8,6 +8,8 @@ module Gitlab
|
|
8
8
|
class ObjectStorage < Scenario::Template
|
9
9
|
include Scenario::CLICommands
|
10
10
|
|
11
|
+
TYPES = %w[artifacts external_diffs lfs uploads packages dependency_proxy].freeze
|
12
|
+
|
11
13
|
def perform(release, *rspec_args)
|
12
14
|
Component::Gitlab.perform do |gitlab|
|
13
15
|
gitlab.release = release
|
@@ -16,26 +18,12 @@ module Gitlab
|
|
16
18
|
|
17
19
|
Component::Minio.perform do |minio|
|
18
20
|
minio.network = 'test'
|
19
|
-
|
20
|
-
|
21
|
+
|
22
|
+
TYPES.each do |bucket_name|
|
23
|
+
minio.add_bucket("#{bucket_name}-bucket")
|
21
24
|
end
|
22
25
|
|
23
|
-
gitlab.omnibus_config =
|
24
|
-
gitlab_rails['uploads_object_store_enabled'] = true;
|
25
|
-
gitlab_rails['uploads_object_store_remote_directory'] = 'upload-bucket';
|
26
|
-
gitlab_rails['uploads_object_store_background_upload'] = false;
|
27
|
-
gitlab_rails['uploads_object_store_direct_upload'] = true;
|
28
|
-
gitlab_rails['uploads_object_store_proxy_download'] = true;
|
29
|
-
gitlab_rails['uploads_object_store_connection'] = #{minio.to_config};
|
30
|
-
gitlab_rails['lfs_enabled'] = true;
|
31
|
-
gitlab_rails['lfs_storage_path'] = '/var/opt/gitlab/gitlab-rails/shared/lfs-objects';
|
32
|
-
gitlab_rails['lfs_object_store_enabled'] = true;
|
33
|
-
gitlab_rails['lfs_object_store_direct_upload'] = true;
|
34
|
-
gitlab_rails['lfs_object_store_background_upload'] = false;
|
35
|
-
gitlab_rails['lfs_object_store_proxy_download'] = false;
|
36
|
-
gitlab_rails['lfs_object_store_remote_directory'] = 'lfs-bucket';
|
37
|
-
gitlab_rails['lfs_object_store_connection'] = #{minio.to_config};
|
38
|
-
OMNIBUS
|
26
|
+
gitlab.omnibus_config = object_storage_config(minio)
|
39
27
|
gitlab.exec_commands = git_lfs_install_commands
|
40
28
|
|
41
29
|
minio.instance do
|
@@ -53,6 +41,21 @@ module Gitlab
|
|
53
41
|
end
|
54
42
|
end
|
55
43
|
end
|
44
|
+
|
45
|
+
def object_storage_config(minio)
|
46
|
+
TYPES.map do |object_type|
|
47
|
+
<<~OMNIBUS
|
48
|
+
gitlab_rails['#{object_type}_enabled'] = true;
|
49
|
+
gitlab_rails['#{object_type}_storage_path'] = '/var/opt/gitlab/gitlab-rails/shared/#{object_type}';
|
50
|
+
gitlab_rails['#{object_type}_object_store_enabled'] = true;
|
51
|
+
gitlab_rails['#{object_type}_object_store_remote_directory'] = '#{object_type}-bucket';
|
52
|
+
gitlab_rails['#{object_type}_object_store_background_upload'] = false;
|
53
|
+
gitlab_rails['#{object_type}_object_store_direct_upload'] = true;
|
54
|
+
gitlab_rails['#{object_type}_object_store_proxy_download'] = true;
|
55
|
+
gitlab_rails['#{object_type}_object_store_connection'] = #{minio.to_config};
|
56
|
+
OMNIBUS
|
57
|
+
end.join("\n")
|
58
|
+
end
|
56
59
|
end
|
57
60
|
end
|
58
61
|
end
|
data/lib/gitlab/qa/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitlab-qa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.18.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Grzegorz Bizon
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: climate_control
|
@@ -122,6 +122,20 @@ dependencies:
|
|
122
122
|
- - '='
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: 3.7.0
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: nokogiri
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '1.10'
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '1.10'
|
125
139
|
description:
|
126
140
|
email:
|
127
141
|
- grzesiek.bizon@gmail.com
|
@@ -180,6 +194,7 @@ files:
|
|
180
194
|
- lib/gitlab/qa/docker/shellout.rb
|
181
195
|
- lib/gitlab/qa/docker/volumes.rb
|
182
196
|
- lib/gitlab/qa/release.rb
|
197
|
+
- lib/gitlab/qa/report/prepare_stage_reports.rb
|
183
198
|
- lib/gitlab/qa/runner.rb
|
184
199
|
- lib/gitlab/qa/runtime/env.rb
|
185
200
|
- lib/gitlab/qa/scenario/actable.rb
|