gitlab-qa 7.27.2 → 7.29.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: 888a15b623b94cf6a072af7edf18d11952ff971a661d1fd4d154b28a627c9509
4
- data.tar.gz: c5e6cb25a0ecda8f4237186249ec44b246254df78b26e1372569500c00901c6c
3
+ metadata.gz: 8d4ca3feba042298fe467133b5f576653b553af61ac01a0b72a1a970917e3711
4
+ data.tar.gz: 61ee29dbe4355bcbc18d8e164b97f1453c461419fcf6bd70543a659e5029d333
5
5
  SHA512:
6
- metadata.gz: 17a2b9f2863cf42a36f5e72e39a90b17ad00367be81ec2f5e61b35299086e470f227d46c5e1b186abb52c49bab82d6289010a0e4e1410f74d51e779a1cfadec0
7
- data.tar.gz: cfb21124fbd588d157ce8f93fb83300fdb521ddfbfde2e1fd4853aa966cf418075607496671aa5a739656d33acead7524e607076945b305279fa4db94d61a80c
6
+ metadata.gz: 5ddff780b5188c489bec89ce0b475096ac707f9e2e5138cc400efeef9fbd576b4c5bebc77f43af207109503e08e1c1efaf2813e3666bd9d88d5807f7c9691891
7
+ data.tar.gz: 34b7eacbd20c81f264aaf478f35e9ed78d5c7e185b18178bd55fa1c5fc37b0053f54bd49027d994cf91d6d69120c3371fdb818727419c17ef10ea7f373a4c91d
data/.gitignore CHANGED
@@ -1,12 +1,10 @@
1
1
  /.bundle/
2
2
  /.yardoc
3
- /Gemfile.lock
4
3
  /_yardoc/
5
4
  /coverage/
6
5
  /doc/
7
6
  /pkg/
8
7
  /spec/reports/
9
- /tmp/
10
8
  /.idea
11
9
  .ruby-version
12
10
  .ruby-gemset
@@ -10,7 +10,6 @@ ce:ci_decomposition:
10
10
  parallel: 5
11
11
  variables:
12
12
  GITLAB_QA_OPTIONS_COMBINED: "$GITLAB_QA_OPTIONS --omnibus-config ci_decomposition"
13
- allow_failure: true # https://gitlab.com/gitlab-org/quality/team-tasks/-/issues/1329
14
13
 
15
14
  ee:ci_decomposition:
16
15
  extends:
@@ -24,4 +23,3 @@ ee:ci_decomposition:
24
23
  parallel: 5
25
24
  variables:
26
25
  GITLAB_QA_OPTIONS_COMBINED: "$GITLAB_QA_OPTIONS --omnibus-config ci_decomposition"
27
- allow_failure: true # https://gitlab.com/gitlab-org/quality/team-tasks/-/issues/1329
@@ -7,7 +7,6 @@ ce:gitaly-cluster:
7
7
  - .rspec-report-opts
8
8
  variables:
9
9
  QA_SCENARIO: "Test::Integration::GitalyCluster"
10
- QA_LOG_PATH: "tmp/gitaly_cluster.log"
11
10
 
12
11
  ce:gitaly-cluster-quarantine:
13
12
  extends:
@@ -19,7 +18,6 @@ ce:gitaly-cluster-quarantine:
19
18
  - .rspec-report-opts
20
19
  variables:
21
20
  QA_SCENARIO: "Test::Integration::GitalyCluster"
22
- QA_LOG_PATH: "tmp/gitaly_cluster.log"
23
21
 
24
22
  ee:gitaly-cluster:
25
23
  extends:
@@ -30,7 +28,6 @@ ee:gitaly-cluster:
30
28
  - .rspec-report-opts
31
29
  variables:
32
30
  QA_SCENARIO: "Test::Integration::GitalyCluster"
33
- QA_LOG_PATH: "tmp/gitaly_cluster.log"
34
31
 
35
32
  ee:gitaly-cluster-quarantine:
36
33
  extends:
