Commit b244314f authored by Sean McGivern's avatar Sean McGivern

Verify that usage ping works when all counts time out

parent 0ec8038a
...@@ -83,7 +83,7 @@ module EE ...@@ -83,7 +83,7 @@ module EE
sast: :sast_jobs sast: :sast_jobs
} }
results = count(::Ci::Build.where(name: types.keys).group(:name)) results = count(::Ci::Build.where(name: types.keys).group(:name), fallback: Hash.new(-1))
results.each_with_object({}) { |(key, value), response| response[types[key.to_sym]] = value } results.each_with_object({}) { |(key, value), response| response[types[key.to_sym]] = value }
end end
# rubocop: enable CodeReuse/ActiveRecord # rubocop: enable CodeReuse/ActiveRecord
......
...@@ -128,6 +128,13 @@ describe Gitlab::UsageData do ...@@ -128,6 +128,13 @@ describe Gitlab::UsageData do
expect(count_data[:clusters_applications_prometheus]).to eq(1) expect(count_data[:clusters_applications_prometheus]).to eq(1)
expect(count_data[:clusters_applications_runner]).to eq(1) expect(count_data[:clusters_applications_runner]).to eq(1)
end end
it 'works when queries time out' do
allow_any_instance_of(ActiveRecord::Relation)
.to receive(:count).and_raise(ActiveRecord::StatementInvalid.new(''))
expect { subject }.not_to raise_error
end
end end
describe '#features_usage_data_ce' do describe '#features_usage_data_ce' do
......
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