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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
9106975d
Commit
9106975d
authored
Sep 12, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Steal stages statuses migration
parent
bff004d4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
0 deletions
+50
-0
db/migrate/20170912113435_clean_stages_statuses_migration.rb
db/migrate/20170912113435_clean_stages_statuses_migration.rb
+15
-0
spec/migrations/clean_stages_statuses_migration_spec.rb
spec/migrations/clean_stages_statuses_migration_spec.rb
+35
-0
No files found.
db/migrate/20170912113435_clean_stages_statuses_migration.rb
0 → 100644
View file @
9106975d
class
CleanStagesStatusesMigration
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
def
up
Gitlab
::
BackgroundMigration
.
steal
(
'MigrateStageStatus'
)
end
def
down
# noop
end
end
spec/migrations/clean_stages_statuses_migration_spec.rb
0 → 100644
View file @
9106975d
require
'spec_helper'
require
Rails
.
root
.
join
(
'db'
,
'migrate'
,
'20170912113435_clean_stages_statuses_migration.rb'
)
describe
CleanStagesStatusesMigration
,
:migration
,
:sidekiq
,
:redis
do
let
(
:migration
)
{
spy
(
'migration'
)
}
before
do
allow
(
Gitlab
::
BackgroundMigration
::
MigrateStageStatus
)
.
to
receive
(
:new
).
and_return
(
migration
)
end
context
'when there are pending background migrations'
do
it
'processes pending jobs synchronously'
do
Sidekiq
::
Testing
.
disable!
do
BackgroundMigrationWorker
.
perform_in
(
2
.
minutes
,
'MigrateStageStatus'
,
[
1
,
1
])
BackgroundMigrationWorker
.
perform_async
(
'MigrateStageStatus'
,
[
1
,
1
])
migrate!
expect
(
migration
).
to
have_received
(
:perform
).
with
(
1
,
1
).
twice
end
end
end
context
'when there are no background migrations pending'
do
it
'does nothing'
do
Sidekiq
::
Testing
.
disable!
do
migrate!
expect
(
migration
).
not_to
have_received
(
:perform
)
end
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