gitlab-qa 5.14.1 → 5.15.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 80b5afa85b80b6c367a00f9e0077782d761bf5ad69d851aa95e5ea4f7ec4af78
4
- data.tar.gz: b6940307fb5981a4f7c4468be522916ae4a01f2e65ddb0a5847037ce7099556f
3
+ metadata.gz: 32ae85f17e98b415ac5fddd505d5cf9d37462bbcc5b0eabee7584c3a26803542
4
+ data.tar.gz: 62ea7475a8d3eddb193a975c440fc19b2177ea612ecf8a02d9bbf9a8c926f177
5
5
  SHA512:
6
- metadata.gz: 95347f6df44ef53110ac29177e3373fecba8d0ea2535f5a642233519c87d4c97edef9120d6a48e22b05739a00e4b01eccd090743894f1f0db52ba6a1ee4e0995
7
- data.tar.gz: a688557eb3fb7738f7288dfbd18bf804fbfdbf668ffd1e17f155f1df3fce5b38b5618af10460355f516e26091e93f290651f364ac5f09531827c6a06b4b0fee5
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
- ### How to add new scenarios
125
-
126
- Scenarios (test cases) and scripts to run them are located in the
127
- [CE](https://gitlab.com/gitlab-org/gitlab-ce/tree/master/qa) and
128
- [EE](https://gitlab.com/gitlab-org/gitlab-ee/tree/master/qa)
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
@@ -82,6 +82,10 @@ module Gitlab
82
82
  def running?(name)
83
83
  Docker::Command.execute("ps -f name=#{name}").include?(name)
84
84
  end
85
+
86
+ def ps(name = nil)
87
+ Docker::Command.execute(['ps', name].compact.join(' '))
88
+ end
85
89
  end
86
90
  end
87
91
  end
@@ -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?
@@ -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
- options = OptionParser.new do |opts|
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
- PASS_THROUGH_OPTS.each do |opt|
22
- opts.on(*opt)
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
- opts.parse(args)
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 = ['gitlab-psql -d template1 -c "CREATE DATABASE praefect_production OWNER gitlab"']
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'] = 'praefect-gitaly-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'] = 'praefect-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' => 'praefect-gitaly-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'] = 'praefect-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
@@ -24,7 +24,7 @@ module Gitlab
24
24
  end
25
25
  end
26
26
 
27
- project = "gitlab-org/#{QA::Release.new(release).project_name}"
27
+ project = "gitlab-org/#{QA::Release.new(release).api_project_name}"
28
28
  commit = recent_commits(project).find { |c| c['id'] == version }
29
29
 
30
30
  if commit
@@ -1,5 +1,5 @@
1
1
  module Gitlab
2
2
  module QA
3
- VERSION = '5.14.1'.freeze
3
+ VERSION = '5.15.0'.freeze
4
4
  end
5
5
  end
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.14.1
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-15 00:00:00.000000000 Z
11
+ date: 2020-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: climate_control