gitlab-qa 8.5.0 → 8.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/gitlab/qa/report/find_set_dri.rb +43 -0
- data/lib/gitlab/qa/report/gitlab_issue_client.rb +7 -0
- data/lib/gitlab/qa/report/relate_failure_issue.rb +16 -0
- data/lib/gitlab/qa/report/test_result.rb +8 -0
- data/lib/gitlab/qa/runtime/env.rb +0 -16
- data/lib/gitlab/qa/version.rb +1 -1
- metadata +3 -5
- data/lib/gitlab/qa/component/internet_tunnel.rb +0 -76
- data/lib/gitlab/qa/scenario/test/integration/kubernetes.rb +0 -56
- data/lib/gitlab/qa/scenario/test/integration/ssh_tunnel.rb +0 -56
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cedbc28c7349c22c56af141445b79d1c7c29444f66d191f465a91e8d0fc244ae
|
4
|
+
data.tar.gz: 9b857df0ad9502c59aa081fb7b1ebb2865bc7c4339c49c6f37a356c08eb1740a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4231efbe843158613694938667c8402d5dcbddeb918fb19cf00743839c80c5bc05917c264474d48e3558dd33978e9973baecad229a041873473faa1ce376122c
|
7
|
+
data.tar.gz: 7a9c4a7efd9b4759c6c487e8872ca76cfb35cc6b91cebc90e2c77b61d742b5ed2f68acd044f6b86cbfce30d822423ddd4e09cae2b5c26dd4ea2a26a72364c5e9
|
data/Gemfile.lock
CHANGED
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
module Gitlab
|
6
|
+
module QA
|
7
|
+
module Report
|
8
|
+
module FindSetDri
|
9
|
+
def set_dri_via_group(product_group, test)
|
10
|
+
parse_json_with_sets
|
11
|
+
fetch_stage_sets(test)
|
12
|
+
|
13
|
+
return @sets.sample['username'] if @stage_sets.empty?
|
14
|
+
|
15
|
+
fetch_group_sets(product_group)
|
16
|
+
|
17
|
+
if @group_sets.empty?
|
18
|
+
@stage_sets.sample['username']
|
19
|
+
else
|
20
|
+
@group_sets.sample['username']
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def parse_json_with_sets
|
27
|
+
response = Support::HttpRequest.make_http_request(
|
28
|
+
url: 'https://gitlab-org.gitlab.io/gitlab-roulette/roulette.json'
|
29
|
+
)
|
30
|
+
@sets = JSON.parse(response.body).select { |user| user['role'].include?('software-engineer-in-test') }
|
31
|
+
end
|
32
|
+
|
33
|
+
def fetch_stage_sets(test)
|
34
|
+
@stage_sets = @sets.select { |user| user['role'].include?(test.stage.split("_").map(&:capitalize).join(" ")) }
|
35
|
+
end
|
36
|
+
|
37
|
+
def fetch_group_sets(product_group)
|
38
|
+
@group_sets = @stage_sets.select { |user| user['role'].include?(product_group.split("_").map { |word| word == 'and' ? word : word.capitalize }.join(" ")) }
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -101,6 +101,13 @@ module Gitlab
|
|
101
101
|
end
|
102
102
|
end
|
103
103
|
|
104
|
+
def find_user_id(username:)
|
105
|
+
handle_gitlab_client_exceptions do
|
106
|
+
user = Gitlab.users(username: username)&.first
|
107
|
+
user['id'] unless user.nil?
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
104
111
|
def upload_file(file_fullpath:)
|
105
112
|
ignore_gitlab_client_exceptions do
|
106
113
|
Gitlab.upload_file(project, file_fullpath)
|
@@ -3,12 +3,15 @@
|
|
3
3
|
require 'nokogiri'
|
4
4
|
require 'active_support/core_ext/enumerable'
|
5
5
|
require 'rubygems/text'
|
6
|
+
require 'active_support/core_ext/integer/time'
|
6
7
|
|
7
8
|
module Gitlab
|
8
9
|
module QA
|
9
10
|
module Report
|
10
11
|
# Uses the API to create or update GitLab issues with the results of tests from RSpec report files.
|
11
12
|
class RelateFailureIssue < ReportAsIssue
|
13
|
+
include FindSetDri
|
14
|
+
|
12
15
|
DEFAULT_MAX_DIFF_RATIO_FOR_DETECTION = 0.15
|
13
16
|
FAILURE_STACKTRACE_REGEX = %r{((.*Failure\/Error:(?<stacktrace>.+))|(?<stacktrace>.+))}m.freeze
|
14
17
|
ISSUE_STACKTRACE_REGEX = /### Stack trace\s*(```)#{FAILURE_STACKTRACE_REGEX}(```)/m.freeze
|
@@ -74,6 +77,8 @@ module Gitlab
|
|
74
77
|
|
75
78
|
post_or_update_failed_job_note(issue, test)
|
76
79
|
|
80
|
+
assign_dri(issue, test)
|
81
|
+
|
77
82
|
issue
|
78
83
|
end
|
79
84
|
|
@@ -218,6 +223,17 @@ module Gitlab
|
|
218
223
|
|
219
224
|
section
|
220
225
|
end
|
226
|
+
|
227
|
+
def assign_dri(issue, test)
|
228
|
+
if test.product_group?
|
229
|
+
dri = set_dri_via_group(test.product_group, test)
|
230
|
+
dri_id = gitlab.find_user_id(username: dri)
|
231
|
+
gitlab.edit_issue(iid: issue.iid, options: { assignee_id: dri_id, due_date: Date.today + 1.month })
|
232
|
+
puts " => Assigning #{dri} as DRI for the issue."
|
233
|
+
else
|
234
|
+
puts " => No product group metadata found for test '#{test.name}'"
|
235
|
+
end
|
236
|
+
end
|
221
237
|
end
|
222
238
|
end
|
223
239
|
end
|
@@ -103,6 +103,14 @@ module Gitlab
|
|
103
103
|
report['screenshot']['image'] if screenshot?
|
104
104
|
end
|
105
105
|
|
106
|
+
def product_group?
|
107
|
+
report['product_group'].present?
|
108
|
+
end
|
109
|
+
|
110
|
+
def product_group
|
111
|
+
report['product_group'] if product_group?
|
112
|
+
end
|
113
|
+
|
106
114
|
private
|
107
115
|
|
108
116
|
# rubocop:disable Metrics/AbcSize
|
@@ -279,14 +279,6 @@ module Gitlab
|
|
279
279
|
raise ArgumentError, "Please provide GITLAB_QA_CONTAINER_REGISTRY_ACCESS_TOKEN"
|
280
280
|
end
|
281
281
|
|
282
|
-
def require_kubernetes_environment!
|
283
|
-
%w[GCLOUD_ACCOUNT_EMAIL GCLOUD_ACCOUNT_KEY CLOUDSDK_CORE_PROJECT].each do |env_key|
|
284
|
-
unless ENV.key?(env_key)
|
285
|
-
raise ArgumentError, "Environment variable #{env_key} must be set to run kubernetes specs"
|
286
|
-
end
|
287
|
-
end
|
288
|
-
end
|
289
|
-
|
290
282
|
def require_aws_s3_environment!
|
291
283
|
%w[AWS_S3_REGION AWS_S3_KEY_ID AWS_S3_ACCESS_KEY AWS_S3_BUCKET_NAME].each do |env_key|
|
292
284
|
unless ENV.key?(env_key)
|
@@ -320,14 +312,6 @@ module Gitlab
|
|
320
312
|
)
|
321
313
|
end
|
322
314
|
|
323
|
-
def require_ssh_tunnel!
|
324
|
-
%w[TUNNEL_SSH_PRIVATE_KEY TUNNEL_SERVER_HOSTNAME TUNNEL_SSH_USER].each do |env_key|
|
325
|
-
unless ENV.key?(env_key)
|
326
|
-
raise ArgumentError, "Environment variable #{env_key} must be set to run tunnel specs"
|
327
|
-
end
|
328
|
-
end
|
329
|
-
end
|
330
|
-
|
331
315
|
def override_default_password!
|
332
316
|
require_initial_password!
|
333
317
|
|
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: 8.
|
4
|
+
version: 8.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitLab Quality
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-10-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: climate_control
|
@@ -313,7 +313,6 @@ files:
|
|
313
313
|
- lib/gitlab/qa/component/base.rb
|
314
314
|
- lib/gitlab/qa/component/elasticsearch.rb
|
315
315
|
- lib/gitlab/qa/component/gitlab.rb
|
316
|
-
- lib/gitlab/qa/component/internet_tunnel.rb
|
317
316
|
- lib/gitlab/qa/component/jira.rb
|
318
317
|
- lib/gitlab/qa/component/ldap.rb
|
319
318
|
- lib/gitlab/qa/component/mail_hog.rb
|
@@ -334,6 +333,7 @@ files:
|
|
334
333
|
- lib/gitlab/qa/docker/volumes.rb
|
335
334
|
- lib/gitlab/qa/release.rb
|
336
335
|
- lib/gitlab/qa/report/base_test_results.rb
|
336
|
+
- lib/gitlab/qa/report/find_set_dri.rb
|
337
337
|
- lib/gitlab/qa/report/generate_test_session.rb
|
338
338
|
- lib/gitlab/qa/report/gitlab_issue_client.rb
|
339
339
|
- lib/gitlab/qa/report/gitlab_issue_dry_client.rb
|
@@ -391,7 +391,6 @@ files:
|
|
391
391
|
- lib/gitlab/qa/scenario/test/integration/instance_saml.rb
|
392
392
|
- lib/gitlab/qa/scenario/test/integration/integrations.rb
|
393
393
|
- lib/gitlab/qa/scenario/test/integration/jira.rb
|
394
|
-
- lib/gitlab/qa/scenario/test/integration/kubernetes.rb
|
395
394
|
- lib/gitlab/qa/scenario/test/integration/ldap.rb
|
396
395
|
- lib/gitlab/qa/scenario/test/integration/ldap_no_server.rb
|
397
396
|
- lib/gitlab/qa/scenario/test/integration/ldap_no_tls.rb
|
@@ -407,7 +406,6 @@ files:
|
|
407
406
|
- lib/gitlab/qa/scenario/test/integration/saml.rb
|
408
407
|
- lib/gitlab/qa/scenario/test/integration/service_ping_disabled.rb
|
409
408
|
- lib/gitlab/qa/scenario/test/integration/smtp.rb
|
410
|
-
- lib/gitlab/qa/scenario/test/integration/ssh_tunnel.rb
|
411
409
|
- lib/gitlab/qa/scenario/test/integration/suggested_reviewer.rb
|
412
410
|
- lib/gitlab/qa/scenario/test/omnibus/image.rb
|
413
411
|
- lib/gitlab/qa/scenario/test/omnibus/update.rb
|
@@ -1,76 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'tempfile'
|
4
|
-
|
5
|
-
module Gitlab
|
6
|
-
module QA
|
7
|
-
module Component
|
8
|
-
class InternetTunnel < Base
|
9
|
-
DOCKER_IMAGE = 'gitlab/ssh-tunnel'
|
10
|
-
DOCKER_IMAGE_TAG = '1.0.0'
|
11
|
-
|
12
|
-
attr_writer :gitlab_hostname
|
13
|
-
|
14
|
-
def initialize
|
15
|
-
super
|
16
|
-
|
17
|
-
key_dir = ENV['CI_PROJECT_DIR'] || Dir.tmpdir
|
18
|
-
@ssh_key = Tempfile.new('tunnel-ssh-private-key', key_dir)
|
19
|
-
@ssh_key.write(ENV.fetch('TUNNEL_SSH_PRIVATE_KEY'))
|
20
|
-
@ssh_key.close
|
21
|
-
|
22
|
-
File.chmod(0o600, @ssh_key.path)
|
23
|
-
|
24
|
-
@volumes['/root/.ssh/id_rsa'] = @ssh_key.path
|
25
|
-
end
|
26
|
-
|
27
|
-
def instance
|
28
|
-
raise 'Please provide a block!' unless block_given?
|
29
|
-
|
30
|
-
super
|
31
|
-
end
|
32
|
-
|
33
|
-
def url
|
34
|
-
"https://#{subdomain}.#{tunnel_server_hostname}"
|
35
|
-
end
|
36
|
-
|
37
|
-
private
|
38
|
-
|
39
|
-
def name
|
40
|
-
@name ||= "ssh-tunnel-#{SecureRandom.hex(4)}"
|
41
|
-
end
|
42
|
-
|
43
|
-
def tunnel_server_hostname
|
44
|
-
ENV.fetch("TUNNEL_SERVER_HOSTNAME")
|
45
|
-
end
|
46
|
-
|
47
|
-
def subdomain
|
48
|
-
@subdomain ||= rand(30_000..49_000)
|
49
|
-
end
|
50
|
-
|
51
|
-
def start
|
52
|
-
raise "Must set gitlab_hostname" unless @gitlab_hostname
|
53
|
-
|
54
|
-
@docker.run(
|
55
|
-
image: DOCKER_IMAGE,
|
56
|
-
tag: DOCKER_IMAGE_TAG,
|
57
|
-
args: ["-o StrictHostKeyChecking=no -N -R #{subdomain}:#{@gitlab_hostname}:80 #{ENV.fetch('TUNNEL_SSH_USER')}@#{tunnel_server_hostname}"]) do |command|
|
58
|
-
command << '-d '
|
59
|
-
command << "--name #{name}"
|
60
|
-
command << "--net #{network}"
|
61
|
-
|
62
|
-
@volumes.to_h.each do |to, from|
|
63
|
-
command.volume(from, to, 'Z')
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
def teardown
|
69
|
-
super
|
70
|
-
|
71
|
-
@ssh_key.unlink
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
@@ -1,56 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'yaml'
|
4
|
-
|
5
|
-
module Gitlab
|
6
|
-
module QA
|
7
|
-
module Scenario
|
8
|
-
module Test
|
9
|
-
module Integration
|
10
|
-
class Kubernetes < Scenario::Template
|
11
|
-
def perform(release, *rspec_args)
|
12
|
-
Runtime::Env.require_kubernetes_environment!
|
13
|
-
|
14
|
-
Component::Gitlab.perform do |gitlab|
|
15
|
-
gitlab.release = release
|
16
|
-
gitlab.network = 'test'
|
17
|
-
|
18
|
-
Component::InternetTunnel.perform do |tunnel_gitlab|
|
19
|
-
Component::InternetTunnel.perform do |tunnel_registry|
|
20
|
-
tunnel_gitlab.gitlab_hostname = gitlab.hostname
|
21
|
-
tunnel_gitlab.network = 'test'
|
22
|
-
tunnel_registry.gitlab_hostname = gitlab.hostname
|
23
|
-
tunnel_registry.network = 'test'
|
24
|
-
|
25
|
-
gitlab.omnibus_configuration << <<~OMNIBUS
|
26
|
-
external_url '#{tunnel_gitlab.url}';
|
27
|
-
nginx['listen_port'] = 80;
|
28
|
-
nginx['listen_https'] = false;
|
29
|
-
|
30
|
-
registry_external_url '#{tunnel_registry.url}';
|
31
|
-
registry_nginx['listen_port'] = 80;
|
32
|
-
registry_nginx['listen_https'] = false;
|
33
|
-
OMNIBUS
|
34
|
-
|
35
|
-
tunnel_gitlab.instance do
|
36
|
-
tunnel_registry.instance do
|
37
|
-
gitlab.instance do
|
38
|
-
Component::Specs.perform do |specs|
|
39
|
-
specs.suite = 'Test::Integration::Kubernetes'
|
40
|
-
specs.release = gitlab.release
|
41
|
-
specs.network = gitlab.network
|
42
|
-
specs.args = [tunnel_gitlab.url, *rspec_args]
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
@@ -1,56 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Gitlab
|
4
|
-
module QA
|
5
|
-
module Scenario
|
6
|
-
module Test
|
7
|
-
module Integration
|
8
|
-
class SSHTunnel < Scenario::Template
|
9
|
-
def perform(release, *rspec_args)
|
10
|
-
Runtime::Env.override_default_password!
|
11
|
-
Runtime::Env.require_ssh_tunnel!
|
12
|
-
|
13
|
-
Component::Gitlab.perform do |gitlab|
|
14
|
-
gitlab.release = release
|
15
|
-
gitlab.network = 'test'
|
16
|
-
|
17
|
-
Component::InternetTunnel.perform do |tunnel_gitlab|
|
18
|
-
Component::InternetTunnel.perform do |tunnel_registry|
|
19
|
-
tunnel_gitlab.gitlab_hostname = gitlab.hostname
|
20
|
-
tunnel_gitlab.network = 'test'
|
21
|
-
tunnel_registry.gitlab_hostname = gitlab.hostname
|
22
|
-
tunnel_registry.network = 'test'
|
23
|
-
|
24
|
-
gitlab.omnibus_configuration << <<~OMNIBUS
|
25
|
-
external_url '#{tunnel_gitlab.url}';
|
26
|
-
nginx['listen_port'] = 80;
|
27
|
-
nginx['listen_https'] = false;
|
28
|
-
gitlab_rails['initial_root_password'] = '#{Runtime::Env.require_initial_password!}';
|
29
|
-
|
30
|
-
registry_external_url '#{tunnel_registry.url}';
|
31
|
-
registry_nginx['listen_port'] = 80;
|
32
|
-
registry_nginx['listen_https'] = false;
|
33
|
-
OMNIBUS
|
34
|
-
|
35
|
-
tunnel_gitlab.instance do
|
36
|
-
tunnel_registry.instance do
|
37
|
-
gitlab.instance do
|
38
|
-
Component::Specs.perform do |specs|
|
39
|
-
specs.suite = 'Test::Integration::SSHTunnel'
|
40
|
-
specs.release = gitlab.release
|
41
|
-
specs.network = gitlab.network
|
42
|
-
specs.args = [tunnel_gitlab.url, *rspec_args]
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|