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
447a8ddb
Commit
447a8ddb
authored
Aug 06, 2021
by
Dylan Griffith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix rubocop issue active_record_subscriber_shared_examples
Ran rubocop -a after removing the disable.
parent
eeec86d3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
41 deletions
+39
-41
spec/support/shared_examples/metrics/active_record_subscriber_shared_examples.rb
...mples/metrics/active_record_subscriber_shared_examples.rb
+39
-41
No files found.
spec/support/shared_examples/metrics/active_record_subscriber_shared_examples.rb
View file @
447a8ddb
...
...
@@ -19,47 +19,45 @@ RSpec.shared_examples 'store ActiveRecord info in RequestStore' do |db_role|
Gitlab
::
WithRequestStore
.
with_request_store
do
subscriber
.
sql
(
event
)
# rubocop:disable Style/ConditionalAssignment
if
db_role
==
:primary
expected
=
expected_payload_defaults
.
merge
({
db_count:
record_query
?
1
:
0
,
db_write_count:
record_write_query
?
1
:
0
,
db_cached_count:
record_cached_query
?
1
:
0
,
db_primary_cached_count:
record_cached_query
?
1
:
0
,
"db_primary_
#{
db_config_name
}
_cached_count"
:
record_cached_query
?
1
:
0
,
db_primary_count:
record_query
?
1
:
0
,
"db_primary_
#{
db_config_name
}
_count"
:
record_query
?
1
:
0
,
db_primary_duration_s:
record_query
?
0.002
:
0
,
"db_primary_
#{
db_config_name
}
_duration_s"
:
record_query
?
0.002
:
0
,
db_primary_wal_count:
record_wal_query
?
1
:
0
,
"db_primary_
#{
db_config_name
}
_wal_count"
:
record_wal_query
?
1
:
0
,
db_primary_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
expected
=
expected_payload_defaults
.
merge
({
db_count:
record_query
?
1
:
0
,
db_write_count:
record_write_query
?
1
:
0
,
db_cached_count:
record_cached_query
?
1
:
0
,
db_replica_cached_count:
record_cached_query
?
1
:
0
,
"db_replica_
#{
db_config_name
}
_cached_count"
:
record_cached_query
?
1
:
0
,
db_replica_count:
record_query
?
1
:
0
,
"db_replica_
#{
db_config_name
}
_count"
:
record_query
?
1
:
0
,
db_replica_duration_s:
record_query
?
0.002
:
0
,
"db_replica_
#{
db_config_name
}
_duration_s"
:
record_query
?
0.002
:
0
,
db_replica_wal_count:
record_wal_query
?
1
:
0
,
"db_replica_
#{
db_config_name
}
_wal_count"
:
record_wal_query
?
1
:
0
,
db_replica_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
expected
=
{
db_count:
record_query
?
1
:
0
,
db_write_count:
record_write_query
?
1
:
0
,
db_cached_count:
record_cached_query
?
1
:
0
}
end
# rubocop:enable Style/ConditionalAssignment
expected
=
if
db_role
==
:primary
expected_payload_defaults
.
merge
({
db_count:
record_query
?
1
:
0
,
db_write_count:
record_write_query
?
1
:
0
,
db_cached_count:
record_cached_query
?
1
:
0
,
db_primary_cached_count:
record_cached_query
?
1
:
0
,
"db_primary_
#{
db_config_name
}
_cached_count"
:
record_cached_query
?
1
:
0
,
db_primary_count:
record_query
?
1
:
0
,
"db_primary_
#{
db_config_name
}
_count"
:
record_query
?
1
:
0
,
db_primary_duration_s:
record_query
?
0.002
:
0
,
"db_primary_
#{
db_config_name
}
_duration_s"
:
record_query
?
0.002
:
0
,
db_primary_wal_count:
record_wal_query
?
1
:
0
,
"db_primary_
#{
db_config_name
}
_wal_count"
:
record_wal_query
?
1
:
0
,
db_primary_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
expected_payload_defaults
.
merge
({
db_count:
record_query
?
1
:
0
,
db_write_count:
record_write_query
?
1
:
0
,
db_cached_count:
record_cached_query
?
1
:
0
,
db_replica_cached_count:
record_cached_query
?
1
:
0
,
"db_replica_
#{
db_config_name
}
_cached_count"
:
record_cached_query
?
1
:
0
,
db_replica_count:
record_query
?
1
:
0
,
"db_replica_
#{
db_config_name
}
_count"
:
record_query
?
1
:
0
,
db_replica_duration_s:
record_query
?
0.002
:
0
,
"db_replica_
#{
db_config_name
}
_duration_s"
:
record_query
?
0.002
:
0
,
db_replica_wal_count:
record_wal_query
?
1
:
0
,
"db_replica_
#{
db_config_name
}
_wal_count"
:
record_wal_query
?
1
:
0
,
db_replica_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
{
db_count:
record_query
?
1
:
0
,
db_write_count:
record_write_query
?
1
:
0
,
db_cached_count:
record_cached_query
?
1
:
0
}
end
expect
(
described_class
.
db_counter_payload
).
to
eq
(
expected
)
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