@@ -42,4 +39,3 @@ ee:gitaly-cluster-quarantine:
42
39
  - .rspec-report-opts
43
40
  variables:
44
41
  QA_SCENARIO: "Test::Integration::GitalyCluster"
45
- QA_LOG_PATH: "tmp/gitaly_cluster.log"
data/Gemfile.lock ADDED
@@ -0,0 +1,248 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ gitlab-qa (7.29.0)
5
+ activesupport (~> 6.1)
6
+ gitlab (~> 4.18.0)
7
+ http (~> 5.0)
8
+ nokogiri (~> 1.10)
9
+ rainbow (~> 3.0.0)
10
+ table_print (= 1.5.7)
11
+
12
+ GEM
13
+ remote: https://rubygems.org/
14
+ specs:
15
+ activesupport (6.1.6)
16
+ concurrent-ruby (~> 1.0, >= 1.0.2)
17
+ i18n (>= 1.6, < 2)
18
+ minitest (>= 5.1)
19
+ tzinfo (~> 2.0)
20
+ zeitwerk (~> 2.3)
21
+ addressable (2.8.0)
22
+ public_suffix (>= 2.0.2, < 5.0)
23
+ ast (2.4.2)
24
+ backport (1.2.0)
25
+ benchmark (0.2.0)
26
+ claide (1.1.0)
27
+ claide-plugins (0.9.2)
28
+ cork
29
+ nap
30
+ open4 (~> 1.3)
31
+ climate_control (1.0.1)
32
+ coderay (1.1.3)
33
+ colored2 (3.1.2)
34
+ concurrent-ruby (1.1.10)
35
+ cork (0.3.0)
36
+ colored2 (~> 3.1)
37
+ crack (0.4.5)
38
+ rexml
39
+ danger (8.6.1)
40
+ claide (~> 1.0)
41
+ claide-plugins (>= 0.9.2)
42
+ colored2 (~> 3.1)
43
+ cork (~> 0.1)
44
+ faraday (>= 0.9.0, < 2.0)
45
+ faraday-http-cache (~> 2.0)
46
+ git (~> 1.7)
47
+ kramdown (~> 2.3)
48
+ kramdown-parser-gfm (~> 1.0)
49
+ no_proxy_fix
50
+ octokit (~> 4.7)
51
+ terminal-table (>= 1, < 4)
52
+ danger-gitlab (8.0.0)
53
+ danger
54
+ gitlab (~> 4.2, >= 4.2.0)
55
+ diff-lcs (1.5.0)
56
+ domain_name (0.5.20190701)
57
+ unf (>= 0.0.5, < 1.0.0)
58
+ e2mmap (0.1.0)
59
+ faraday (1.10.0)
60
+ faraday-em_http (~> 1.0)
61
+ faraday-em_synchrony (~> 1.0)
62
+ faraday-excon (~> 1.1)
63
+ faraday-httpclient (~> 1.0)
64
+ faraday-multipart (~> 1.0)
65
+ faraday-net_http (~> 1.0)
66
+ faraday-net_http_persistent (~> 1.0)
67
+ faraday-patron (~> 1.0)
68
+ faraday-rack (~> 1.0)
69
+ faraday-retry (~> 1.0)
70
+ ruby2_keywords (>= 0.0.4)
71
+ faraday-em_http (1.0.0)
72
+ faraday-em_synchrony (1.0.0)
73
+ faraday-excon (1.1.0)
74
+ faraday-http-cache (2.2.0)
75
+ faraday (>= 0.8)
76
+ faraday-httpclient (1.0.1)
77
+ faraday-multipart (1.0.3)
78
+ multipart-post (>= 1.2, < 3)
79
+ faraday-net_http (1.0.1)
80
+ faraday-net_http_persistent (1.2.0)
81
+ faraday-patron (1.0.0)
82
+ faraday-rack (1.0.0)
83
+ faraday-retry (1.0.3)
84
+ ffi (1.15.5)
85
+ ffi-compiler (1.0.1)
86
+ ffi (>= 1.0.0)
87
+ rake
88
+ git (1.11.0)
89
+ rchardet (~> 1.8)
90
+ gitlab (4.18.0)
91
+ httparty (~> 0.18)
92
+ terminal-table (>= 1.5.1)
93
+ gitlab-dangerfiles (2.11.0)
94
+ danger (>= 8.4.5)
95
+ danger-gitlab (>= 8.0.0)
96
+ gitlab-styles (6.2.1)
97
+ rubocop (~> 0.91, >= 0.91.1)
98
+ rubocop-gitlab-security (~> 0.1.1)
99
+ rubocop-performance (~> 1.9.2)
100
+ rubocop-rails (~> 2.9)
101
+ rubocop-rspec (~> 1.44)
102
+ hashdiff (1.0.1)
103
+ http (5.0.4)
104
+ addressable (~> 2.8)
105
+ http-cookie (~> 1.0)
106
+ http-form_data (~> 2.2)
107
+ llhttp-ffi (~> 0.4.0)
108
+ http-cookie (1.0.5)
109
+ domain_name (~> 0.5)
110
+ http-form_data (2.3.0)
111
+ httparty (0.20.0)
112
+ mime-types (~> 3.0)
113
+ multi_xml (>= 0.5.2)
114
+ i18n (1.10.0)
115
+ concurrent-ruby (~> 1.0)
116
+ jaro_winkler (1.5.4)
117
+ kramdown (2.4.0)
118
+ rexml
119
+ kramdown-parser-gfm (1.1.0)
120
+ kramdown (~> 2.0)
121
+ llhttp-ffi (0.4.0)
122
+ ffi-compiler (~> 1.0)
123
+ rake (~> 13.0)
124
+ method_source (1.0.0)
125
+ mime-types (3.4.1)
126
+ mime-types-data (~> 3.2015)
127
+ mime-types-data (3.2022.0105)
128
+ mini_portile2 (2.8.0)
129
+ minitest (5.15.0)
130
+ multi_xml (0.6.0)
131
+ multipart-post (2.1.1)
132
+ nap (1.1.0)
133
+ no_proxy_fix (0.1.2)
134
+ nokogiri (1.13.6)
135
+ mini_portile2 (~> 2.8.0)
136
+ racc (~> 1.4)
137
+ octokit (4.22.0)
138
+ faraday (>= 0.9)
139
+ sawyer (~> 0.8.0, >= 0.5.3)
140
+ open4 (1.3.4)
141
+ parallel (1.22.1)
142
+ parser (3.1.2.0)
143
+ ast (~> 2.4.1)
144
+ pry (0.14.1)
145
+ coderay (~> 1.1)
146
+ method_source (~> 1.0)
147
+ public_suffix (4.0.7)
148
+ racc (1.6.0)
149
+ rack (2.2.3)
150
+ rainbow (3.0.0)
151
+ rake (13.0.6)
152
+ rchardet (1.8.0)
153
+ regexp_parser (2.4.0)
154
+ reverse_markdown (2.1.1)
155
+ nokogiri
156
+ rexml (3.2.5)
157
+ rspec (3.11.0)
158
+ rspec-core (~> 3.11.0)
159
+ rspec-expectations (~> 3.11.0)
160
+ rspec-mocks (~> 3.11.0)
161
+ rspec-core (3.11.0)
162
+ rspec-support (~> 3.11.0)
163
+ rspec-expectations (3.11.0)
164
+ diff-lcs (>= 1.2.0, < 2.0)
165
+ rspec-support (~> 3.11.0)
166
+ rspec-mocks (3.11.1)
167
+ diff-lcs (>= 1.2.0, < 2.0)
168
+ rspec-support (~> 3.11.0)
169
+ rspec-support (3.11.0)
170
+ rubocop (0.93.1)
171
+ parallel (~> 1.10)
172
+ parser (>= 2.7.1.5)
173
+ rainbow (>= 2.2.2, < 4.0)
174
+ regexp_parser (>= 1.8)
175
+ rexml
176
+ rubocop-ast (>= 0.6.0)
177
+ ruby-progressbar (~> 1.7)
178
+ unicode-display_width (>= 1.4.0, < 2.0)
179
+ rubocop-ast (1.18.0)
180
+ parser (>= 3.1.1.0)
181
+ rubocop-gitlab-security (0.1.1)
182
+ rubocop (>= 0.51)
183
+ rubocop-performance (1.9.2)
184
+ rubocop (>= 0.90.0, < 2.0)
185
+ rubocop-ast (>= 0.4.0)
186
+ rubocop-rails (2.9.1)
187
+ activesupport (>= 4.2.0)
188
+ rack (>= 1.1)
189
+ rubocop (>= 0.90.0, < 2.0)
190
+ rubocop-rspec (1.44.1)
191
+ rubocop (~> 0.87)
192
+ rubocop-ast (>= 0.7.1)
193
+ ruby-progressbar (1.11.0)
194
+ ruby2_keywords (0.0.5)
195
+ sawyer (0.8.2)
196
+ addressable (>= 2.3.5)
197
+ faraday (> 0.8, < 2.0)
198
+ solargraph (0.45.0)
199
+ backport (~> 1.2)
200
+ benchmark
201
+ bundler (>= 1.17.2)
202
+ diff-lcs (~> 1.4)
203
+ e2mmap
204
+ jaro_winkler (~> 1.5)
205
+ kramdown (~> 2.3)
206
+ kramdown-parser-gfm (~> 1.1)
207
+ parser (~> 3.0)
208
+ reverse_markdown (>= 1.0.5, < 3)
209
+ rubocop (>= 0.52)
210
+ thor (~> 1.0)
211
+ tilt (~> 2.0)
212
+ yard (~> 0.9, >= 0.9.24)
213
+ table_print (1.5.7)
214
+ terminal-table (3.0.2)
215
+ unicode-display_width (>= 1.1.1, < 3)
216
+ thor (1.2.1)
217
+ tilt (2.0.10)
218
+ tzinfo (2.0.4)
219
+ concurrent-ruby (~> 1.0)
220
+ unf (0.1.4)
221
+ unf_ext
222
+ unf_ext (0.0.8.1)
223
+ unicode-display_width (1.8.0)
224
+ webmock (3.7.0)
225
+ addressable (>= 2.3.6)
226
+ crack (>= 0.3.2)
227
+ hashdiff (>= 0.4.0, < 2.0.0)
228
+ webrick (1.7.0)
229
+ yard (0.9.27)
230
+ webrick (~> 1.7.0)
231
+ zeitwerk (2.5.4)
232
+
233
+ PLATFORMS
234
+ ruby
235
+
236
+ DEPENDENCIES
237
+ climate_control (~> 1.0.1)
238
+ gitlab-dangerfiles (~> 2.11)
239
+ gitlab-qa!
240
+ gitlab-styles (~> 6.2.1)
241
+ pry (~> 0.11)
242
+ rake (~> 13.0)
243
+ rspec (~> 3.7)
244
+ solargraph (~> 0.41)
245
+ webmock (= 3.7.0)
246
+
247
+ BUNDLED WITH
248
+ 2.2.33
@@ -68,7 +68,7 @@ All environment variables used by GitLab QA should be defined in [`lib/gitlab/qa
68
68
  | `QA_PRAEFECT_REPOSITORY_STORAGE` |- | The name of repository storage using Praefect. Note: Admin access is required to change repository storage. | No|
69
69
  | `QA_COOKIES` |- | Optionally set to "cookie1=value;cookie2=value" in order to add a cookie to every request. This can be used to set the canary cookie by setting it to "gitlab_canary=true". | No|
70
70
  | `QA_DEBUG` |- | Set to `true` to verbosely log page object actions. Note: if enabled be aware that sensitive data might be logged. If an input element has a QA selector with `password` in the name, data entered into the input element will be masked. If the element doesn't have `password` in its name it won't be masked. | No|
71
- | `QA_LOG_PATH` |- | Path to output debug logging to. If not set logging will be output to STDOUT. | No|
71
+ | `QA_LOG_PATH` |- | Path to output debug logging to. By default `QA_ARTIFACTS_DIR` is used | No|
72
72
  | `QA_CAN_TEST_GIT_PROTOCOL_V2` | `true` | Set to `false` to skip tests that require Git protocol v2 if your environment doesn't support it. | No|
73
73
  | `QA_CAN_TEST_ADMIN_FEATURES` | `true` | Set to `false` to skip tests that require admin access. | No|
74
74
  | `QA_CAN_TEST_PRAEFECT` | `true` | Set to `false` to skip tests that require Praefect to be running. | No|
@@ -15,8 +15,7 @@ module Gitlab
15
15
  @environment = {}
16
16
  @volumes = {}
17
17
  @network_aliases = []
18
-
19
- self.exec_commands = []
18
+ @exec_commands = []
20
19
  end
21
20
 
22
21
  def add_network_alias(name)
@@ -155,7 +155,6 @@ module Gitlab
155
155
  setup_omnibus
156
156
 
157
157
  @docker.attach(name) do |line, wait|
158
- puts line
159
158
  # TODO, workaround which allows to detach from the container
160
159
  break if /gitlab Reconfigured!/.match?(line)
161
160
  end
@@ -174,12 +173,15 @@ module Gitlab
174
173
  def process_exec_commands
175
174
  @docker.copy(name, DATA_SEED_PATH, DATA_PATH) if seed_admin_token || seed_db
176
175
 
177
- self.exec_commands += seed_admin_token_command if seed_admin_token
178
- self.exec_commands += seed_test_data_command if seed_db
179
- self.exec_commands += Runtime::Scenario.omnibus_exec_commands
176
+ exec_commands << seed_admin_token_command if seed_admin_token
177
+ exec_commands << seed_test_data_command if seed_db
178
+ exec_commands << Runtime::Scenario.omnibus_exec_commands
179
+
180
+ commands = exec_commands.flatten.uniq
181
+ return if commands.empty?
180
182
 
181
183
  Runtime::Logger.info("Running exec_commands...")
182
- exec_commands.flatten.uniq.each { |command| @docker.exec(name, command) }
184
+ commands.each { |command| @docker.exec(name, command) }
183
185
  end
184
186
 
185
187
  def sha_version
@@ -15,8 +15,13 @@ module Gitlab
15
15
  Docker::Command.execute(%(login --username "#{username}" --password "#{password}" #{registry}), mask_secrets: password)
16
16
  end
17
17
 
18
- def pull(image:, tag: nil)
19
- Docker::Command.execute("pull #{full_image_name(image, tag)}")
18
+ def pull(image:, tag: nil, quiet: true)
19
+ Docker::Command.new("pull").tap do |command|
20
+ command << "-q" if quiet
21
+ command << full_image_name(image, tag)
22
+
23
+ command.execute!
24
+ end
20
25
  end
21
26
 
22
27
  def run(image:, tag: nil, args: [])
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'open3'
2
4
  require 'rainbow/refinement'
3
5
 
@@ -6,35 +8,42 @@ module Gitlab
6
8
  module Docker
7
9
  class Shellout
8
10
  using Rainbow
11
+
9
12
  StatusError = Class.new(StandardError)
10
13
 
11
14
  def initialize(command)
12
15
  @command = command
13
16
  @output = []
14
-
15
- Rainbow.enabled = Runtime::Env.colorized_logs?
16
- Runtime::Logger.info("Docker shell command: `#{@command.mask_secrets}`".cyan)
17
+ @logger = Runtime::Logger.logger
17
18
  end
18
19
 
19
20
  def execute! # rubocop:disable Metrics/AbcSize
20
21
  raise StatusError, 'Command already executed' if @output.any?
21
22
 
23
+ @logger.info("Docker shell command: `#{@command.mask_secrets}`".cyan)
24
+
22
25
  Open3.popen2e(@command.to_s) do |_in, out, wait|
23
26
  out.each do |line|
24
27
  @output.push(line)
25
-
26
- if block_given?
27
- yield line, wait
28
- else
29
- puts line
30
- end
28
+ print "." unless Runtime::Env.ci # indicate progress for local run
29
+ yield line, wait if block_given?
31
30
  end
31
+ puts unless Runtime::Env.ci # add newline after progress dots
32
32
 
33
- if wait.value.exited? && wait.value.exitstatus.nonzero? # rubocop:disable Style/IfUnlessModifier
33
+ if wait.value.exited? && wait.value.exitstatus.nonzero?
34
+ @logger.error("Docker shell command output:\n#{output}")
34
35
  raise StatusError, "Docker command `#{@command.mask_secrets}` failed! ✘"
35
36
  end
37
+
38
+ @logger.debug("Docker shell command output:\n#{output}") unless output.empty?
36
39
  end
37
40
 
41
+ output
42
+ end
43
+
44
+ private
45
+
46
+ def output
38
47
  @output.join.chomp
39
48
  end
40
49
  end
@@ -27,7 +27,6 @@ module Gitlab
27
27
  'QA_COOKIES' => :qa_cookie,
28
28
  'QA_DEBUG' => :qa_debug,
29
29
  'QA_DEFAULT_BRANCH' => :qa_default_branch,
30
- 'QA_LOG_PATH' => :qa_log_path,
31
30
  'QA_CAN_TEST_ADMIN_FEATURES' => :qa_can_test_admin_features,
32
31
  'QA_CAN_TEST_GIT_PROTOCOL_V2' => :qa_can_test_git_protocol_v2,
33
32
  'QA_CAN_TEST_PRAEFECT' => :qa_can_test_praefect,
@@ -168,6 +167,14 @@ module Gitlab
168
167
  enabled?(ENV['QA_DEBUG'], default: true)
169
168
  end
170
169
 
170
+ def log_level
171
+ env_var_value_if_defined('QA_LOG_LEVEL')&.upcase || 'INFO'
172
+ end
173
+
174
+ def log_path
175
+ env_var_value_if_defined('QA_LOG_PATH') || host_artifacts_dir
176
+ end
177
+
171
178
  def default_branch
172
179
  env_var_value_if_defined('QA_DEFAULT_BRANCH') || 'main'
173
180
  end
@@ -11,7 +11,15 @@ module Gitlab
11
11
  def_delegators :logger, :debug, :info, :warn, :error, :fatal, :unknown
12
12
 
13
13
  def self.logger
14
- @logger ||= QA::TestLogger.logger(level: Runtime::Env.debug? ? ::Logger::DEBUG : ::Logger::INFO)
14
+ @logger ||= begin
15
+ log_path = Runtime::Env.log_path
16
+ FileUtils.mkdir_p(log_path) unless File.exist?(log_path)
17
+
18
+ QA::TestLogger.logger(
19
+ level: Runtime::Env.debug? ? "DEBUG" : Runtime::Env.log_level,
20
+ path: log_path
21
+ )
22
+ end
15
23
  end
16
24
  end
17
25
  end
@@ -22,7 +22,8 @@ module Gitlab
22
22
  "gitlab-psql -c 'create database gitlabhq_production_ci owner gitlab'",
23
23
  "gitlab-psql -d gitlabhq_production_ci -c 'create extension btree_gist'",
24
24
  "gitlab-psql -d gitlabhq_production_ci -c 'create extension pg_trgm'",
25
- "gitlab-rake db:structure:load:ci"
25
+ "gitlab-rake db:structure:load:ci",
26
+ "gitlab-ctl restart"
26
27
  ].freeze
