gitlab-qa 7.24.2 → 7.24.5

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: 862c31bca6760f872b719b43ff2acc508f5155af1ad8a8763ff9acec9097629f
4
- data.tar.gz: fb705f83636c4702e7f307b5fa445146227bd81525f6bce14dcd82e1da225a2d
3
+ metadata.gz: 68f574050bbfc1f6ede0a0bb9f87b5e5c1e8f5403739f56294cae2fb1e60fccc
4
+ data.tar.gz: 57a53ed8a9e1f1071a38bfb96ad46ed13fd566023ac9460751f0dc3da4874291
5
5
  SHA512:
6
- metadata.gz: edd01e95ac436a768eaf06b6b84ef19b9e07a95067a8e48244cc96450168606741cd75c111517209a4a8c3d58ca41883684b76ad974426fae5b345fbdd15f8dc
7
- data.tar.gz: d49d870521be04c0a729841c9bc51d6610049eac7df2274ff7f87d18cefe4f98bebede511982bd819e618c664b102578ddc152249ff1e3ad1f8e8db5717bec95
6
+ metadata.gz: da89e0ab1a89cefa915d6b734867a78fd6d8e66725d9ba75dac1eeae8faa007cf7fd8fe97372a5f5919a08a8cc482694cc2d9eab25083fc5502d26c3425e082e
7
+ data.tar.gz: a293a8034877b7f64718e18969809e25dac26943667aafed41e93a433677369ee956707d447234c3d75d5112011d9423a9f4f46102ad4817f833122004d3f560
@@ -0,0 +1,13 @@
1
+ <!--
2
+ Before raising an issue to the GitLab issue tracker, please read through our guide for finding help to determine the best place to post:
3
+
4
+ * https://about.gitlab.com/getting-help/
5
+
6
+ If you are experiencing an issue when using GitLab.com, your first port of call should be the Community Forum. Your issue may have already been reported there by another user. Please check:
7
+
8
+ * https://forum.gitlab.com/
9
+
10
+ If you feel that your issue can be categorized as a reproducible bug or a feature proposal, please use one of the issue templates provided and include as much information as possible.
11
+
12
+ Thank you for helping to make GitLab a better product.
13
+ -->
@@ -0,0 +1,46 @@
1
+ ## What does this MR do and why?
2
+
3
+ _Describe in detail what your merge request does and why._
4
+
5
+ <!--
6
+ Please keep this description updated with any discussion that takes place so
7
+ that reviewers can understand your intent. Keeping the description updated is
8
+ especially important if they didn't participate in the discussion.
9
+ -->
10
+
11
+ ## Screenshots or screen recordings
12
+
13
+ _These are strongly recommended to assist reviewers and reduce the time to merge your change._
14
+
15
+ <!--
16
+ Please include any relevant screenshots or screen recordings that will assist
17
+ reviewers and future readers. If you need help visually verifying the change,
18
+ please leave a comment and ping a GitLab reviewer, maintainer, or MR coach.
19
+ -->
20
+
21
+ ## How to set up and validate locally
22
+
23
+ _Numbered steps to set up and validate the change are strongly suggested._
24
+
25
+ <!--
26
+ Example below:
27
+
28
+ 1. Enable the invite modal
29
+ ```ruby
30
+ Feature.enable(:invite_members_group_modal)
31
+ ```
32
+ 1. In rails console enable the experiment fully
33
+ ```ruby
34
+ Feature.enable(:member_areas_of_focus)
35
+ ```
36
+ 1. Visit any group or project member pages such as `http://127.0.0.1:3000/groups/flightjs/-/group_members`
37
+ 1. Click the `invite members` button.
38
+ -->
39
+
40
+ ## MR acceptance checklist
41
+
42
+ This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
43
+
44
+ * [ ] I have evaluated the [MR acceptance checklist](https://docs.gitlab.com/ee/development/code_review.html#acceptance-checklist) for this MR.
45
+
46
+ /label ~QA ~Quality
data/gitlab-qa.gemspec CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.require_paths = ['lib']
22
22
 
23
23
  spec.add_development_dependency 'climate_control', '~> 1.0.1'
24
- spec.add_development_dependency 'gitlab-dangerfiles', '~> 2.10'
24
+ spec.add_development_dependency 'gitlab-dangerfiles', '~> 2.11'
25
25
  spec.add_development_dependency 'gitlab-styles', '~> 6.2.1'
26
26
  spec.add_development_dependency 'pry', '~> 0.11'
27
27
  spec.add_development_dependency 'rake', '~> 13.0'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  module QA
3
5
  module Component
@@ -18,9 +18,7 @@ module Gitlab
18
18
 
19
19
  def_delegators :release, :tag, :image, :edition
20
20
 
21
- AUTHORITY_CERTIFICATES_PATH = File.expand_path('../../../../tls_certificates/authority', __dir__)
22
- GITLAB_CERTIFICATES_PATH = File.expand_path('../../../../tls_certificates/gitlab', __dir__)
23
- GITALY_CERTIFICATES_PATH = File.expand_path('../../../../tls_certificates/gitaly', __dir__)
21
+ CERTIFICATES_PATH = File.expand_path('../../../../tls_certificates', __dir__)
24
22
 
25
23
  SSL_PATH = '/etc/gitlab/ssl'
26
24
  TRUSTED_PATH = '/etc/gitlab/trusted-certs'
@@ -31,10 +29,15 @@ module Gitlab
31
29
  @skip_availability_check = false
32
30
  @omnibus_gitlab_rails_env = {}
33
31
 
34
- @volumes[GITLAB_CERTIFICATES_PATH] = SSL_PATH
35
- @volumes[AUTHORITY_CERTIFICATES_PATH] = TRUSTED_PATH
32
+ @omnibus_configuration = Runtime::OmnibusConfiguration.new(Runtime::Scenario.omnibus_configuration)
36
33
 
37
- @omnibus_configuration ||= Runtime::OmnibusConfiguration.new(Runtime::Scenario.omnibus_configuration)
34
+ @working_dir_tmp_cert_path = Dir.mktmpdir('certs', FileUtils.mkdir_p("#{Dir.pwd}/tmp"))
35
+ @authority_cert_path = "#{@working_dir_tmp_cert_path}/authority"
36
+ @gitlab_cert_path = "#{@working_dir_tmp_cert_path}/gitlab"
37
+ @gitaly_cert_path = "#{@working_dir_tmp_cert_path}/gitaly"
38
+
39
+ @volumes[@gitlab_cert_path] = SSL_PATH
40
+ @volumes[@authority_cert_path] = TRUSTED_PATH
38
41
 
39
42
  self.release = 'CE'
40
43
  end
@@ -77,8 +80,8 @@ module Gitlab
77
80
  end
78
81
 
79
82
  def gitaly_tls
80
- @volumes.delete(GITLAB_CERTIFICATES_PATH)
81
- @volumes[GITALY_CERTIFICATES_PATH] = SSL_PATH
83
+ @volumes.delete(@gitlab_cert_path)
84
+ @volumes[@gitaly_cert_path] = SSL_PATH
82
85
  end
83
86
 
84
87
  def relative_path
@@ -91,6 +94,13 @@ module Gitlab
91
94
 
92
95
  def prepare
93
96
  prepare_gitlab_omnibus_config
97
+ copy_certificates
98
+
99
+ super
100
+ end
101
+
102
+ def teardown!
103
+ FileUtils.rm_rf(@working_dir_tmp_cert_path)
94
104
 
95
105
  super
96
106
  end
@@ -168,6 +178,14 @@ module Gitlab
168
178
 
169
179
  private
170
180
 
181
+ # Copy certs to a temporary directory in current working directory.
182
+ # This is needed for docker-in-docker ci environments where mount points outside of build dir are not accessible
183
+ #
184
+ # @return [void]
185
+ def copy_certificates
186
+ FileUtils.cp_r("#{CERTIFICATES_PATH}/.", @working_dir_tmp_cert_path)
187
+ end
188
+
171
189
  def ensure_configured!
172
190
  raise 'Please configure an instance first!' unless [name, release, network].all?
173
191
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'securerandom'
2
4
 
3
5
  # This component sets up the docker-openldap (https://github.com/osixia/docker-openldap)
@@ -16,18 +18,12 @@ module Gitlab
16
18
  module QA
17
19
  module Component
18
20
  class LDAP < Base
19
- DOCKER_IMAGE = 'osixia/openldap'.freeze
20
- DOCKER_IMAGE_TAG = 'latest'.freeze
21
- LDAP_USER = 'tanuki'.freeze
22
- LDAP_PASSWORD = 'password'.freeze
23
- BOOTSTRAP_LDIF = '/container/service/slapd/assets/config/bootstrap/ldif/custom'.freeze
24
- FIXTURE_PATH = File.expand_path('../../../../fixtures/ldap'.freeze, __dir__)
25
-
26
- def initialize
27
- super
28
-
29
- @volumes[FIXTURE_PATH] = BOOTSTRAP_LDIF
30
- end
21
+ DOCKER_IMAGE = 'osixia/openldap'
22
+ DOCKER_IMAGE_TAG = 'latest'
23
+ LDAP_USER = 'tanuki'
24
+ LDAP_PASSWORD = 'password'
25
+ BOOTSTRAP_LDIF = '/container/service/slapd/assets/config/bootstrap/ldif/custom'
26
+ FIXTURE_PATH = File.expand_path('../../../../fixtures/ldap', __dir__)
31
27
 
32
28
  # LDAP_TLS is true by default
33
29
  def tls=(status)
@@ -59,6 +55,19 @@ module Gitlab
59
55
  super
60
56
  end
61
57
 
58
+ def prepare
59
+ copy_fixtures
60
+ @volumes["#{working_dir_tmp_fixture_path}/ldap"] = BOOTSTRAP_LDIF
61
+
62
+ super
63
+ end
64
+
65
+ def teardown!
66
+ FileUtils.rm_rf(working_dir_tmp_fixture_path)
67
+
68
+ super
69
+ end
70
+
62
71
  # rubocop:disable Metrics/AbcSize
63
72
  def start
64
73
  # copy-service needed for bootstraping LDAP user:
@@ -88,6 +97,23 @@ module Gitlab
88
97
  ::Gitlab::QA::Runtime::Env.ldap_username = username
89
98
  ::Gitlab::QA::Runtime::Env.ldap_password = password
90
99
  end
100
+
101
+ private
102
+
103
+ # Temporary fixture dir in working directory
104
+ #
105
+ # @return [String]
106
+ def working_dir_tmp_fixture_path
107
+ @local_fixture_path ||= Dir.mktmpdir('ldap', FileUtils.mkdir_p("#{Dir.pwd}/tmp"))
108
+ end
109
+
110
+ # Copy fixtures to current working directory
111
+ # This is needed for docker-in-docker ci environments where mount points outside of build dir are not accessible
112
+ #
113
+ # @return [void]
114
+ def copy_fixtures
115
+ FileUtils.cp_r(FIXTURE_PATH, working_dir_tmp_fixture_path)
116
+ end
91
117
  end
92
118
  end
93
119
  end
@@ -77,12 +77,24 @@ module Gitlab
77
77
  end
78
78
  end
79
79
 
80
+ def find_issue_notes(iid:)
81
+ handle_gitlab_client_exceptions do
82
+ Gitlab.issue_notes(project, iid, order_by: 'created_at', sort: 'asc').auto_paginate
83
+ end
84
+ end
85
+
80
86
  def create_issue_note(iid:, note:)
81
87
  handle_gitlab_client_exceptions do
82
88
  Gitlab.create_issue_note(project, iid, note)
83
89
  end
84
90
  end
85
91
 
92
+ def edit_issue_note(issue_iid:, note_id:, note:)
93
+ handle_gitlab_client_exceptions do
94
+ Gitlab.edit_issue_note(project, issue_iid, note_id, note)
95
+ end
96
+ end
97
+
86
98
  def add_note_to_issue_discussion_as_thread(iid:, discussion_id:, body:)
87
99
  handle_gitlab_client_exceptions do
88
100
  Gitlab.add_note_to_issue_discussion_as_thread(project, iid, discussion_id, body: body)
@@ -61,7 +61,7 @@ module Gitlab
61
61
 
62
62
  if issue
63
63
  puts " => Found issue #{issue.web_url} for test '#{test.name}' with a diff ratio of #{(diff_ratio * 100).round(2)}%."
64
- @commented_issue_list.include?(issue.web_url) ? (puts " => Failure already commented on issue.") : post_failed_job_note(issue, test)
64
+ @commented_issue_list.include?(issue.web_url) ? (puts " => Failure already commented on issue.") : post_or_update_failed_job_note(issue, test)
65
65
  @commented_issue_list.add(issue.web_url)
66
66
  end
67
67
 
@@ -164,14 +164,30 @@ module Gitlab
164
164
  super << pipeline_name_label
165
165
  end
166
166
 
167
- def post_failed_job_note(issue, test)
168
- gitlab.create_issue_note(iid: issue.iid, note: "Failure occurred in #{pipeline} pipeline: #{test.ci_job_url}")
167
+ def post_or_update_failed_job_note(issue, test)
168
+ current_note = "Failed most recently in #{pipeline} pipeline: #{test.ci_job_url}"
169
+ existing_note = existing_failure_note(issue)
170
+
171
+ if existing_note
172
+ gitlab.edit_issue_note(issue_iid: issue.iid, note_id: existing_note.id, note: current_note)
173
+ else
174
+ gitlab.create_issue_note(iid: issue.iid, note: current_note)
175
+ end
176
+
169
177
  puts " => Linked #{test.ci_job_url} to #{issue.web_url}."
170
178
  end
171
179
 
172
180
  def new_issue_title(test)
173
181
  "Failure in #{super}"
174
182
  end
183
+
184
+ def existing_failure_note(issue)
185
+ gitlab.find_issue_notes(iid: issue.iid).each do |note|
186
+ return note if note.body.include?('Failed most recently in')
187
+ end
188
+
189
+ false
190
+ end
175
191
  end
176
192
  end
177
193
  end
@@ -106,8 +106,14 @@ module Gitlab
106
106
  def up_to_date_labels(test:, issue: nil, new_labels: Set.new)
107
107
  labels = issue_labels(issue)
108
108
  labels |= new_labels
109
- ee_test?(test) ? labels << "Enterprise Edition" : labels.delete("Enterprise Edition")
110
- quarantine_job? ? labels << "quarantine" : labels.delete("quarantine")
109
+ ee_test?(test) ? labels << 'Enterprise Edition' : labels.delete('Enterprise Edition')
110
+
111
+ if test.quarantine?
112
+ labels << 'quarantine'
113
+ labels << "quarantine::#{test.quarantine_type}"
114
+ else
115
+ labels.delete_if { |label| label.include?('quarantine') }
116
+ end
111
117
 
112
118
  labels
113
119
  end
@@ -133,10 +139,6 @@ module Gitlab
133
139
  test.file =~ %r{features/ee/(api|browser_ui)}
134
140
  end
135
141
 
136
- def quarantine_job?
137
- Runtime::Env.ci_job_name&.include?('quarantine')
138
- end
139
-
140
142
  def partial_file_path(path)
141
143
  path.match(/((api|browser_ui).*)/i)[1]
142
144
  end
@@ -100,7 +100,6 @@ module Gitlab
100
100
 
101
101
  def failure_summary
102
102
  summary = [":x: ~\"#{pipeline}::failed\""]
103
- summary << "~\"quarantine\"" if quarantine_job?
104
103
  summary << "in job `#{Runtime::Env.ci_job_name}` in #{Runtime::Env.ci_job_url}"
105
104
  summary.join(' ')
106
105
  end
@@ -30,6 +30,7 @@ module Gitlab
30
30
 
31
31
  def update_testcase(testcase, test)
32
32
  puts "Test case labels updated." if update_labels(testcase, test)
33
+ puts "Test case quarantine section updated." if update_quarantine_link(testcase, test)
33
34
  end
34
35
 
35
36
  private
@@ -61,7 +62,9 @@ module Gitlab
61
62
  end
62
63
 
63
64
  def new_issue_description(test)
64
- "#{super}\n\n#{execution_graph_section(test)}"
65
+ quarantine_section = test.quarantine? && test.quarantine_issue ? "\n\n### Quarantine issue\n\n#{test.quarantine_issue}" : ''
66
+
67
+ "#{super}#{quarantine_section}\n\n#{execution_graph_section(test)}"
65
68
  end
66
69
 
67
70
  def execution_graph_section(test)
@@ -84,6 +87,24 @@ module Gitlab
84
87
  def issue_title_needs_updating?(testcase, test)
85
88
  super || !testcase.description.include?(execution_graph_section(test)) && !%w[canary production preprod release].include?(pipeline)
86
89
  end
90
+
91
+ def quarantine_link_needs_updating?(testcase, test)
92
+ if test.quarantine? && test.quarantine_issue
93
+ return false if testcase.description.include?(test.quarantine_issue)
94
+ else
95
+ return false unless testcase.description.include?('Quarantine issue')
96
+ end
97
+
98
+ true
99
+ end
100
+
101
+ def update_quarantine_link(testcase, test)
102
+ return unless quarantine_link_needs_updating?(testcase, test)
103
+
104
+ new_description = updated_description(testcase, test)
105
+
106
+ gitlab.edit_issue(iid: testcase.iid, options: { description: new_description })
107
+ end
87
108
  end
88
109
  end
89
110
  end
@@ -87,6 +87,14 @@ module Gitlab
87
87
  report['quarantine'].present?
88
88
  end
89
89
 
90
+ def quarantine_type
91
+ report['quarantine']['type'] if quarantine?
92
+ end
93
+
94
+ def quarantine_issue
95
+ report['quarantine']['issue'] if quarantine?
96
+ end
97
+
90
98
  private
91
99
 
92
100
  # rubocop:disable Metrics/AbcSize
@@ -1,34 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'logger'
4
3
  require 'forwardable'
5
- require'rainbow/refinement'
6
4
 
7
5
  module Gitlab
8
6
  module QA
9
7
  module Runtime
10
- module Logger
8
+ class Logger
11
9
  extend SingleForwardable
12
- using Rainbow
13
10
 
14
11
  def_delegators :logger, :debug, :info, :warn, :error, :fatal, :unknown
15
12
 
16
- singleton_class.module_eval do
17
- attr_writer :logger
18
-
19
- def logger
20
- Rainbow.enabled = Runtime::Env.colorized_logs?
21
-
22
- @logger ||= ::Logger.new($stdout).tap do |logger|
23
- logger.level = Runtime::Env.debug? ? ::Logger::DEBUG : ::Logger::INFO
24
-
25
- logger.formatter = proc do |severity, datetime, progname, msg|
26
- date_format = datetime.strftime("%Y-%m-%d %H:%M:%S")
27
-
28
- "[date=#{date_format} from=GitLab QA] #{severity.ljust(5)}-- ".yellow + "#{msg}\n"
29
- end
30
- end
31
- end
13
+ def self.logger
14
+ @logger ||= QA::TestLogger.logger(level: Runtime::Env.debug? ? ::Logger::DEBUG : ::Logger::INFO)
32
15
  end
33
16
  end
34
17
  end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'logger'
4
+ require 'rainbow'
5
+
6
+ module Gitlab
7
+ module QA
8
+ # Common test logger implementation
9
+ #
10
+ class TestLogger
11
+ LEVEL_COLORS = {
12
+ "DEBUG" => :magenta,
13
+ "INFO" => :green,
14
+ "WARN" => :yellow,
15
+ "ERROR" => :red,
16
+ "FATAL" => :indianred
17
+ }.freeze
18
+
19
+ Rainbow.enabled = Runtime::Env.colorized_logs?
20
+
21
+ def self.logger(level: ::Logger::INFO, source: 'Gitlab QA')
22
+ ::Logger.new($stdout).tap do |logger|
23
+ logger.level = level
24
+
25
+ logger.formatter = proc do |severity, datetime, progname, msg|
26
+ date_format = datetime.strftime("%Y-%m-%d %H:%M:%S")
27
+ msg_prefix = "[date=#{date_format} from=#{source}] #{severity.ljust(5)} -- "
28
+
29
+ Rainbow(msg_prefix).public_send(LEVEL_COLORS.fetch(severity, :silver)) + "#{msg}\n" # rubocop:disable GitlabSecurity/PublicSend
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Gitlab
4
4
  module QA
5
- VERSION = '7.24.2'
5
+ VERSION = '7.24.5'
6
6
  end
7
7
  end
data/lib/gitlab/qa.rb CHANGED
@@ -3,6 +3,7 @@ module Gitlab
3
3
  autoload :Release, 'gitlab/qa/release'
4
4
  autoload :Reporter, 'gitlab/qa/reporter'
5
5
  autoload :Runner, 'gitlab/qa/runner'
6
+ autoload :TestLogger, 'gitlab/qa/test_logger'
6
7
 
7
8
  module Runtime
8
9
  autoload :Env, 'gitlab/qa/runtime/env'
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: 7.24.2
4
+ version: 7.24.5
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-03-03 00:00:00.000000000 Z
11
+ date: 2022-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: climate_control
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '2.10'
33
+ version: '2.11'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '2.10'
40
+ version: '2.11'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: gitlab-styles
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -220,6 +220,8 @@ files:
220
220
  - ".gitlab-ci.yml"
221
221
  - ".gitlab/ci/danger.gitlab-ci.yml"
222
222
  - ".gitlab/ci/rules.gitlab-ci.yml"
223
+ - ".gitlab/issue_templates/Default.md"
224
+ - ".gitlab/merge_request_templates/Default.md"
223
225
  - ".gitlab/merge_request_templates/Release.md"
224
226
  - ".rspec"
225
227
  - ".rubocop.yml"
@@ -356,6 +358,7 @@ files:
356
358
  - lib/gitlab/qa/support/get_request.rb
357
359
  - lib/gitlab/qa/support/http_request.rb
358
360
  - lib/gitlab/qa/support/invalid_response_error.rb
361
+ - lib/gitlab/qa/test_logger.rb
359
362
  - lib/gitlab/qa/version.rb
360
363
  - tls_certificates/authority/ca.crt
361
364
  - tls_certificates/authority/ca.key