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
433b6fed
Commit
433b6fed
authored
Jul 21, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Copy-edit background migrations guidelines
parent
367a8955
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
7 deletions
+13
-7
doc/development/background_migrations.md
doc/development/background_migrations.md
+13
-7
No files found.
doc/development/background_migrations.md
View file @
433b6fed
...
@@ -40,7 +40,7 @@ and idempotent.
...
@@ -40,7 +40,7 @@ and idempotent.
See
[
Sidekiq best practices guidelines
](
https://github.com/mperham/sidekiq/wiki/Best-Practices
)
See
[
Sidekiq best practices guidelines
](
https://github.com/mperham/sidekiq/wiki/Best-Practices
)
for more details.
for more details.
Make sure that in case that your migration job is going to be retried
a
data
Make sure that in case that your migration job is going to be retried data
integrity is guarateed.
integrity is guarateed.
## How It Works
## How It Works
...
@@ -227,18 +227,24 @@ the `services.properties` column.
...
@@ -227,18 +227,24 @@ the `services.properties` column.
## Testing
## Testing
It is possible to test a background migrations scheduling migration and a
It is required to write tests for background migrations' scheduling migration
cleanup migration using
`:migration`
RSpec tag. See README in specs/migration/
(either a regular migration or a post deployment migration), background
directory.
migration itself and a cleanup migration. You can use the
`:migration`
RSpec
tag when testing a regular / post deployment migration.
See
[
README
][
migrations-readme
]
.
When you do that, keep in mind that
`before`
and
`after`
RSpec hooks are going
When you do that, keep in mind that
`before`
and
`after`
RSpec hooks are going
to migrate you database down and up, which can result in
an
other background
to migrate you database down and up, which can result in other background
migrations being called. That means that using
`spy`
test doubles with
migrations being called. That means that using
`spy`
test doubles with
`have_received`
is encouraged, instead of using regular test doubles, because
`have_received`
is encouraged, instead of using regular test doubles, because
your expectation defined in a
`it`
block can conflict with what is being
your expectations defined in a
`it`
block can conflict with what is being
called in RSpec hooks. See gitlab-org/gitlab-ce#35351 for more details.
called in RSpec hooks. See
[
gitlab-org/gitlab-ce#35351
][
issue-rspec-hooks
]
for more details.
## Best practices
## Best practices
1.
Make sure that background migration jobs are idempotent.
1.
Make sure that background migration jobs are idempotent.
1.
Make sure that tests you write are not false positives.
1.
Make sure that tests you write are not false positives.
[
migrations-readme
]:
https://gitlab.com/gitlab-org/gitlab-ce/blob/master/spec/migrations/README.md
[
issue-rspec-hooks
]:
https://gitlab.com/gitlab-org/gitlab-ce/issues/35351
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