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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
a85c8e34
Commit
a85c8e34
authored
Oct 25, 2018
by
Mark Lapierre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Re-enable debug logging of Git commands and output
parent
4de90041
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
7 deletions
+17
-7
qa/qa/git/repository.rb
qa/qa/git/repository.rb
+2
-6
qa/qa/runtime/logger.rb
qa/qa/runtime/logger.rb
+3
-1
qa/spec/page/logging_spec.rb
qa/spec/page/logging_spec.rb
+6
-0
qa/spec/runtime/logger_spec.rb
qa/spec/runtime/logger_spec.rb
+6
-0
No files found.
qa/qa/git/repository.rb
View file @
a85c8e34
...
...
@@ -113,21 +113,17 @@ module QA
attr_reader
:uri
,
:username
,
:password
,
:known_hosts_file
,
:private_key_file
def
debug?
Runtime
::
Env
.
respond_to?
(
:verbose?
)
&&
Runtime
::
Env
.
verbose?
end
def
ssh_key_set?
!
private_key_file
.
nil?
end
def
run
(
command_str
)
command
=
[
env_vars
,
command_str
,
'2>&1'
].
compact
.
join
(
' '
)
warn
"DEBUG: command=[
#{
command
}
]"
if
debug?
Runtime
::
Logger
.
debug
"Git: command=[
#{
command
}
]"
output
,
_
=
Open3
.
capture2
(
command
)
output
=
output
.
chomp
.
gsub
(
/\s+$/
,
''
)
warn
"DEBUG: output=[
#{
output
}
]"
if
debug?
Runtime
::
Logger
.
debug
"Git: output=[
#{
output
}
]"
output
end
...
...
qa/qa/runtime/logger.rb
View file @
a85c8e34
...
...
@@ -10,11 +10,13 @@ module QA
def_delegators
:logger
,
:debug
,
:info
,
:error
,
:warn
,
:fatal
,
:unknown
singleton_class
.
module_eval
do
attr_writer
:logger
def
logger
return
@logger
if
@logger
@logger
=
::
Logger
.
new
Runtime
::
Env
.
log_destination
@logger
.
level
=
::
Logger
::
DEBUG
@logger
.
level
=
Runtime
::
Env
.
debug?
?
::
Logger
::
DEBUG
:
::
Logger
::
ERROR
@logger
end
end
...
...
qa/spec/page/logging_spec.rb
View file @
a85c8e34
...
...
@@ -3,9 +3,15 @@
require
'capybara/dsl'
describe
QA
::
Support
::
Page
::
Logging
do
include
Support
::
StubENV
let
(
:page
)
{
double
().
as_null_object
}
before
do
logger
=
Logger
.
new
$stdout
logger
.
level
=
::
Logger
::
DEBUG
QA
::
Runtime
::
Logger
.
logger
=
logger
allow
(
Capybara
).
to
receive
(
:current_session
).
and_return
(
page
)
allow
(
page
).
to
receive
(
:current_url
).
and_return
(
'http://current-url'
)
allow
(
page
).
to
receive
(
:has_css?
).
with
(
any_args
).
and_return
(
true
)
...
...
qa/spec/runtime/logger_spec.rb
View file @
a85c8e34
# frozen_string_literal: true
describe
QA
::
Runtime
::
Logger
do
before
do
logger
=
Logger
.
new
$stdout
logger
.
level
=
::
Logger
::
DEBUG
described_class
.
logger
=
logger
end
it
'logs debug'
do
expect
{
described_class
.
debug
(
'test'
)
}.
to
output
(
/DEBUG -- : test/
).
to_stdout_from_any_process
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