Commit fd1c8b16 authored by Thong Kuah's avatar Thong Kuah

Merge branch 'id-fix-2.7-warnings-for-usage-data' into 'master'

Fix 2.7 warnings for usage data code area

See merge request gitlab-org/gitlab!53146
parents 80cf00a1 24aa8fcd
...@@ -451,10 +451,10 @@ module EE ...@@ -451,10 +451,10 @@ module EE
pipelines_with_secure_jobs[metric_name.to_sym] = pipelines_with_secure_jobs[metric_name.to_sym] =
if start_id && finish_id if start_id && finish_id
estimate_batch_distinct_count(relation, :commit_id, batch_size: 1000, start: start_id, finish: finish_id) do |result| 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 end
else 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 0
end end
end end
......
...@@ -55,8 +55,6 @@ module DeprecationToolkitEnv ...@@ -55,8 +55,6 @@ module DeprecationToolkitEnv
# one by one # one by one
def self.allowed_kwarg_warning_paths def self.allowed_kwarg_warning_paths
%w[ %w[
ee/lib/ee/gitlab/usage_data.rb
spec/lib/gitlab/utils/usage_data_spec.rb
spec/support/gitlab_experiment.rb spec/support/gitlab_experiment.rb
spec/support/helpers/next_instance_of.rb spec/support/helpers/next_instance_of.rb
rspec-mocks-3.10.0/lib/rspec/mocks/message_expectation.rb rspec-mocks-3.10.0/lib/rspec/mocks/message_expectation.rb
...@@ -70,8 +68,6 @@ module DeprecationToolkitEnv ...@@ -70,8 +68,6 @@ module DeprecationToolkitEnv
grape_logging-1.8.3/lib/grape_logging/middleware/request_logger.rb grape_logging-1.8.3/lib/grape_logging/middleware/request_logger.rb
activesupport-6.0.3.4/lib/active_support/cache.rb activesupport-6.0.3.4/lib/active_support/cache.rb
factory_bot-6.1.0/lib/factory_bot/decorator.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 batch-loader-1.4.0/lib/batch_loader/graphql.rb
carrierwave-1.3.1/lib/carrierwave/sanitized_file.rb carrierwave-1.3.1/lib/carrierwave/sanitized_file.rb
activerecord-6.0.3.4/lib/active_record/relation.rb activerecord-6.0.3.4/lib/active_record/relation.rb
......
...@@ -397,7 +397,7 @@ RSpec.describe Gitlab::Utils::UsageData do ...@@ -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) expect(redis).to receive(:set).with("#{metric_name}_#{time_period_name}-#{timestamp}", '{"141":1,"56":1}', ex: 80.hours)
end end
described_class.save_aggregated_metrics(method_params) described_class.save_aggregated_metrics(**method_params)
end end
context 'error handling' do context 'error handling' do
...@@ -406,7 +406,7 @@ RSpec.describe Gitlab::Utils::UsageData do ...@@ -406,7 +406,7 @@ RSpec.describe Gitlab::Utils::UsageData do
end end
it 'rescues and reraise ::Redis::CommandError for development and test environments' do 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 end
context 'for environment different than development' do context 'for environment different than development' do
...@@ -415,7 +415,7 @@ RSpec.describe Gitlab::Utils::UsageData do ...@@ -415,7 +415,7 @@ RSpec.describe Gitlab::Utils::UsageData do
end end
it 'rescues ::Redis::CommandError' do 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 end
end end
...@@ -434,12 +434,12 @@ RSpec.describe Gitlab::Utils::UsageData do ...@@ -434,12 +434,12 @@ RSpec.describe Gitlab::Utils::UsageData do
expect(redis).not_to receive(:set) expect(redis).not_to receive(:set)
end end
described_class.save_aggregated_metrics(method_params) described_class.save_aggregated_metrics(**method_params)
end end
end end
it 'raises error for development environment' do 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 end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment