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
28b459dd
Commit
28b459dd
authored
Dec 07, 2021
by
Alexandru Croitor
Committed by
Adam Hegyi
Dec 07, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow modules in class names of batched migrations
parent
ab991fa8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
7 deletions
+13
-7
lib/gitlab/database/background_migration/batched_migration.rb
...gitlab/database/background_migration/batched_migration.rb
+2
-2
spec/lib/gitlab/database/background_migration/batched_migration_spec.rb
...b/database/background_migration/batched_migration_spec.rb
+11
-5
No files found.
lib/gitlab/database/background_migration/batched_migration.rb
View file @
28b459dd
...
...
@@ -94,11 +94,11 @@ module Gitlab
end
def
job_class_name
=
(
class_name
)
write_attribute
(
:job_class_name
,
class_name
.
de
modulize
)
write_attribute
(
:job_class_name
,
class_name
.
de
lete_prefix
(
"::"
)
)
end
def
batch_class_name
=
(
class_name
)
write_attribute
(
:batch_class_name
,
class_name
.
de
modulize
)
write_attribute
(
:batch_class_name
,
class_name
.
de
lete_prefix
(
"::"
)
)
end
def
migrated_tuple_count
...
...
spec/lib/gitlab/database/background_migration/batched_migration_spec.rb
View file @
28b459dd
...
...
@@ -236,14 +236,20 @@ RSpec.describe Gitlab::Database::BackgroundMigration::BatchedMigration, type: :m
end
end
shared_examples_for
'an attr_writer that
demodulizes assigned
class names'
do
|
attribute_name
|
shared_examples_for
'an attr_writer that
assigns
class names'
do
|
attribute_name
|
let
(
:batched_migration
)
{
build
(
:batched_background_migration
)
}
context
'when a module name exists'
do
it
'removes the module name'
do
it
'keeps the class with module name'
do
batched_migration
.
public_send
(
:"
#{
attribute_name
}
="
,
'Foo::Bar'
)
expect
(
batched_migration
[
attribute_name
]).
to
eq
(
'Foo::Bar'
)
end
it
'removes leading namespace resolution operator'
do
batched_migration
.
public_send
(
:"
#{
attribute_name
}
="
,
'::Foo::Bar'
)
expect
(
batched_migration
[
attribute_name
]).
to
eq
(
'Bar'
)
expect
(
batched_migration
[
attribute_name
]).
to
eq
(
'
Foo::
Bar'
)
end
end
...
...
@@ -293,11 +299,11 @@ RSpec.describe Gitlab::Database::BackgroundMigration::BatchedMigration, type: :m
end
describe
'#job_class_name='
do
it_behaves_like
'an attr_writer that
demodulizes assigned
class names'
,
:job_class_name
it_behaves_like
'an attr_writer that
assigns
class names'
,
:job_class_name
end
describe
'#batch_class_name='
do
it_behaves_like
'an attr_writer that
demodulizes assigned
class names'
,
:batch_class_name
it_behaves_like
'an attr_writer that
assigns
class names'
,
:batch_class_name
end
describe
'#migrated_tuple_count'
do
...
...
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