27
28
  end
28
29
  end
@@ -1,13 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'logger'
4
3
  require 'rainbow'
4
+ require 'active_support/logger'
5
5
 
6
6
  module Gitlab
7
7
  module QA
8
8
  # Common test logger implementation
9
9
  #
10
10
  class TestLogger
11
+ TIME_FORMAT = "%Y-%m-%d %H:%M:%S"
11
12
  LEVEL_COLORS = {
12
13
  "DEBUG" => :magenta,
13
14
  "INFO" => :green,
@@ -18,17 +19,62 @@ module Gitlab
18
19
 
19
20
  Rainbow.enabled = Runtime::Env.colorized_logs?
20
21
 
21
- def self.logger(level: ::Logger::INFO, source: 'Gitlab QA')
22
- ::Logger.new($stdout).tap do |logger|
23
- logger.level = level
22
+ class << self
23
+ # Combined logger instance
24
+ #
25
+ # @param [<Symbol, String>] level
26
+ # @param [String] source
27
+ # @return [ActiveSupport::Logger]
28
+ def logger(level: :info, source: 'Gitlab QA', path: 'tmp')
29
+ console_log = console_logger(level: level, source: source)
30
+ file_log = file_logger(source: source, path: path)
24
31
 
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)} -- "
32
+ console_log.extend(ActiveSupport::Logger.broadcast(file_log))
33
+ end
34
+
35
+ private
36
+
37
+ # Console logger instance
38
+ #
39
+ # @param [<Symbol, String>] level
40
+ # @param [String] source
41
+ # @return [ActiveSupport::Logger]
42
+ def console_logger(level:, source:)
43
+ ActiveSupport::Logger.new($stdout, level: level, datetime_format: TIME_FORMAT).tap do |logger|
44
+ logger.formatter = proc do |severity, datetime, progname, msg|
45
+ msg_prefix = message_prefix(datetime, source, severity)
46
+
47
+ Rainbow(msg_prefix).public_send(LEVEL_COLORS.fetch(severity, :silver)) + "#{msg}\n" # rubocop:disable GitlabSecurity/PublicSend
48
+ end
49
+ end
50
+ end
51
+
52
+ # File logger
53
+ #
54
+ # @param [String] source
55
+ # @param [String] path
56
+ # @return [ActiveSupport::Logger]
57
+ def file_logger(source:, path:)
58
+ log_file = "#{path}/#{source.downcase.tr(' ', '-')}.log"
59
+
60
+ ActiveSupport::Logger.new(log_file, level: :debug, datetime_format: TIME_FORMAT).tap do |logger|
61
+ logger.formatter = proc do |severity, datetime, progname, msg|
62
+ msg_prefix = message_prefix(datetime, source, severity)
28
63
 
