gitlab-qa 10.3.0 → 12.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -1
  3. data/.gitlab/changelog_config.yml +13 -0
  4. data/.gitlab/merge_request_templates/Release.md +13 -34
  5. data/.gitlab-ci.yml +3 -1
  6. data/.rubocop.yml +13 -2
  7. data/.rubocop_todo.yml +57 -97
  8. data/Dangerfile +1 -5
  9. data/Gemfile.lock +47 -39
  10. data/README.md +1 -2
  11. data/docs/release_process.md +1 -1
  12. data/docs/running_against_remote_grid.md +42 -3
  13. data/docs/what_tests_can_be_run.md +5 -2
  14. data/gitlab-qa.gemspec +5 -3
  15. data/lib/gitlab/qa/component/base.rb +9 -9
  16. data/lib/gitlab/qa/component/gitaly.rb +7 -5
  17. data/lib/gitlab/qa/component/gitaly_cluster.rb +15 -9
  18. data/lib/gitlab/qa/component/gitlab.rb +48 -21
  19. data/lib/gitlab/qa/component/mail_hog.rb +1 -0
  20. data/lib/gitlab/qa/component/praefect.rb +41 -31
  21. data/lib/gitlab/qa/component/selenoid.rb +14 -7
  22. data/lib/gitlab/qa/component/specs.rb +11 -5
  23. data/lib/gitlab/qa/component/staging.rb +4 -4
  24. data/lib/gitlab/qa/component/telegraf.rb +2 -1
  25. data/lib/gitlab/qa/docker/engine.rb +6 -3
  26. data/lib/gitlab/qa/docker/volumes.rb +1 -1
  27. data/lib/gitlab/qa/release.rb +4 -4
  28. data/lib/gitlab/qa/runner.rb +10 -3
  29. data/lib/gitlab/qa/runtime/env.rb +47 -62
  30. data/lib/gitlab/qa/runtime/logger.rb +1 -1
  31. data/lib/gitlab/qa/runtime/omnibus_configuration.rb +1 -0
  32. data/lib/gitlab/qa/runtime/omnibus_configurations/decomposition_single_db.rb +1 -2
  33. data/lib/gitlab/qa/runtime/omnibus_configurations/object_storage_gcs.rb +2 -1
  34. data/lib/gitlab/qa/runtime/scenario.rb +1 -5
  35. data/lib/gitlab/qa/scenario/actable.rb +4 -4
  36. data/lib/gitlab/qa/scenario/test/instance/airgapped.rb +2 -4
  37. data/lib/gitlab/qa/scenario/test/instance/deployment_base.rb +2 -1
  38. data/lib/gitlab/qa/scenario/test/integration/gitaly_cluster.rb +0 -2
  39. data/lib/gitlab/qa/scenario/test/integration/group_saml.rb +1 -1
  40. data/lib/gitlab/qa/scenario/test/integration/ldap.rb +5 -6
  41. data/lib/gitlab/qa/scenario/test/integration/mtls.rb +20 -6
  42. data/lib/gitlab/qa/scenario/test/integration/oauth.rb +13 -4
  43. data/lib/gitlab/qa/scenario/test/integration/praefect.rb +16 -10
  44. data/lib/gitlab/qa/scenario/test/integration/registry_with_cdn.rb +5 -2
  45. data/lib/gitlab/qa/scenario/test/omnibus/update_from_previous.rb +1 -1
  46. data/lib/gitlab/qa/scenario/test/omnibus/upgrade.rb +1 -3
  47. data/lib/gitlab/qa/scenario/test/sanity/version.rb +1 -1
  48. data/lib/gitlab/qa/support/config_scripts.rb +1 -1
  49. data/lib/gitlab/qa/support/gitlab_version_info.rb +30 -10
  50. data/lib/gitlab/qa/support/shell_command.rb +1 -0
  51. data/lib/gitlab/qa/test_logger.rb +2 -2
  52. data/lib/gitlab/qa/version.rb +1 -1
  53. data/lib/gitlab/qa.rb +0 -1
  54. data/support/data/admin_access_token_seed.rb +5 -1
  55. data/support/data/license_usage_seed.rb +3 -1
  56. metadata +16 -45
  57. data/bin/slack +0 -14
  58. data/exe/gitlab-qa-report +0 -10
  59. data/lib/gitlab/qa/report/base_test_results.rb +0 -39
  60. data/lib/gitlab/qa/report/find_set_dri.rb +0 -43
  61. data/lib/gitlab/qa/report/generate_test_session.rb +0 -275
  62. data/lib/gitlab/qa/report/gitlab_issue_client.rb +0 -190
  63. data/lib/gitlab/qa/report/gitlab_issue_dry_client.rb +0 -28
  64. data/lib/gitlab/qa/report/j_unit_test_results.rb +0 -27
  65. data/lib/gitlab/qa/report/json_test_results.rb +0 -29
  66. data/lib/gitlab/qa/report/prepare_stage_reports.rb +0 -86
  67. data/lib/gitlab/qa/report/relate_failure_issue.rb +0 -374
  68. data/lib/gitlab/qa/report/report_as_issue.rb +0 -176
  69. data/lib/gitlab/qa/report/report_results.rb +0 -64
  70. data/lib/gitlab/qa/report/results_in_issues.rb +0 -126
  71. data/lib/gitlab/qa/report/results_in_testcases.rb +0 -111
  72. data/lib/gitlab/qa/report/results_reporter_shared.rb +0 -70
  73. data/lib/gitlab/qa/report/summary_table.rb +0 -43
  74. data/lib/gitlab/qa/report/test_result.rb +0 -184
  75. data/lib/gitlab/qa/report/update_screenshot_path.rb +0 -63
  76. data/lib/gitlab/qa/reporter.rb +0 -131
  77. data/lib/gitlab/qa/runtime/omnibus_configurations/packages.rb +0 -17
  78. data/lib/gitlab/qa/runtime/token_finder.rb +0 -44
  79. data/lib/gitlab/qa/slack/post_to_slack.rb +0 -30
  80. data/lib/gitlab/qa/system_logs/finders/json_log_finder.rb +0 -65
  81. data/lib/gitlab/qa/system_logs/finders/rails/api_log_finder.rb +0 -21
  82. data/lib/gitlab/qa/system_logs/finders/rails/application_log_finder.rb +0 -21
  83. data/lib/gitlab/qa/system_logs/finders/rails/exception_log_finder.rb +0 -21
  84. data/lib/gitlab/qa/system_logs/finders/rails/graphql_log_finder.rb +0 -21
  85. data/lib/gitlab/qa/system_logs/log_types/log.rb +0 -38
  86. data/lib/gitlab/qa/system_logs/log_types/rails/api_log.rb +0 -34
  87. data/lib/gitlab/qa/system_logs/log_types/rails/application_log.rb +0 -27
  88. data/lib/gitlab/qa/system_logs/log_types/rails/exception_log.rb +0 -23
  89. data/lib/gitlab/qa/system_logs/log_types/rails/graphql_log.rb +0 -30
  90. data/lib/gitlab/qa/system_logs/shared_fields.rb +0 -29
  91. data/lib/gitlab/qa/system_logs/system_logs_formatter.rb +0 -65
