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
acd2f8fa
Commit
acd2f8fa
authored
Nov 22, 2021
by
Thong Kuah
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename to more accurate name for adding a CI connection if not present
parent
6eeb7b3e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
7 deletions
+8
-7
spec/lib/gitlab/database/query_analyzers/gitlab_schemas_metrics_spec.rb
...b/database/query_analyzers/gitlab_schemas_metrics_spec.rb
+1
-1
spec/support/database/multiple_databases.rb
spec/support/database/multiple_databases.rb
+4
-3
spec/support_specs/database/multiple_databases_spec.rb
spec/support_specs/database/multiple_databases_spec.rb
+3
-3
No files found.
spec/lib/gitlab/database/query_analyzers/gitlab_schemas_metrics_spec.rb
View file @
acd2f8fa
...
...
@@ -17,7 +17,7 @@ RSpec.describe Gitlab::Database::QueryAnalyzers::GitlabSchemasMetrics, query_ana
process_sql
(
ActiveRecord
::
Base
,
"SELECT 1 FROM projects"
)
end
context
'properly observes all queries'
,
:
mocke
d_ci_connection
do
context
'properly observes all queries'
,
:
ad
d_ci_connection
do
using
RSpec
::
Parameterized
::
TableSyntax
where
do
...
...
spec/support/database/multiple_databases.rb
View file @
acd2f8fa
...
...
@@ -51,8 +51,9 @@ module Database
end
# rubocop:enable Database/MultipleDatabases
def
with_
mock
ed_ci_connection
def
with_
add
ed_ci_connection
if
Gitlab
::
Database
.
has_config?
(
:ci
)
# No need to add a ci: connection if we already have one
yield
else
with_reestablished_active_record_base
(
reconnect:
true
)
do
...
...
@@ -92,8 +93,8 @@ RSpec.configure do |config|
end
end
config
.
around
(
:each
,
:
mocke
d_ci_connection
)
do
|
example
|
with_
mock
ed_ci_connection
do
config
.
around
(
:each
,
:
ad
d_ci_connection
)
do
|
example
|
with_
add
ed_ci_connection
do
example
.
run
end
end
...
...
spec/support_specs/database/multiple_databases_spec.rb
View file @
acd2f8fa
...
...
@@ -57,7 +57,7 @@ RSpec.describe 'Database::MultipleDatabases' do
end
end
describe
'.with_
mock
ed_ci_connection'
do
describe
'.with_
add
ed_ci_connection'
do
context
'when only a single database is setup'
do
before
do
skip_if_multiple_databases_are_setup
...
...
@@ -67,7 +67,7 @@ RSpec.describe 'Database::MultipleDatabases' do
main_database
=
current_database
(
ActiveRecord
::
Base
)
original_database
=
current_database
(
Ci
::
ApplicationRecord
)
with_
mock
ed_ci_connection
do
with_
add
ed_ci_connection
do
expect
(
current_database
(
Ci
::
ApplicationRecord
)).
to
eq
(
main_database
)
end
...
...
@@ -83,7 +83,7 @@ RSpec.describe 'Database::MultipleDatabases' do
it
'does not mock the original Ci::ApplicationRecord connection'
,
:aggregate_failures
do
original_database
=
current_database
(
Ci
::
ApplicationRecord
)
with_
mock
ed_ci_connection
do
with_
add
ed_ci_connection
do
expect
(
current_database
(
Ci
::
ApplicationRecord
)).
to
eq
(
original_database
)
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