Commit 447a8ddb authored by Dylan Griffith's avatar Dylan Griffith

Fix rubocop issue active_record_subscriber_shared_examples

Ran rubocop -a after removing the disable.
parent eeec86d3
...@@ -19,9 +19,8 @@ RSpec.shared_examples 'store ActiveRecord info in RequestStore' do |db_role| ...@@ -19,9 +19,8 @@ RSpec.shared_examples 'store ActiveRecord info in RequestStore' do |db_role|
Gitlab::WithRequestStore.with_request_store do Gitlab::WithRequestStore.with_request_store do
subscriber.sql(event) subscriber.sql(event)
# rubocop:disable Style/ConditionalAssignment expected = if db_role == :primary
if db_role == :primary expected_payload_defaults.merge({
expected = expected_payload_defaults.merge({
db_count: record_query ? 1 : 0, db_count: record_query ? 1 : 0,
db_write_count: record_write_query ? 1 : 0, db_write_count: record_write_query ? 1 : 0,
db_cached_count: record_cached_query ? 1 : 0, db_cached_count: record_cached_query ? 1 : 0,
...@@ -37,7 +36,7 @@ RSpec.shared_examples 'store ActiveRecord info in RequestStore' do |db_role| ...@@ -37,7 +36,7 @@ RSpec.shared_examples 'store ActiveRecord info in RequestStore' do |db_role|
"db_primary_#{db_config_name}_wal_cached_count": record_wal_query && record_cached_query ? 1 : 0 "db_primary_#{db_config_name}_wal_cached_count": record_wal_query && record_cached_query ? 1 : 0
}) })
elsif db_role == :replica elsif db_role == :replica
expected = expected_payload_defaults.merge({ expected_payload_defaults.merge({
db_count: record_query ? 1 : 0, db_count: record_query ? 1 : 0,
db_write_count: record_write_query ? 1 : 0, db_write_count: record_write_query ? 1 : 0,
db_cached_count: record_cached_query ? 1 : 0, db_cached_count: record_cached_query ? 1 : 0,
...@@ -53,13 +52,12 @@ RSpec.shared_examples 'store ActiveRecord info in RequestStore' do |db_role| ...@@ -53,13 +52,12 @@ RSpec.shared_examples 'store ActiveRecord info in RequestStore' do |db_role|
"db_replica_#{db_config_name}_wal_cached_count": record_wal_query && record_cached_query ? 1 : 0 "db_replica_#{db_config_name}_wal_cached_count": record_wal_query && record_cached_query ? 1 : 0
}) })
else else
expected = { {
db_count: record_query ? 1 : 0, db_count: record_query ? 1 : 0,
db_write_count: record_write_query ? 1 : 0, db_write_count: record_write_query ? 1 : 0,
db_cached_count: record_cached_query ? 1 : 0 db_cached_count: record_cached_query ? 1 : 0
} }
end end
# rubocop:enable Style/ConditionalAssignment
expect(described_class.db_counter_payload).to eq(expected) expect(described_class.db_counter_payload).to eq(expected)
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