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
2cc94060
Commit
2cc94060
authored
Sep 29, 2020
by
Andreas Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specs for gitlab:db:drop_tables
parent
915ac9c6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
0 deletions
+36
-0
spec/tasks/gitlab/db_rake_spec.rb
spec/tasks/gitlab/db_rake_spec.rb
+36
-0
No files found.
spec/tasks/gitlab/db_rake_spec.rb
View file @
2cc94060
...
...
@@ -164,6 +164,42 @@ RSpec.describe 'gitlab:db namespace rake task' do
end
end
describe
'drop_tables'
,
:focus
do
subject
{
run_rake_task
(
'gitlab:db:drop_tables'
)
}
let
(
:tables
)
{
%w(one two)
}
let
(
:views
)
{
%w(three four)
}
let
(
:connection
)
{
ActiveRecord
::
Base
.
connection
}
before
do
allow
(
connection
).
to
receive
(
:execute
).
and_return
(
nil
)
allow
(
connection
).
to
receive
(
:tables
).
and_return
(
tables
)
allow
(
connection
).
to
receive
(
:views
).
and_return
(
views
)
end
it
'drops all tables, except schema_migrations'
do
expect
(
connection
).
to
receive
(
:execute
).
with
(
'DROP TABLE IF EXISTS "one" CASCADE'
)
expect
(
connection
).
to
receive
(
:execute
).
with
(
'DROP TABLE IF EXISTS "two" CASCADE'
)
subject
end
it
'truncates schema_migrations table'
do
expect
(
connection
).
to
receive
(
:execute
).
with
(
'TRUNCATE schema_migrations'
)
subject
end
it
'drops extra schemas'
do
Gitlab
::
Database
::
EXTRA_SCHEMAS
.
each
do
|
schema
|
expect
(
connection
).
to
receive
(
:execute
).
with
(
"DROP SCHEMA IF EXISTS
\"
#{
schema
}
\"
"
)
end
subject
end
end
describe
'reindex'
do
let
(
:reindex
)
{
double
(
'reindex'
)
}
let
(
:indexes
)
{
double
(
'indexes'
)
}
...
...
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