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
8387a827
Commit
8387a827
authored
Apr 22, 2020
by
nmilojevic1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix broken specs
parent
269e0f43
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
10 deletions
+10
-10
lib/gitlab/utils/measuring.rb
lib/gitlab/utils/measuring.rb
+7
-7
spec/lib/gitlab/import_export/project/export_task_spec.rb
spec/lib/gitlab/import_export/project/export_task_spec.rb
+2
-2
spec/lib/gitlab/utils/measuring_spec.rb
spec/lib/gitlab/utils/measuring_spec.rb
+1
-1
No files found.
lib/gitlab/utils/measuring.rb
View file @
8387a827
...
@@ -18,8 +18,8 @@ module Gitlab
...
@@ -18,8 +18,8 @@ module Gitlab
end
end
def
initialize
(
logger:
nil
,
base_log_data:
{})
def
initialize
(
logger:
nil
,
base_log_data:
{})
self
.
logger
=
logger
||
Logger
.
new
(
$stdout
)
@
logger
=
logger
||
Logger
.
new
(
$stdout
)
self
.
base_log_data
=
base_log_data
@
base_log_data
=
base_log_data
end
end
def
with_measuring
def
with_measuring
...
@@ -44,13 +44,13 @@ module Gitlab
...
@@ -44,13 +44,13 @@ module Gitlab
private
private
attr_
accesso
r
:gc_stats
,
:time_to_finish
,
:sql_calls_count
,
:logger
,
:base_log_data
attr_
reade
r
:gc_stats
,
:time_to_finish
,
:sql_calls_count
,
:logger
,
:base_log_data
def
with_count_queries
(
&
block
)
def
with_count_queries
(
&
block
)
self
.
sql_calls_count
=
0
@
sql_calls_count
=
0
counter_f
=
->
(
_name
,
_started
,
_finished
,
_unique_id
,
payload
)
{
counter_f
=
->
(
_name
,
_started
,
_finished
,
_unique_id
,
payload
)
{
self
.
sql_calls_count
+=
1
unless
payload
[
:name
].
in?
%w[CACHE SCHEMA]
@
sql_calls_count
+=
1
unless
payload
[
:name
].
in?
%w[CACHE SCHEMA]
}
}
ActiveSupport
::
Notifications
.
subscribed
(
counter_f
,
"sql.active_record"
,
&
block
)
ActiveSupport
::
Notifications
.
subscribed
(
counter_f
,
"sql.active_record"
,
&
block
)
...
@@ -67,7 +67,7 @@ module Gitlab
...
@@ -67,7 +67,7 @@ module Gitlab
stats_before
=
GC
.
stat
stats_before
=
GC
.
stat
result
=
yield
result
=
yield
stats_after
=
GC
.
stat
stats_after
=
GC
.
stat
self
.
gc_stats
=
stats_after
.
map
do
|
key
,
after_value
|
@
gc_stats
=
stats_after
.
map
do
|
key
,
after_value
|
before_value
=
stats_before
[
key
]
before_value
=
stats_before
[
key
]
[
key
,
before:
before_value
,
after:
after_value
,
diff:
after_value
-
before_value
]
[
key
,
before:
before_value
,
after:
after_value
,
diff:
after_value
-
before_value
]
end
.
to_h
end
.
to_h
...
@@ -76,7 +76,7 @@ module Gitlab
...
@@ -76,7 +76,7 @@ module Gitlab
def
with_measure_time
def
with_measure_time
result
=
nil
result
=
nil
self
.
time_to_finish
=
Benchmark
.
realtime
do
@
time_to_finish
=
Benchmark
.
realtime
do
result
=
yield
result
=
yield
end
end
...
...
spec/lib/gitlab/import_export/project/export_task_spec.rb
View file @
8387a827
...
@@ -3,9 +3,9 @@
...
@@ -3,9 +3,9 @@
require
'rake_helper'
require
'rake_helper'
describe
Gitlab
::
ImportExport
::
Project
::
ExportTask
do
describe
Gitlab
::
ImportExport
::
Project
::
ExportTask
do
let
(
:username
)
{
'root'
}
let
_it_be
(
:username
)
{
'root'
}
let
(
:namespace_path
)
{
username
}
let
(
:namespace_path
)
{
username
}
let
!
(
:user
)
{
create
(
:user
,
username:
username
)
}
let
_it_be
(
:user
)
{
create
(
:user
,
username:
username
)
}
let
(
:measurement_enabled
)
{
false
}
let
(
:measurement_enabled
)
{
false
}
let
(
:file_path
)
{
'spec/fixtures/gitlab/import_export/test_project_export.tar.gz'
}
let
(
:file_path
)
{
'spec/fixtures/gitlab/import_export/test_project_export.tar.gz'
}
let
(
:project
)
{
create
(
:project
,
creator:
user
,
namespace:
user
.
namespace
)
}
let
(
:project
)
{
create
(
:project
,
creator:
user
,
namespace:
user
.
namespace
)
}
...
...
spec/lib/gitlab/utils/measuring_spec.rb
View file @
8387a827
...
@@ -23,7 +23,7 @@ describe Gitlab::Utils::Measuring do
...
@@ -23,7 +23,7 @@ describe Gitlab::Utils::Measuring do
end
end
it
'measure execution with Gitlab::Utils::Measuring instance'
,
:aggregate_failure
do
it
'measure execution with Gitlab::Utils::Measuring instance'
,
:aggregate_failure
do
expect
(
described_class
).
to
receive
(
:new
).
with
(
logger:
measurement_logger
,
base_log_data:
base_log_data
){
measurement
}
expect
(
described_class
).
to
receive
(
:new
).
with
(
logger:
measurement_logger
,
base_log_data:
base_log_data
)
{
measurement
}
expect
(
measurement
).
to
receive
(
:with_measuring
)
expect
(
measurement
).
to
receive
(
:with_measuring
)
subject
subject
...
...
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