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
66b08296
Commit
66b08296
authored
Jul 29, 2021
by
Adam Hegyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix some Database/MultipleDatabases offenses
Fix some Database/MultipleDatabases rubocop offenses
parent
bd5d0ea9
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
13 additions
and
25 deletions
+13
-25
.rubocop_manual_todo.yml
.rubocop_manual_todo.yml
+0
-12
lib/api/rubygem_packages.rb
lib/api/rubygem_packages.rb
+1
-1
spec/features/admin/dashboard_spec.rb
spec/features/admin/dashboard_spec.rb
+2
-2
spec/initializers/lograge_spec.rb
spec/initializers/lograge_spec.rb
+1
-1
spec/lib/gitlab/import_export/fast_hash_serializer_spec.rb
spec/lib/gitlab/import_export/fast_hash_serializer_spec.rb
+1
-1
spec/lib/gitlab/import_export/project/tree_saver_spec.rb
spec/lib/gitlab/import_export/project/tree_saver_spec.rb
+1
-1
spec/lib/gitlab/pagination/keyset/order_spec.rb
spec/lib/gitlab/pagination/keyset/order_spec.rb
+1
-1
spec/lib/gitlab/query_limiting/active_support_subscriber_spec.rb
...b/gitlab/query_limiting/active_support_subscriber_spec.rb
+1
-1
spec/lib/gitlab/sidekiq_logging/structured_logger_spec.rb
spec/lib/gitlab/sidekiq_logging/structured_logger_spec.rb
+3
-3
spec/models/application_setting_spec.rb
spec/models/application_setting_spec.rb
+1
-1
spec/requests/api/statistics_spec.rb
spec/requests/api/statistics_spec.rb
+1
-1
No files found.
.rubocop_manual_todo.yml
View file @
66b08296
...
...
@@ -2498,7 +2498,6 @@ Database/MultipleDatabases:
-
'
ee/spec/services/ee/merge_requests/update_service_spec.rb'
-
'
lib/backup/database.rb'
-
'
lib/after_commit_queue.rb'
-
'
lib/api/rubygem_packages.rb'
-
'
lib/backup/manager.rb'
-
'
lib/gitlab/current_settings.rb'
-
'
lib/gitlab/database/load_balancing/load_balancer.rb'
...
...
@@ -2534,29 +2533,20 @@ Database/MultipleDatabases:
-
'
lib/gitlab/sherlock/query.rb'
-
'
lib/system_check/orphans/repository_check.rb'
-
'
spec/db/schema_spec.rb'
-
'
spec/features/admin/dashboard_spec.rb'
-
'
spec/initializers/database_config_spec.rb'
-
'
spec/initializers/lograge_spec.rb'
-
'
spec/lib/backup/manager_spec.rb'
-
'
spec/lib/gitlab/current_settings_spec.rb'
-
'
spec/lib/gitlab/database_spec.rb'
-
'
spec/lib/gitlab/import_export/fast_hash_serializer_spec.rb'
-
'
spec/lib/gitlab/import_export/project/tree_saver_spec.rb'
-
'
spec/lib/gitlab/metrics/subscribers/active_record_spec.rb'
-
'
spec/lib/gitlab/pagination/keyset/order_spec.rb'
-
'
spec/lib/gitlab/profiler_spec.rb'
-
'
spec/lib/gitlab/query_limiting/active_support_subscriber_spec.rb'
-
'
spec/lib/gitlab/sidekiq_logging/structured_logger_spec.rb'
-
'
spec/lib/gitlab/usage_data_metrics_spec.rb'
-
'
spec/lib/gitlab/usage_data_queries_spec.rb'
-
'
spec/lib/gitlab/usage/metrics/names_suggestions/relation_parsers/constraints_spec.rb'
-
'
spec/lib/gitlab/usage/metrics/names_suggestions/relation_parsers/joins_spec.rb'
-
'
spec/lib/gitlab/usage/metrics/instrumentations/database_metric_spec.rb'
-
'
spec/lib/gitlab/utils/usage_data_spec.rb'
-
'
spec/models/application_setting_spec.rb'
-
'
spec/models/project_feature_usage_spec.rb'
-
'
spec/models/users_statistics_spec.rb'
-
'
spec/requests/api/statistics_spec.rb'
-
'
spec/services/users/activity_service_spec.rb'
-
'
spec/support/caching.rb'
-
'
spec/support/gitlab/usage/metrics_instrumentation_shared_examples.rb'
...
...
@@ -2568,5 +2558,3 @@ Database/MultipleDatabases:
-
'
spec/support/helpers/usage_data_helpers.rb'
-
'
spec/tasks/gitlab/backup_rake_spec.rb'
-
'
spec/tasks/gitlab/db_rake_spec.rb'
-
'
spec/workers/analytics/usage_trends/counter_job_worker_spec.rb'
-
'
spec/workers/users/create_statistics_worker_spec.rb'
lib/api/rubygem_packages.rb
View file @
66b08296
...
...
@@ -101,7 +101,7 @@ module API
package_file
=
nil
A
ctiveRecord
::
Base
.
transaction
do
A
pplicationRecord
.
transaction
do
package
=
::
Packages
::
CreateTemporaryPackageService
.
new
(
user_project
,
current_user
,
declared_params
.
merge
(
build:
current_authenticated_job
)
).
execute
(
:rubygems
,
name:
::
Packages
::
Rubygems
::
TEMPORARY_PACKAGE_NAME
)
...
...
spec/features/admin/dashboard_spec.rb
View file @
66b08296
...
...
@@ -19,8 +19,8 @@ RSpec.describe 'admin visits dashboard' do
# Make sure the fork_networks & fork_networks reltuples have been updated
# to get a correct count on postgresql
ActiveRecord
::
Base
.
connection
.
execute
(
'ANALYZE fork_networks'
)
ActiveRecord
::
Base
.
connection
.
execute
(
'ANALYZE fork_network_members'
)
ForkNetwork
.
connection
.
execute
(
'ANALYZE fork_networks'
)
ForkNetwork
.
connection
.
execute
(
'ANALYZE fork_network_members'
)
visit
admin_root_path
...
...
spec/initializers/lograge_spec.rb
View file @
66b08296
...
...
@@ -212,7 +212,7 @@ RSpec.describe 'lograge', type: :request do
end
before
do
A
ctiveRecord
::
Base
.
connection
.
execute
(
'SELECT pg_sleep(0.1);'
)
A
pplicationRecord
.
connection
.
execute
(
'SELECT pg_sleep(0.1);'
)
end
context
'when RequestStore is enabled'
,
:request_store
do
...
...
spec/lib/gitlab/import_export/fast_hash_serializer_spec.rb
View file @
66b08296
...
...
@@ -190,7 +190,7 @@ RSpec.describe Gitlab::ImportExport::FastHashSerializer do
end
it
'does not complain about non UTF-8 characters in MR diff files'
do
ActiveRecord
::
Base
.
connection
.
execute
(
"UPDATE merge_request_diff_files SET diff = '---
\n
- :diff: !binary |-
\n
LS0tIC9kZXYvbnVsbAorKysgYi9pbWFnZXMvbnVjb3IucGRmCkBAIC0wLDAg
\n
KzEsMTY3OSBAQAorJVBERi0xLjUNJeLjz9MNCisxIDAgb2JqDTw8L01ldGFk
\n
YXR'"
)
MergeRequest
.
connection
.
execute
(
"UPDATE merge_request_diff_files SET diff = '---
\n
- :diff: !binary |-
\n
LS0tIC9kZXYvbnVsbAorKysgYi9pbWFnZXMvbnVjb3IucGRmCkBAIC0wLDAg
\n
KzEsMTY3OSBAQAorJVBERi0xLjUNJeLjz9MNCisxIDAgb2JqDTw8L01ldGFk
\n
YXR'"
)
expect
(
subject
[
'merge_requests'
].
first
[
'merge_request_diff'
]).
not_to
be_empty
end
...
...
spec/lib/gitlab/import_export/project/tree_saver_spec.rb
View file @
66b08296
...
...
@@ -386,7 +386,7 @@ RSpec.describe Gitlab::ImportExport::Project::TreeSaver do
end
it
'does not complain about non UTF-8 characters in MR diff files'
do
ActiveRecord
::
Bas
e
.
connection
.
execute
(
"UPDATE merge_request_diff_files SET diff = '---
\n
- :diff: !binary |-
\n
LS0tIC9kZXYvbnVsbAorKysgYi9pbWFnZXMvbnVjb3IucGRmCkBAIC0wLDAg
\n
KzEsMTY3OSBAQAorJVBERi0xLjUNJeLjz9MNCisxIDAgb2JqDTw8L01ldGFk
\n
YXR'"
)
MergeRequestDiffFil
e
.
connection
.
execute
(
"UPDATE merge_request_diff_files SET diff = '---
\n
- :diff: !binary |-
\n
LS0tIC9kZXYvbnVsbAorKysgYi9pbWFnZXMvbnVjb3IucGRmCkBAIC0wLDAg
\n
KzEsMTY3OSBAQAorJVBERi0xLjUNJeLjz9MNCisxIDAgb2JqDTw8L01ldGFk
\n
YXR'"
)
expect
(
project_tree_saver
.
save
).
to
be
true
end
...
...
spec/lib/gitlab/pagination/keyset/order_spec.rb
View file @
66b08296
...
...
@@ -8,7 +8,7 @@ RSpec.describe Gitlab::Pagination::Keyset::Order do
let
(
:order
)
{
nil
}
def
run_query
(
query
)
A
ctiveRecord
::
Base
.
connection
.
execute
(
query
).
to_a
A
pplicationRecord
.
connection
.
execute
(
query
).
to_a
end
def
build_query
(
order
:,
where_conditions:
nil
,
limit:
nil
)
...
...
spec/lib/gitlab/query_limiting/active_support_subscriber_spec.rb
View file @
66b08296
...
...
@@ -27,7 +27,7 @@ RSpec.describe Gitlab::QueryLimiting::ActiveSupportSubscriber do
context
'when the query is actually a rails cache hit'
do
it
'does not increment the number of executed SQL queries'
do
ActiveRecord
::
Base
.
connection
.
cache
do
User
.
connection
.
cache
do
User
.
count
User
.
count
end
...
...
spec/lib/gitlab/sidekiq_logging/structured_logger_spec.rb
View file @
66b08296
...
...
@@ -256,7 +256,7 @@ RSpec.describe Gitlab::SidekiqLogging::StructuredLogger do
expect
(
logger
).
to
receive
(
:info
).
with
(
expected_end_payload_with_db
).
ordered
call_subject
(
job
,
'test_queue'
)
do
A
ctiveRecord
::
Base
.
connection
.
execute
(
'SELECT pg_sleep(0.1);'
)
A
pplicationRecord
.
connection
.
execute
(
'SELECT pg_sleep(0.1);'
)
end
end
...
...
@@ -267,7 +267,7 @@ RSpec.describe Gitlab::SidekiqLogging::StructuredLogger do
expect
(
logger
).
to
receive
(
:info
).
with
(
expected_end_payload
).
ordered
call_subject
(
job
.
dup
,
'test_queue'
)
do
A
ctiveRecord
::
Base
.
connection
.
execute
(
'SELECT pg_sleep(0.1);'
)
A
pplicationRecord
.
connection
.
execute
(
'SELECT pg_sleep(0.1);'
)
end
Gitlab
::
SafeRequestStore
.
clear!
...
...
@@ -298,7 +298,7 @@ RSpec.describe Gitlab::SidekiqLogging::StructuredLogger do
allow
(
Gitlab
::
Database
::
LoadBalancing
).
to
receive
(
:enable?
).
and_return
(
true
)
end
let
(
:db_config_name
)
{
::
Gitlab
::
Database
.
db_config_name
(
A
ctiveRecord
::
Base
.
connection
)
}
let
(
:db_config_name
)
{
::
Gitlab
::
Database
.
db_config_name
(
A
pplicationRecord
.
connection
)
}
let
(
:expected_end_payload_with_db
)
do
expected_end_payload
.
merge
(
...
...
spec/models/application_setting_spec.rb
View file @
66b08296
...
...
@@ -927,7 +927,7 @@ RSpec.describe ApplicationSetting do
context
'when ApplicationSettings does not have a primary key'
do
before
do
allow
(
ActiveRecord
::
Base
.
connection
).
to
receive
(
:primary_key
).
with
(
described_class
.
table_name
).
and_return
(
nil
)
allow
(
described_class
.
connection
).
to
receive
(
:primary_key
).
with
(
described_class
.
table_name
).
and_return
(
nil
)
end
it
'raises an exception'
do
...
...
spec/requests/api/statistics_spec.rb
View file @
66b08296
...
...
@@ -63,7 +63,7 @@ RSpec.describe API::Statistics, 'Statistics' do
# Make sure the reltuples have been updated
# to get a correct count on postgresql
tables_to_analyze
.
each
do
|
table
|
A
ctiveRecord
::
Base
.
connection
.
execute
(
"ANALYZE
#{
table
}
"
)
A
pplicationRecord
.
connection
.
execute
(
"ANALYZE
#{
table
}
"
)
end
get
api
(
path
,
admin
)
...
...
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