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
24aa8fcd
Commit
24aa8fcd
authored
Feb 02, 2021
by
Igor Drozdov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix 2.7 warnings for usage data code area
It fixes Ruby warnings and removes the files from deprecations list
parent
8632edaa
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
11 deletions
+7
-11
ee/lib/ee/gitlab/usage_data.rb
ee/lib/ee/gitlab/usage_data.rb
+2
-2
spec/deprecation_toolkit_env.rb
spec/deprecation_toolkit_env.rb
+0
-4
spec/lib/gitlab/utils/usage_data_spec.rb
spec/lib/gitlab/utils/usage_data_spec.rb
+5
-5
No files found.
ee/lib/ee/gitlab/usage_data.rb
View file @
24aa8fcd
...
...
@@ -446,10 +446,10 @@ module EE
pipelines_with_secure_jobs
[
metric_name
.
to_sym
]
=
if
start_id
&&
finish_id
estimate_batch_distinct_count
(
relation
,
:commit_id
,
batch_size:
1000
,
start:
start_id
,
finish:
finish_id
)
do
|
result
|
save_aggregated_metrics
(
aggregated_metrics_params
.
merge
(
data:
result
))
save_aggregated_metrics
(
**
aggregated_metrics_params
.
merge
({
data:
result
}
))
end
else
save_aggregated_metrics
(
aggregated_metrics_params
.
merge
(
data:
::
Gitlab
::
Database
::
PostgresHll
::
Buckets
.
new
))
save_aggregated_metrics
(
**
aggregated_metrics_params
.
merge
({
data:
::
Gitlab
::
Database
::
PostgresHll
::
Buckets
.
new
}
))
0
end
end
...
...
spec/deprecation_toolkit_env.rb
View file @
24aa8fcd
...
...
@@ -55,8 +55,6 @@ module DeprecationToolkitEnv
# one by one
def
self
.
allowed_kwarg_warning_paths
%w[
ee/lib/ee/gitlab/usage_data.rb
spec/lib/gitlab/utils/usage_data_spec.rb
spec/support/gitlab_experiment.rb
spec/support/helpers/next_instance_of.rb
rspec-mocks-3.10.0/lib/rspec/mocks/message_expectation.rb
...
...
@@ -70,8 +68,6 @@ module DeprecationToolkitEnv
grape_logging-1.8.3/lib/grape_logging/middleware/request_logger.rb
activesupport-6.0.3.4/lib/active_support/cache.rb
factory_bot-6.1.0/lib/factory_bot/decorator.rb
doorkeeper-5.4.0/lib/doorkeeper/models/access_token_mixin.rb
rouge-3.26.0/lib/rouge/formatter.rb
batch-loader-1.4.0/lib/batch_loader/graphql.rb
carrierwave-1.3.1/lib/carrierwave/sanitized_file.rb
activerecord-6.0.3.4/lib/active_record/relation.rb
...
...
spec/lib/gitlab/utils/usage_data_spec.rb
View file @
24aa8fcd
...
...
@@ -397,7 +397,7 @@ RSpec.describe Gitlab::Utils::UsageData do
expect
(
redis
).
to
receive
(
:set
).
with
(
"
#{
metric_name
}
_
#{
time_period_name
}
-
#{
timestamp
}
"
,
'{"141":1,"56":1}'
,
ex:
80
.
hours
)
end
described_class
.
save_aggregated_metrics
(
method_params
)
described_class
.
save_aggregated_metrics
(
**
method_params
)
end
context
'error handling'
do
...
...
@@ -406,7 +406,7 @@ RSpec.describe Gitlab::Utils::UsageData do
end
it
'rescues and reraise ::Redis::CommandError for development and test environments'
do
expect
{
described_class
.
save_aggregated_metrics
(
method_params
)
}.
to
raise_error
::
Redis
::
CommandError
expect
{
described_class
.
save_aggregated_metrics
(
**
method_params
)
}.
to
raise_error
::
Redis
::
CommandError
end
context
'for environment different than development'
do
...
...
@@ -415,7 +415,7 @@ RSpec.describe Gitlab::Utils::UsageData do
end
it
'rescues ::Redis::CommandError'
do
expect
{
described_class
.
save_aggregated_metrics
(
method_params
)
}.
not_to
raise_error
expect
{
described_class
.
save_aggregated_metrics
(
**
method_params
)
}.
not_to
raise_error
end
end
end
...
...
@@ -434,12 +434,12 @@ RSpec.describe Gitlab::Utils::UsageData do
expect
(
redis
).
not_to
receive
(
:set
)
end
described_class
.
save_aggregated_metrics
(
method_params
)
described_class
.
save_aggregated_metrics
(
**
method_params
)
end
end
it
'raises error for development environment'
do
expect
{
described_class
.
save_aggregated_metrics
(
method_params
)
}.
to
raise_error
/Unsupported data type/
expect
{
described_class
.
save_aggregated_metrics
(
**
method_params
)
}.
to
raise_error
/Unsupported data type/
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