gitlab-qa 5.14.1 → 5.15.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/README.md +52 -5
- data/lib/gitlab/qa/component/base.rb +17 -2
- data/lib/gitlab/qa/component/specs.rb +8 -0
- data/lib/gitlab/qa/docker/engine.rb +4 -0
- data/lib/gitlab/qa/release.rb +6 -0
- data/lib/gitlab/qa/runner.rb +23 -15
- data/lib/gitlab/qa/scenario/test/integration/praefect.rb +18 -7
- data/lib/gitlab/qa/scenario/test/sanity/version.rb +1 -1
- data/lib/gitlab/qa/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32ae85f17e98b415ac5fddd505d5cf9d37462bbcc5b0eabee7584c3a26803542
|
4
|
+
data.tar.gz: 62ea7475a8d3eddb193a975c440fc19b2177ea612ecf8a02d9bbf9a8c926f177
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35e187728145ac187fda0dbe3b41b24d44adc52a3cb8718083736ccf0e36f06a089c74e97db983b4b40f2eb432fa847c440208e083df24d8f9a5df76a495b0d7
|
7
|
+
data.tar.gz: a7e08091352126ada545f61b6d7a940e0eb87f4ec9d9753fa0521244c2f35b209a0474eb158b7e82486ee7fe5ae59047d3748fd6aadd36922d96b9520081b177
|
data/README.md
CHANGED
@@ -121,11 +121,58 @@ All the scenarios you can run are described in the
|
|
121
121
|
|
122
122
|
Note: The GitLab QA tool requires that [Docker](https://docs.docker.com/install/) is installed.
|
123
123
|
|
124
|
-
###
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
124
|
+
### Command-line options
|
125
|
+
|
126
|
+
In addition to the [arguments you can use to specify the scenario and
|
127
|
+
tests to run](/docs/what_tests_can_be_run.md), you can use the
|
128
|
+
following options to control the tool's behavior.
|
129
|
+
|
130
|
+
**Note:** These are `gitlab-qa` options so if you specify RSpec
|
131
|
+
options as well, including test file paths, be sure to add these
|
132
|
+
options before the `--` that indicates that subsequent arguments are
|
133
|
+
intended for RSpec.
|
134
|
+
|
135
|
+
| Option | Description |
|
136
|
+
| ------ | ----------- |
|
137
|
+
| `--no-teardown` | Skip teardown of containers after the scenario completes |
|
138
|
+
| `--no-tests` | Orchestrates the docker containers but does not run the tests. Implies `--no-teardown` |
|
139
|
+
|
140
|
+
For example, the following command would start an EE GitLab Docker
|
141
|
+
container and would leave the instance running, but would not run the
|
142
|
+
tests:
|
143
|
+
|
144
|
+
```plaintext
|
145
|
+
$ gitlab-qa Test::Instance::Image EE --no-tests
|
146
|
+
```
|
147
|
+
|
148
|
+
GitLab QA will have automatically run the `docker ps` command to show
|
149
|
+
the port that container is running on, for example:
|
150
|
+
|
151
|
+
```plaintext
|
152
|
+
...
|
153
|
+
Skipping tests.
|
154
|
+
The orchestrated docker containers have not been removed.
|
155
|
+
Docker shell command: `docker ps`
|
156
|
+
CONTAINER ID IMAGE ... PORTS
|
157
|
+
fdeffd791b69 gitlab/gitlab-ee:nightly 22/tcp, 443/tcp, 0.0.0.0:32768->80/tcp
|
158
|
+
```
|
159
|
+
|
160
|
+
You could then run tests against that instance in a similar way to
|
161
|
+
[running tests against GDK](/docs/run_qa_against_gdk.md). This can be
|
162
|
+
useful if you want to run and debug a specific test, for example:
|
163
|
+
|
164
|
+
```plaintext
|
165
|
+
# From /path/to/gdk/gitlab/qa
|
166
|
+
$ bundle exec bin/qa Test::Instance::All http://localhost:32768 -- qa/specs/features/browser_ui/3_create/merge_request/create_merge_request_spec.rb
|
167
|
+
```
|
168
|
+
|
169
|
+
### How to add new tests
|
170
|
+
|
171
|
+
Please see the [Beginner's guide to writing end-to-end tests](https://docs.gitlab.com/ee/development/testing_guide/end_to_end/beginners_guide.html).
|
172
|
+
|
173
|
+
Test cases and scripts to run them are located in the
|
174
|
+
[GitLab FOSS](https://gitlab.com/gitlab-org/gitlab-foss/tree/master/qa) and
|
175
|
+
[GitLab](https://gitlab.com/gitlab-org/gitlab/tree/master/qa)
|
129
176
|
repositories under the `qa/` directory, so please also check the documentation
|
130
177
|
there.
|
131
178
|
|
@@ -61,8 +61,6 @@ module Gitlab
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def prepare_docker_image
|
64
|
-
return if Runtime::Env.skip_pull?
|
65
|
-
|
66
64
|
pull
|
67
65
|
end
|
68
66
|
|
@@ -106,6 +104,17 @@ module Gitlab
|
|
106
104
|
end
|
107
105
|
|
108
106
|
def teardown
|
107
|
+
unless teardown?
|
108
|
+
puts "The orchestrated docker containers have not been removed."
|
109
|
+
docker.ps
|
110
|
+
|
111
|
+
return
|
112
|
+
end
|
113
|
+
|
114
|
+
teardown!
|
115
|
+
end
|
116
|
+
|
117
|
+
def teardown!
|
109
118
|
assert_name!
|
110
119
|
|
111
120
|
return unless docker.running?(name)
|
@@ -115,6 +124,8 @@ module Gitlab
|
|
115
124
|
end
|
116
125
|
|
117
126
|
def pull
|
127
|
+
return if Runtime::Env.skip_pull?
|
128
|
+
|
118
129
|
docker.pull(image, tag)
|
119
130
|
end
|
120
131
|
|
@@ -129,6 +140,10 @@ module Gitlab
|
|
129
140
|
def assert_name!
|
130
141
|
raise 'Invalid instance name!' unless name
|
131
142
|
end
|
143
|
+
|
144
|
+
def teardown?
|
145
|
+
!Runtime::Scenario.attributes.include?(:teardown) || Runtime::Scenario.teardown
|
146
|
+
end
|
132
147
|
end
|
133
148
|
end
|
134
149
|
end
|
@@ -17,6 +17,8 @@ module Gitlab
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def perform # rubocop:disable Metrics/AbcSize
|
20
|
+
return puts "Skipping tests." if skip_tests?
|
21
|
+
|
20
22
|
raise ArgumentError unless [suite, release].all?
|
21
23
|
|
22
24
|
@docker.login(**release.login_params) if release.login_params
|
@@ -42,6 +44,12 @@ module Gitlab
|
|
42
44
|
command.name(name)
|
43
45
|
end
|
44
46
|
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
def skip_tests?
|
51
|
+
Runtime::Scenario.attributes.include?(:run_tests) && !Runtime::Scenario.run_tests
|
52
|
+
end
|
45
53
|
end
|
46
54
|
end
|
47
55
|
end
|
data/lib/gitlab/qa/release.rb
CHANGED
@@ -136,6 +136,8 @@ module Gitlab
|
|
136
136
|
end
|
137
137
|
|
138
138
|
def login_params
|
139
|
+
return if Runtime::Env.skip_pull?
|
140
|
+
|
139
141
|
if dev_gitlab_org?
|
140
142
|
Runtime::Env.require_qa_dev_access_token!
|
141
143
|
|
@@ -173,6 +175,10 @@ module Gitlab
|
|
173
175
|
canonical? || release.match?(CUSTOM_GITLAB_IMAGE_REGEX)
|
174
176
|
end
|
175
177
|
|
178
|
+
def api_project_name
|
179
|
+
project_name.gsub('ce', 'foss').gsub('-ee', '')
|
180
|
+
end
|
181
|
+
|
176
182
|
private
|
177
183
|
|
178
184
|
def canonical?
|
data/lib/gitlab/qa/runner.rb
CHANGED
@@ -4,22 +4,20 @@ module Gitlab
|
|
4
4
|
module QA
|
5
5
|
# rubocop:disable Metrics/AbcSize
|
6
6
|
class Runner
|
7
|
-
# These options are implemented in the QA framework (i.e., in the CE/EE codebase)
|
8
|
-
# They're included here so that gitlab-qa treats them as valid options
|
9
|
-
PASS_THROUGH_OPTS = [
|
10
|
-
['--address URL', 'Address of the instance to test'],
|
11
|
-
['--enable-feature FEATURE_FLAG', 'Enable a feature before running tests'],
|
12
|
-
['--mattermost-address URL', 'Address of the Mattermost server'],
|
13
|
-
['--parallel', 'Execute tests in parallel'],
|
14
|
-
['--loop', 'Execute tests in a loop']
|
15
|
-
].freeze
|
16
|
-
|
17
7
|
def self.run(args)
|
18
|
-
|
8
|
+
Runtime::Scenario.define(:teardown, true)
|
9
|
+
Runtime::Scenario.define(:run_tests, true)
|
10
|
+
|
11
|
+
@options = OptionParser.new do |opts|
|
19
12
|
opts.banner = 'Usage: gitlab-qa [options] Scenario URL [[--] path] [rspec_options]'
|
20
13
|
|
21
|
-
|
22
|
-
|
14
|
+
opts.on('--no-teardown', 'Skip teardown of containers after the scenario completes.') do
|
15
|
+
Runtime::Scenario.define(:teardown, false)
|
16
|
+
end
|
17
|
+
|
18
|
+
opts.on('--no-tests', 'Orchestrates the docker containers but does not run the tests. Implies --no-teardown') do
|
19
|
+
Runtime::Scenario.define(:run_tests, false)
|
20
|
+
Runtime::Scenario.define(:teardown, false)
|
23
21
|
end
|
24
22
|
|
25
23
|
opts.on_tail('-v', '--version', 'Show the version') do
|
@@ -33,19 +31,29 @@ module Gitlab
|
|
33
31
|
exit
|
34
32
|
end
|
35
33
|
|
36
|
-
|
34
|
+
begin
|
35
|
+
opts.parse(args)
|
36
|
+
rescue OptionParser::InvalidOption
|
37
|
+
# Ignore invalid options and options that are passed through to the tests
|
38
|
+
end
|
37
39
|
end
|
38
40
|
|
41
|
+
args.reject! { |arg| gitlab_qa_options.include?(arg) }
|
42
|
+
|
39
43
|
if args.size >= 1
|
40
44
|
Scenario
|
41
45
|
.const_get(args.shift)
|
42
46
|
.perform(*args)
|
43
47
|
else
|
44
|
-
puts options
|
48
|
+
puts @options
|
45
49
|
exit 1
|
46
50
|
end
|
47
51
|
end
|
48
52
|
# rubocop:enable Metrics/AbcSize
|
53
|
+
|
54
|
+
def self.gitlab_qa_options
|
55
|
+
@gitlab_qa_options ||= @options.top.list.map(&:long).flatten
|
56
|
+
end
|
49
57
|
end
|
50
58
|
end
|
51
59
|
end
|
@@ -13,7 +13,11 @@ module Gitlab
|
|
13
13
|
gitlab.name = 'gitlab'
|
14
14
|
gitlab.network = 'test'
|
15
15
|
gitlab.volumes = volumes
|
16
|
-
gitlab.exec_commands = [
|
16
|
+
gitlab.exec_commands = [
|
17
|
+
'gitlab-psql -d template1 -c "CREATE DATABASE praefect_production OWNER gitlab"',
|
18
|
+
'mkdir -p /var/opt/gitlab/git-data/repositories/praefect',
|
19
|
+
'chown -R git:root /var/opt/gitlab/git-data/repositories'
|
20
|
+
]
|
17
21
|
|
18
22
|
gitlab.act do
|
19
23
|
prepare
|
@@ -21,7 +25,7 @@ module Gitlab
|
|
21
25
|
reconfigure
|
22
26
|
process_exec_commands
|
23
27
|
wait
|
24
|
-
teardown
|
28
|
+
teardown!
|
25
29
|
end
|
26
30
|
end
|
27
31
|
|
@@ -61,21 +65,25 @@ module Gitlab
|
|
61
65
|
def omnibus_config_with_praefect
|
62
66
|
<<~OMNIBUS
|
63
67
|
gitaly['enable'] = true;
|
64
|
-
gitaly['auth_token'] = '
|
68
|
+
gitaly['auth_token'] = 'secret-token';
|
65
69
|
gitaly['storage'] = [
|
66
70
|
{
|
67
71
|
'name' => 'praefect-gitaly-0',
|
68
|
-
'path' => '/var/opt/gitlab/git-data/repositories'
|
72
|
+
'path' => '/var/opt/gitlab/git-data/repositories/praefect'
|
73
|
+
},
|
74
|
+
{
|
75
|
+
'name' => 'gitaly',
|
76
|
+
'path' => '/var/opt/gitlab/git-data/repositories/gitaly'
|
69
77
|
}
|
70
78
|
];
|
71
79
|
praefect['enable'] = true;
|
72
80
|
praefect['listen_addr'] = '0.0.0.0:2305';
|
73
|
-
praefect['auth_token'] = '
|
81
|
+
praefect['auth_token'] = 'secret-token';
|
74
82
|
praefect['virtual_storages'] = {
|
75
83
|
'default' => {
|
76
84
|
'praefect-gitaly-0' => {
|
77
85
|
'address' => 'unix:/var/opt/gitlab/gitaly/gitaly.socket',
|
78
|
-
'token' => '
|
86
|
+
'token' => 'secret-token',
|
79
87
|
'primary' => true
|
80
88
|
}
|
81
89
|
}
|
@@ -84,10 +92,13 @@ module Gitlab
|
|
84
92
|
praefect['database_user'] = 'gitlab';
|
85
93
|
praefect['database_dbname'] = 'praefect_production';
|
86
94
|
praefect['postgres_queue_enabled'] = true;
|
87
|
-
gitlab_rails['gitaly_token'] = '
|
95
|
+
gitlab_rails['gitaly_token'] = 'secret-token';
|
88
96
|
git_data_dirs({
|
89
97
|
'default' => {
|
90
98
|
'gitaly_address' => 'tcp://localhost:2305'
|
99
|
+
},
|
100
|
+
'gitaly' => {
|
101
|
+
'path' => '/var/opt/gitlab/git-data/repositories/gitaly'
|
91
102
|
}
|
92
103
|
});
|
93
104
|
OMNIBUS
|
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: 5.
|
4
|
+
version: 5.15.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-06
|
11
|
+
date: 2020-07-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: climate_control
|