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
597b6874
Commit
597b6874
authored
May 06, 2021
by
Thong Kuah
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Properly assert that AR has disabled prepared statements
parent
d780b8ba
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
7 deletions
+12
-7
ee/spec/lib/ee/gitlab/database_spec.rb
ee/spec/lib/ee/gitlab/database_spec.rb
+12
-7
No files found.
ee/spec/lib/ee/gitlab/database_spec.rb
View file @
597b6874
...
...
@@ -61,19 +61,24 @@ RSpec.describe Gitlab::Database do
end
describe
'.disable_prepared_statements'
do
it
'disables prepared statements'
do
config
=
{}
around
do
|
example
|
original_config
=
::
Gitlab
::
Database
.
config
example
.
run
expect
(
ActiveRecord
::
Base
.
configurations
).
to
receive
(
:[]
)
.
with
(
Rails
.
env
)
.
and_return
(
config
)
ActiveRecord
::
Base
.
establish_connection
(
original_config
)
end
it
'disables prepared statements'
do
ActiveRecord
::
Base
.
establish_connection
(
::
Gitlab
::
Database
.
config
.
merge
(
prepared_statements:
true
))
expect
(
ActiveRecord
::
Base
.
connection
.
prepared_statements
).
to
eq
(
true
)
expect
(
ActiveRecord
::
Base
).
to
receive
(
:establish_connection
)
.
with
(
{
'prepared_statements'
=>
false
})
.
with
(
a_hash_including
({
'prepared_statements'
=>
false
})).
and_call_original
described_class
.
disable_prepared_statements
expect
(
config
[
'prepared_statements'
]
).
to
eq
(
false
)
expect
(
ActiveRecord
::
Base
.
connection
.
prepared_statements
).
to
eq
(
false
)
end
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