Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
22c21ade
Commit
22c21ade
authored
Feb 24, 2022
by
Andrejs Cunskis
Committed by
Tiffany Rea
Feb 24, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
E2E: Add specific colors for every log level
parent
1c553a0d
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
12 deletions
+20
-12
qa/qa.rb
qa/qa.rb
+6
-0
qa/qa/runtime/logger.rb
qa/qa/runtime/logger.rb
+10
-3
qa/qa/support/repeater.rb
qa/qa/support/repeater.rb
+3
-2
qa/spec/spec_helper.rb
qa/spec/spec_helper.rb
+1
-7
No files found.
qa/qa.rb
View file @
22c21ade
...
@@ -11,6 +11,12 @@ require_relative 'lib/gitlab'
...
@@ -11,6 +11,12 @@ require_relative 'lib/gitlab'
require_relative
'../config/bundler_setup'
require_relative
'../config/bundler_setup'
Bundler
.
require
(
:default
)
Bundler
.
require
(
:default
)
require
'securerandom'
require
'pathname'
require
'active_support/core_ext/hash'
require
'active_support/core_ext/object/blank'
require
'rainbow/refinement'
module
QA
module
QA
root
=
"
#{
__dir__
}
/qa"
root
=
"
#{
__dir__
}
/qa"
...
...
qa/qa/runtime/logger.rb
View file @
22c21ade
...
@@ -2,13 +2,19 @@
...
@@ -2,13 +2,19 @@
require
'logger'
require
'logger'
require
'forwardable'
require
'forwardable'
require
'rainbow/refinement'
module
QA
module
QA
module
Runtime
module
Runtime
module
Logger
module
Logger
extend
SingleForwardable
extend
SingleForwardable
using
Rainbow
LEVEL_COLORS
=
{
"DEBUG"
=>
:magenta
,
"INFO"
=>
:green
,
"WARN"
=>
:yellow
,
"ERROR"
=>
:indianred
,
"FATAL"
=>
:red
}.
freeze
def_delegators
:logger
,
:debug
,
:info
,
:warn
,
:error
,
:fatal
,
:unknown
def_delegators
:logger
,
:debug
,
:info
,
:warn
,
:error
,
:fatal
,
:unknown
...
@@ -23,8 +29,9 @@ module QA
...
@@ -23,8 +29,9 @@ module QA
logger
.
formatter
=
proc
do
|
severity
,
datetime
,
progname
,
msg
|
logger
.
formatter
=
proc
do
|
severity
,
datetime
,
progname
,
msg
|
date_format
=
datetime
.
strftime
(
"%Y-%m-%d %H:%M:%S"
)
date_format
=
datetime
.
strftime
(
"%Y-%m-%d %H:%M:%S"
)
msg_prefix
=
"[date=
#{
date_format
}
from=QA Tests]
#{
severity
.
ljust
(
5
)
}
-- "
"[date=
#{
date_format
}
from=QA Tests]
#{
severity
.
ljust
(
5
)
}
-- "
.
yellow
+
"
#{
msg
}
\n
"
Rainbow
(
msg_prefix
).
send
(
LEVEL_COLORS
.
fetch
(
severity
,
:yellow
))
+
"
#{
msg
}
\n
"
end
end
end
end
end
end
...
...
qa/qa/support/repeater.rb
View file @
22c21ade
# frozen_string_literal: true
# frozen_string_literal: true
require
'active_support/inflector'
require
'active_support/inflector'
require
'rainbow/refinement'
module
QA
module
QA
module
Support
module
Support
...
@@ -40,7 +39,9 @@ module QA
...
@@ -40,7 +39,9 @@ module QA
QA
::
Runtime
::
Logger
.
debug
(
msg
.
join
(
' '
))
QA
::
Runtime
::
Logger
.
debug
(
msg
.
join
(
' '
))
end
end
QA
::
Runtime
::
Logger
.
debug
(
"Attempt number
#{
attempts
+
1
}
"
.
bg
(
:yellow
).
black
)
if
log
&&
max_attempts
&&
attempts
>
0
if
log
&&
max_attempts
&&
attempts
>
0
QA
::
Runtime
::
Logger
.
debug
(
"Attempt number
#{
attempts
+
1
}
"
.
bg
(
:yellow
).
black
)
end
result
=
yield
result
=
yield
if
result
if
result
...
...
qa/spec/spec_helper.rb
View file @
22c21ade
...
@@ -2,12 +2,6 @@
...
@@ -2,12 +2,6 @@
require_relative
'../qa'
require_relative
'../qa'
require
'securerandom'
require
'pathname'
require
'active_support/core_ext/hash'
require
'active_support/core_ext/object/blank'
require
'rainbow/refinement'
require_relative
'qa_deprecation_toolkit_env'
require_relative
'qa_deprecation_toolkit_env'
QaDeprecationToolkitEnv
.
configure!
QaDeprecationToolkitEnv
.
configure!
...
@@ -36,7 +30,7 @@ RSpec.configure do |config|
...
@@ -36,7 +30,7 @@ RSpec.configure do |config|
end
end
config
.
prepend_before
do
|
example
|
config
.
prepend_before
do
|
example
|
QA
::
Runtime
::
Logger
.
debug
(
"
\n
Starting test:
#{
example
.
full_description
}
\n
"
)
QA
::
Runtime
::
Logger
.
info
(
"Starting test:
#{
Rainbow
(
example
.
full_description
).
bright
}
"
)
QA
::
Runtime
::
Example
.
current
=
example
QA
::
Runtime
::
Example
.
current
=
example
# Reset fabrication counters tracked in resource base
# Reset fabrication counters tracked in resource base
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment