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
21c1719d
Commit
21c1719d
authored
Dec 06, 2021
by
Andrejs Cunskis
Committed by
Dan Davison
Dec 06, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
E2E: Additional logging for resource identifiable attributes
parent
d974af2d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
3 deletions
+22
-3
qa/qa/resource/base.rb
qa/qa/resource/base.rb
+14
-0
qa/spec/resource/base_spec.rb
qa/spec/resource/base_spec.rb
+8
-3
No files found.
qa/qa/resource/base.rb
View file @
21c1719d
...
...
@@ -80,11 +80,25 @@ module QA
Support
::
FabricationTracker
.
start_fabrication
result
=
yield
.
tap
do
fabrication_time
=
Time
.
now
-
start
resource_identifier
=
begin
if
resource
.
respond_to?
(
:username
)
&&
resource
.
username
"with username '
#{
resource
.
username
}
'"
elsif
resource
.
respond_to?
(
:full_path
)
&&
resource
.
full_path
"with full_path '
#{
resource
.
full_path
}
'"
elsif
resource
.
respond_to?
(
:name
)
&&
resource
.
name
"with name '
#{
resource
.
name
}
'"
elsif
resource
.
respond_to?
(
:id
)
&&
resource
.
id
"with id '
#{
resource
.
id
}
'"
end
rescue
QA
::
Resource
::
Base
::
NoValueError
nil
end
Support
::
FabricationTracker
.
save_fabrication
(
:"
#{
method
}
_fabrication"
,
fabrication_time
)
Runtime
::
Logger
.
debug
do
msg
=
[
"==
#{
'='
*
parents
.
size
}
>"
]
msg
<<
"Built a
#{
name
}
"
msg
<<
resource_identifier
if
resource_identifier
msg
<<
"as a dependency of
#{
parents
.
last
}
"
if
parents
.
any?
msg
<<
"via
#{
method
}
"
msg
<<
"in
#{
fabrication_time
}
seconds"
...
...
qa/spec/resource/base_spec.rb
View file @
21c1719d
...
...
@@ -3,8 +3,9 @@
RSpec
.
describe
QA
::
Resource
::
Base
do
include
QA
::
Support
::
Helpers
::
StubEnv
let
(
:resource
)
{
spy
(
'resource'
)
}
let
(
:resource
)
{
spy
(
'resource'
,
username:
'qa'
)
}
let
(
:location
)
{
'http://location'
}
let
(
:log_regex
)
{
%r{==> Built a MyResource with username 'qa' via
#{
method
}
in [
\d
.
\-
e]+ seconds+}
}
shared_context
'with fabrication context'
do
subject
do
...
...
@@ -68,6 +69,8 @@ RSpec.describe QA::Resource::Base do
end
context
"with debug log level"
do
let
(
:method
)
{
'api'
}
before
do
allow
(
QA
::
Runtime
::
Logger
).
to
receive
(
:debug
)
end
...
...
@@ -78,7 +81,7 @@ RSpec.describe QA::Resource::Base do
subject
.
fabricate_via_api!
(
'something'
,
resource:
resource
,
parents:
[])
expect
(
QA
::
Runtime
::
Logger
).
to
have_received
(
:debug
)
do
|&
msg
|
expect
(
msg
.
call
).
to
match_regex
(
/==> Built a MyResource via api in [\d.\-e]+ seconds+/
)
expect
(
msg
.
call
).
to
match_regex
(
log_regex
)
end
end
end
...
...
@@ -102,6 +105,8 @@ RSpec.describe QA::Resource::Base do
end
context
"with debug log level"
do
let
(
:method
)
{
'browser_ui'
}
before
do
allow
(
QA
::
Runtime
::
Logger
).
to
receive
(
:debug
)
end
...
...
@@ -112,7 +117,7 @@ RSpec.describe QA::Resource::Base do
subject
.
fabricate_via_browser_ui!
(
'something'
,
resource:
resource
,
parents:
[])
expect
(
QA
::
Runtime
::
Logger
).
to
have_received
(
:debug
)
do
|&
msg
|
expect
(
msg
.
call
).
to
match_regex
(
/==> Built a MyResource via browser_ui in [\d.\-e]+ seconds+/
)
expect
(
msg
.
call
).
to
match_regex
(
log_regex
)
end
end
end
...
...
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