@@ -4,8 +4,8 @@ module Gitlab
4
4
  module QA
5
5
  module Support
6
6
  class GitlabVersionInfo
7
- VERSION_PATTERN = /^(?<version>\d+\.\d+\.\d+)/.freeze
8
- COMPONENT_PATTERN = /^(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)/.freeze
7
+ VERSION_PATTERN = /^(?<version>\d+\.\d+\.\d+)/
8
+ COMPONENT_PATTERN = /^(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)/
9
9
 
10
10
  # Get previous gitlab version
11
11
  #
@@ -47,6 +47,10 @@ module Gitlab
47
47
 
48
48
  private
49
49
 
50
+ MAX_TAGS_HTTP_REQUESTS = 50
51
+ # https://docs.docker.com/docker-hub/api/latest/#tag/images/operation/GetNamespacesRepositoriesImages
52
+ TAGS_PER_PAGE = 100
53
+
50
54
  attr_reader :current_version, :edition, :logger
51
55
 
52
56
  # Current versions major version
@@ -155,28 +159,44 @@ module Gitlab
155
159
  # All available docker tags
156
160
  #
157
161
  # @return [Array<String>]
158
- # rubocop:disable Metrics/AbcSize
159
162
  def tags
160
163
  return @tags if defined?(@tags)
161
164
 
162
- logger.info("Fetching docker tags from 'gitlab/gitlab-#{edition}' registry")
165
+ MAX_TAGS_HTTP_REQUESTS.times do |index|
166
+ tag_list, more_data = fetch_tags(page: index + 1)
167
+
168
+ if tag_list
169
+ @tags = Array(@tags)
170
+ @tags += tag_list
171
+ end
172
+
173
+ break if tag_list.nil? || more_data.nil?
174
+ end
175
+
176
+ @tags
177
+ end
178
+
179
+ def fetch_tags(page:, per_page: TAGS_PER_PAGE)
180
+ logger.info("Fetching Docker tags page #{page} from 'gitlab/gitlab-#{edition}' registry")
163
181
  response = HttpRequest.make_http_request(
164
- url: "https://registry.hub.docker.com/v2/namespaces/gitlab/repositories/gitlab-#{edition}/tags?page_size=1000",
182
+ url: "https://registry.hub.docker.com/v2/namespaces/gitlab/repositories/gitlab-#{edition}/tags?page=#{page}&page_size=#{per_page}",
165
183
  fail_on_error: false
166
184
  )
167
185
 
168
186
  unless response.code == 200
169
187
  logger.error(" failed to fetch docker tags - code: #{response.code}, response: '#{response.body}'")
170
- return @tags = nil
188
+ return nil
171
189
  end
172
190
 
173
- @tags = JSON
174
- .parse(response.body, symbolize_names: true)
191
+ response = JSON.parse(response.body, symbolize_names: true)
192
+ matching_tags = response
175
193
  .fetch(:results)
176
194
  .map { |tag| tag[:name] }
177
- .select { |tag| tag.match?(VERSION_PATTERN) }
195
+ .grep(VERSION_PATTERN)
196
+ more_data = response.fetch(:next)
197
+
198
+ [matching_tags, more_data]
178
199
  end
179
- # rubocop:enable Metrics/AbcSize
180
200
  end
181
201
  end
182
202
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'open3'
4
+ require 'active_support'
4
5
  require 'active_support/core_ext/string/filters'
5
6
 
6
7
  module Gitlab
@@ -41,7 +41,7 @@ module Gitlab
41
41
  # @return [ActiveSupport::Logger]
42
42
  def console_logger(level:, source:)
43
43
  ActiveSupport::Logger.new($stdout, level: level, datetime_format: TIME_FORMAT).tap do |logger|
44
- logger.formatter = proc do |severity, datetime, progname, msg|
44
+ logger.formatter = proc do |severity, datetime, _progname, msg|
45
45
  msg_prefix = message_prefix(datetime, source, severity)
46
46
 
47
47
  Rainbow(msg_prefix).public_send(LEVEL_COLORS.fetch(severity, :silver)) + "#{msg}\n" # rubocop:disable GitlabSecurity/PublicSend
@@ -58,7 +58,7 @@ module Gitlab
58
58
  log_file = "#{path}/#{source.downcase.tr(' ', '-')}.log"
59
59
 
60
60
  ActiveSupport::Logger.new(log_file, level: :debug, datetime_format: TIME_FORMAT).tap do |logger|
61
- logger.formatter = proc do |severity, datetime, progname, msg|
61
+ logger.formatter = proc do |severity, datetime, _progname, msg|
62
62
  msg_prefix = message_prefix(datetime, source, severity)
63
63
 
