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
44d218ee
Commit
44d218ee
authored
Jul 12, 2021
by
Simon Tomlinson
Committed by
Andreas Brandl
Jul 13, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve subject name in partition_manager_spec
parent
4323b1c3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
11 deletions
+9
-11
spec/lib/gitlab/database/partitioning/partition_manager_spec.rb
...ib/gitlab/database/partitioning/partition_manager_spec.rb
+9
-11
No files found.
spec/lib/gitlab/database/partitioning/partition_manager_spec.rb
View file @
44d218ee
...
...
@@ -16,7 +16,7 @@ RSpec.describe Gitlab::Database::Partitioning::PartitionManager do
end
context
'creating partitions (mocked)'
do
subject
{
described_class
.
new
(
models
).
sync_partitions
}
subject
(
:sync_partitions
)
{
described_class
.
new
(
models
).
sync_partitions
}
let
(
:models
)
{
[
model
]
}
let
(
:model
)
{
double
(
partitioning_strategy:
partitioning_strategy
,
table_name:
table
)
}
...
...
@@ -42,7 +42,7 @@ RSpec.describe Gitlab::Database::Partitioning::PartitionManager do
expect
(
ActiveRecord
::
Base
.
connection
).
to
receive
(
:execute
).
with
(
partitions
.
first
.
to_sql
)
expect
(
ActiveRecord
::
Base
.
connection
).
to
receive
(
:execute
).
with
(
partitions
.
second
.
to_sql
)
s
ubject
s
ync_partitions
end
context
'error handling with 2 models'
do
...
...
@@ -61,13 +61,13 @@ RSpec.describe Gitlab::Database::Partitioning::PartitionManager do
expect
(
ActiveRecord
::
Base
.
connection
).
to
receive
(
:execute
).
with
(
partitions
.
first
.
to_sql
)
expect
(
ActiveRecord
::
Base
.
connection
).
to
receive
(
:execute
).
with
(
partitions
.
second
.
to_sql
)
s
ubject
s
ync_partitions
end
end
end
context
'creating partitions'
do
subject
{
described_class
.
new
([
my_model
]).
sync_partitions
}
subject
(
:sync_partitions
)
{
described_class
.
new
([
my_model
]).
sync_partitions
}
let
(
:connection
)
{
ActiveRecord
::
Base
.
connection
}
let
(
:my_model
)
do
...
...
@@ -89,14 +89,12 @@ RSpec.describe Gitlab::Database::Partitioning::PartitionManager do
end
it
'creates partitions'
do
expect
{
subject
}.
to
change
{
find_partitions
(
my_model
.
table_name
,
schema:
Gitlab
::
Database
::
DYNAMIC_PARTITIONS_SCHEMA
).
size
}.
from
(
0
)
subject
expect
{
sync_partitions
}.
to
change
{
find_partitions
(
my_model
.
table_name
,
schema:
Gitlab
::
Database
::
DYNAMIC_PARTITIONS_SCHEMA
).
size
}.
from
(
0
)
end
end
context
'detaching partitions (mocked)'
do
subject
{
manager
.
sync_partitions
}
subject
(
:sync_partitions
)
{
manager
.
sync_partitions
}
let
(
:manager
)
{
described_class
.
new
(
models
)
}
let
(
:models
)
{
[
model
]
}
...
...
@@ -125,7 +123,7 @@ RSpec.describe Gitlab::Database::Partitioning::PartitionManager do
it
'detaches each extra partition'
do
extra_partitions
.
each
{
|
p
|
expect
(
manager
).
to
receive
(
:detach_one_partition
).
with
(
p
)
}
s
ubject
s
ync_partitions
end
context
'error handling'
do
...
...
@@ -142,7 +140,7 @@ RSpec.describe Gitlab::Database::Partitioning::PartitionManager do
expect
(
error_strategy
).
to
receive
(
:extra_partitions
).
and_raise
(
'injected error!'
)
extra_partitions
.
each
{
|
p
|
expect
(
manager
).
to
receive
(
:detach_one_partition
).
with
(
p
)
}
s
ubject
s
ync_partitions
end
end
end
...
...
@@ -154,7 +152,7 @@ RSpec.describe Gitlab::Database::Partitioning::PartitionManager do
it
'returns immediately'
do
expect
(
manager
).
not_to
receive
(
:detach
)
s
ubject
s
ync_partitions
end
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