29
- Rainbow(msg_prefix).public_send(LEVEL_COLORS.fetch(severity, :silver)) + "#{msg}\n" # rubocop:disable GitlabSecurity/PublicSend
64
+ "#{msg_prefix}#{msg}\n"
65
+ end
30
66
  end
31
67
  end
68
+
69
+ # Log message prefix
70
+ #
71
+ # @param [DateTime] date
72
+ # @param [String] source
73
+ # @param [String] severity
74
+ # @return [String]
75
+ def message_prefix(date, source, severity)
76
+ "[date=#{date} from=#{source}] #{severity.ljust(5)} -- "
77
+ end
32
78
  end
33
79
  end
34
80
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Gitlab
4
4
  module QA
5
- VERSION = '7.27.2'
5
+ VERSION = '7.29.0'
6
6
  end
7
7
  end
data/tmp/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ **
2
+
3
+ !.gitignore
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.27.2
4
+ version: 7.29.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-05-23 00:00:00.000000000 Z
11
+ date: 2022-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: climate_control
@@ -264,6 +264,7 @@ files:
264
264
  - CONTRIBUTING.md
265
265
  - Dangerfile
266
266
  - Gemfile
267
+ - Gemfile.lock
267
268
  - LICENSE
268
269
  - README.md
269
270
  - Rakefile
@@ -409,6 +410,7 @@ files:
409
410
  - tls_certificates/gitlab/gitlab.test.crt
410
411
  - tls_certificates/gitlab/gitlab.test.csr
411
412
  - tls_certificates/gitlab/gitlab.test.key
413
+ - tmp/.gitignore
412
414
  homepage: http://about.gitlab.com/
413
415
  licenses:
414
416
  - MIT