Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-07-21 12:02:54 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-07-21 14:19:35 +0300
commit433b6fed2981b744833fe701ce9eb5b7f2374ed1 (patch)
tree748d3ff5ff15cbcccc3fbbc122eb523d33046be7 /doc/development/background_migrations.md
parent367a89551165c5ca5d540bf58c2b428db1b57462 (diff)
Copy-edit background migrations guidelines
Diffstat (limited to 'doc/development/background_migrations.md')
-rw-r--r--doc/development/background_migrations.md20
1 files changed, 13 insertions, 7 deletions
diff --git a/doc/development/background_migrations.md b/doc/development/background_migrations.md
index a4bf0287412..e67db9ff142 100644
--- a/doc/development/background_migrations.md
+++ b/doc/development/background_migrations.md
@@ -40,7 +40,7 @@ and idempotent.
See [Sidekiq best practices guidelines](https://github.com/mperham/sidekiq/wiki/Best-Practices)
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.
## How It Works
@@ -227,18 +227,24 @@ the `services.properties` column.
## Testing
-It is possible to test a background migrations scheduling migration and a
-cleanup migration using `:migration` RSpec tag. See README in specs/migration/
-directory.
+It is required to write tests for background migrations' scheduling migration
+(either a regular migration or a post deployment migration), background
+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
-to migrate you database down and up, which can result in another 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
`have_received` is encouraged, instead of using regular test doubles, because
-your expectation defined in a `it` block can conflict with what is being
-called in RSpec hooks. See gitlab-org/gitlab-ce#35351 for more details.
+your expectations defined in a `it` block can conflict with what is being
+called in RSpec hooks. See [gitlab-org/gitlab-ce#35351][issue-rspec-hooks]
+for more details.
## Best practices
1. Make sure that background migration jobs are idempotent.
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