64
64
  "#{msg_prefix}#{msg}\n".gsub(/\e\[(\d+)(?:;\d+)*m/, "")
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Gitlab
4
4
  module QA
5
- VERSION = '10.3.0'
5
+ VERSION = '12.2.1'
6
6
  end
7
7
  end
data/lib/gitlab/qa.rb CHANGED
@@ -10,7 +10,6 @@ module Gitlab
10
10
  loader.ignore("#{__dir__}/qa/version.rb")
11
11
 
12
12
  loader.inflector.inflect(
13
- 'results_in_testcases' => 'ResultsInTestCases',
14
13
  'postgresql' => 'PostgreSQL',
15
14
  'registry_with_cdn' => 'RegistryWithCDN',
16
15
  'smtp' => 'SMTP',
@@ -1,5 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'active_support'
4
+ require 'active_support/core_ext/numeric/time'
5
+
3
6
  class AdminAccessTokenSeed
4
7
  TOKEN_VALUE = 'ypCa3Dzb23o5nvsixwPA'
5
8
  SCOPES = Gitlab::Auth.all_available_scopes
@@ -9,7 +12,8 @@ class AdminAccessTokenSeed
9
12
 
10
13
  token_params = {
11
14
  scopes: SCOPES.map(&:to_s),
12
- name: 'admin-api-token'
15
+ name: 'admin-api-token',
16
+ expires_at: 3.days.from_now
13
17
  }
14
18
 
15
19
  admin_user.personal_access_tokens.build(token_params).tap do |pat|
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  # rubocop:disable Metrics/AbcSize
3
4
 
4
5
  class LicenseUsageSeed
@@ -66,7 +67,8 @@ class LicenseUsageSeed
66
67
  def self.create_license_usage_record
67
68
  # Force update daily billable users and historical license data
68
69
  identifier = Analytics::UsageTrends::Measurement.identifiers[:billable_users]
69
- ::Analytics::UsageTrends::CounterJobWorker.new.perform(identifier, User.minimum(:id), User.maximum(:id), Time.zone.now)
70
+ ::Analytics::UsageTrends::CounterJobWorker.new.perform(identifier, User.minimum(:id), User.maximum(:id),
71
+ Time.zone.now)
70
72
 
71
73
  HistoricalData.track!
72
74
  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: 10.3.0
4
+ version: 12.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitLab Quality
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-04-19 00:00:00.000000000 Z
11
+ date: 2023-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: climate_control
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 6.2.1
47
+ version: '10'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 6.2.1
54
+ version: '10'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: lefthook
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -182,30 +182,36 @@ dependencies:
182
182
  name: activesupport
183
183
  requirement: !ruby/object:Gem::Requirement
184
184
  requirements:
185
- - - "~>"
185
+ - - ">="
186
186
  - !ruby/object:Gem::Version
187
187
  version: '6.1'
188
+ - - "<"
189
+ - !ruby/object:Gem::Version
190
+ version: '7.1'
188
191
  type: :runtime
189
192
  prerelease: false
190
193
  version_requirements: !ruby/object:Gem::Requirement
191
194
  requirements:
192
- - - "~>"
195
+ - - ">="
193
196
  - !ruby/object:Gem::Version
194
197
  version: '6.1'
198
+ - - "<"
199
+ - !ruby/object:Gem::Version
200
+ version: '7.1'
195
201
  - !ruby/object:Gem::Dependency
196
202
  name: gitlab
197
203
  requirement: !ruby/object:Gem::Requirement
198
204
  requirements:
199
205
  - - "~>"
200
206
  - !ruby/object:Gem::Version
201
- version: 4.18.0
207
+ version: '4.19'
202
208
  type: :runtime
203
209
  prerelease: false
204
210
  version_requirements: !ruby/object:Gem::Requirement
205
211
  requirements:
206
212
  - - "~>"
207
213
  - !ruby/object:Gem::Version
208
- version: 4.18.0
214
+ version: '4.19'
209
215
  - !ruby/object:Gem::Dependency
210
216
  name: http
211
217
  requirement: !ruby/object:Gem::Requirement
@@ -313,13 +319,13 @@ email:
313
319
  - gitlab-qa@gmail.com
314
320
  executables:
315
321
  - gitlab-qa
316
- - gitlab-qa-report
317
322
  extensions: []
318
323
  extra_rdoc_files: []
319
324
  files:
320
325
  - ".dockerignore"
321
326
  - ".gitignore"
322
327
  - ".gitlab-ci.yml"
328
+ - ".gitlab/changelog_config.yml"
323
329
  - ".gitlab/issue_templates/Default.md"
324
330
  - ".gitlab/merge_request_templates/Default.md"
325
331
  - ".gitlab/merge_request_templates/Release.md"
@@ -339,7 +345,6 @@ files:
339
345
  - bin/gen-cert.sh
340
346
  - bin/merge_html_reports
341
347
  - bin/setup
342
- - bin/slack
343
348
  - docs/README.md
344
349
  - docs/architecture.md
345
350
  - docs/configuring_omnibus.md
@@ -355,7 +360,6 @@ files:
355
360
  - docs/waits.md
356
361
  - docs/what_tests_can_be_run.md
357
362
  - exe/gitlab-qa
358
- - exe/gitlab-qa-report
359
363
  - fixtures/ldap/1_add_nodes.ldif
360
364
  - fixtures/ldap/2_add_users.ldif
361
365
  - fixtures/ldap/3_add_groups.ldif
@@ -393,24 +397,6 @@ files:
393
397
  - lib/gitlab/qa/docker/engine.rb
394
398
  - lib/gitlab/qa/docker/volumes.rb
395
399
  - lib/gitlab/qa/release.rb
396
- - lib/gitlab/qa/report/base_test_results.rb
397
- - lib/gitlab/qa/report/find_set_dri.rb
398
- - lib/gitlab/qa/report/generate_test_session.rb
399
- - lib/gitlab/qa/report/gitlab_issue_client.rb
400
- - lib/gitlab/qa/report/gitlab_issue_dry_client.rb
401
- - lib/gitlab/qa/report/j_unit_test_results.rb
402
- - lib/gitlab/qa/report/json_test_results.rb
403
- - lib/gitlab/qa/report/prepare_stage_reports.rb
404
- - lib/gitlab/qa/report/relate_failure_issue.rb
405
- - lib/gitlab/qa/report/report_as_issue.rb
406
- - lib/gitlab/qa/report/report_results.rb
407
- - lib/gitlab/qa/report/results_in_issues.rb
408
- - lib/gitlab/qa/report/results_in_testcases.rb
409
- - lib/gitlab/qa/report/results_reporter_shared.rb
410
- - lib/gitlab/qa/report/summary_table.rb
411
- - lib/gitlab/qa/report/test_result.rb
412
- - lib/gitlab/qa/report/update_screenshot_path.rb
413
- - lib/gitlab/qa/reporter.rb
414
400
  - lib/gitlab/qa/runner.rb
415
401
  - lib/gitlab/qa/runtime/env.rb
416
402
  - lib/gitlab/qa/runtime/logger.rb
@@ -421,10 +407,8 @@ files:
421
407
  - lib/gitlab/qa/runtime/omnibus_configurations/object_storage.rb
422
408
  - lib/gitlab/qa/runtime/omnibus_configurations/object_storage_aws.rb
423
409
  - lib/gitlab/qa/runtime/omnibus_configurations/object_storage_gcs.rb
424
- - lib/gitlab/qa/runtime/omnibus_configurations/packages.rb
425
410
  - lib/gitlab/qa/runtime/omnibus_configurations/registry_object_storage.rb
426
411
  - lib/gitlab/qa/runtime/scenario.rb
427
- - lib/gitlab/qa/runtime/token_finder.rb
428
412
  - lib/gitlab/qa/scenario/actable.rb
429
413
  - lib/gitlab/qa/scenario/cli_commands.rb
430
414
  - lib/gitlab/qa/scenario/template.rb
@@ -478,7 +462,6 @@ files:
478
462
  - lib/gitlab/qa/service/cluster_provider/base.rb
479
463
  - lib/gitlab/qa/service/cluster_provider/k3d.rb
480
464
  - lib/gitlab/qa/service/kubernetes_cluster.rb
481
- - lib/gitlab/qa/slack/post_to_slack.rb
482
465
  - lib/gitlab/qa/support/config_scripts.rb
483
466
  - lib/gitlab/qa/support/get_request.rb
484
467
  - lib/gitlab/qa/support/gitlab_upgrade_path.rb
@@ -487,18 +470,6 @@ files:
487
470
  - lib/gitlab/qa/support/invalid_response_error.rb
488
471
  - lib/gitlab/qa/support/shell_command.rb
489
472
  - lib/gitlab/qa/support/shellout.rb
490
- - lib/gitlab/qa/system_logs/finders/json_log_finder.rb
491
- - lib/gitlab/qa/system_logs/finders/rails/api_log_finder.rb
492
- - lib/gitlab/qa/system_logs/finders/rails/application_log_finder.rb
493
- - lib/gitlab/qa/system_logs/finders/rails/exception_log_finder.rb
494
- - lib/gitlab/qa/system_logs/finders/rails/graphql_log_finder.rb
495
- - lib/gitlab/qa/system_logs/log_types/log.rb
496
- - lib/gitlab/qa/system_logs/log_types/rails/api_log.rb
497
- - lib/gitlab/qa/system_logs/log_types/rails/application_log.rb
498
- - lib/gitlab/qa/system_logs/log_types/rails/exception_log.rb
499
- - lib/gitlab/qa/system_logs/log_types/rails/graphql_log.rb
500
- - lib/gitlab/qa/system_logs/shared_fields.rb
501
- - lib/gitlab/qa/system_logs/system_logs_formatter.rb
502
473
  - lib/gitlab/qa/test_logger.rb
503
474
  - lib/gitlab/qa/version.rb
504
475
  - scripts/build-package-and-test-env
@@ -534,7 +505,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
534
505
  requirements:
535
506
  - - ">="
536
507
  - !ruby/object:Gem::Version
537
- version: '0'
508
+ version: 3.0.0
538
509
  required_rubygems_version: !ruby/object:Gem::Requirement
539
510
  requirements:
540
511
  - - ">="
data/bin/slack DELETED
@@ -1,14 +0,0 @@
1
- #!/bin/bash
2
- # Sends Slack notification MSG to CI_SLACK_WEBHOOK_URL (which needs to be set).
3
- # ICON_EMOJI needs to be set to an icon emoji name (without the `:` around it).
4
-
5
- CHANNEL=$1
6
- MSG=$2
7
- ICON_EMOJI=$3
8
-
9
- if [ -z "$CHANNEL" ] || [ -z "$CI_SLACK_WEBHOOK_URL" ] || [ -z "$MSG" ] || [ -z "$ICON_EMOJI" ]; then
10
- echo "Missing argument(s) - Use: $0 channel message icon_emoji"
11
- echo "and set CI_SLACK_WEBHOOK_URL environment variable."
12
- else
13
- curl -X POST --data-urlencode 'payload={"channel": "#'"$CHANNEL"'", "username": "GitLab QA Bot", "text": "'"$MSG"'", "icon_emoji": "'":$ICON_EMOJI:"'"}' "$CI_SLACK_WEBHOOK_URL"
14
- fi
data/exe/gitlab-qa-report DELETED
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- lib = File.expand_path('../lib', __dir__)
5
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
6
-
7
- require 'bundler/setup'
8
- require 'gitlab/qa'
9
-
10
- Gitlab::QA::Reporter.invoke(ARGV)
@@ -1,39 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Gitlab
4
- module QA
5
- module Report
6
- class BaseTestResults
7
- include Enumerable
8
-
9
- attr_reader :path
10
-
11
- def initialize(path)
12
- @path = path
13
- @results = parse
14
- @testcases = process
15
- end
16
-
17
- def each(&block)
18
- testcases.each(&block)
19
- end
20
-
21
- def write
22
- raise NotImplementedError
23
- end
24
-
25
- private
26
-
27
- attr_reader :results, :testcases
28
-
29
- def parse
30
- raise NotImplementedError
31
- end
32
-
33
- def process
34
- raise NotImplementedError
35
- end
36
- end
37
- end
38
- end
39
- end
@@ -1,43 +0,0 @@
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