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
Boxiang Sun
gitlab-ce
Commits
39dce43a
Commit
39dce43a
authored
Nov 16, 2017
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
De-duplicate background migration matchers defined in spec/support/migrations_helpers.rb
parent
d41e66cb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
32 deletions
+6
-32
spec/migrations/schedule_merge_request_diff_migrations_spec.rb
...migrations/schedule_merge_request_diff_migrations_spec.rb
+3
-16
spec/migrations/schedule_merge_request_diff_migrations_take_two_spec.rb
...s/schedule_merge_request_diff_migrations_take_two_spec.rb
+3
-16
No files found.
spec/migrations/schedule_merge_request_diff_migrations_spec.rb
View file @
39dce43a
...
...
@@ -2,19 +2,6 @@ require 'spec_helper'
require
Rails
.
root
.
join
(
'db'
,
'post_migrate'
,
'20170703130158_schedule_merge_request_diff_migrations'
)
describe
ScheduleMergeRequestDiffMigrations
,
:migration
,
:sidekiq
do
matcher
:be_scheduled_migration
do
|
time
,
*
expected
|
match
do
|
migration
|
BackgroundMigrationWorker
.
jobs
.
any?
do
|
job
|
job
[
'args'
]
==
[
migration
,
expected
]
&&
job
[
'at'
].
to_i
==
time
.
to_i
end
end
failure_message
do
|
migration
|
"Migration `
#{
migration
}
` with args `
#{
expected
.
inspect
}
` not scheduled!"
end
end
let
(
:merge_request_diffs
)
{
table
(
:merge_request_diffs
)
}
let
(
:merge_requests
)
{
table
(
:merge_requests
)
}
let
(
:projects
)
{
table
(
:projects
)
}
...
...
@@ -37,9 +24,9 @@ describe ScheduleMergeRequestDiffMigrations, :migration, :sidekiq do
Timecop
.
freeze
do
migrate!
expect
(
described_class
::
MIGRATION
).
to
be_scheduled_migration
(
5
.
minutes
.
from_now
,
1
,
1
)
expect
(
described_class
::
MIGRATION
).
to
be_scheduled_migration
(
10
.
minutes
.
from_now
,
2
,
2
)
expect
(
described_class
::
MIGRATION
).
to
be_scheduled_migration
(
15
.
minutes
.
from_now
,
4
,
4
)
expect
(
described_class
::
MIGRATION
).
to
be_scheduled_migration
(
5
.
minutes
,
1
,
1
)
expect
(
described_class
::
MIGRATION
).
to
be_scheduled_migration
(
10
.
minutes
,
2
,
2
)
expect
(
described_class
::
MIGRATION
).
to
be_scheduled_migration
(
15
.
minutes
,
4
,
4
)
expect
(
BackgroundMigrationWorker
.
jobs
.
size
).
to
eq
3
end
end
...
...
spec/migrations/schedule_merge_request_diff_migrations_take_two_spec.rb
View file @
39dce43a
...
...
@@ -2,19 +2,6 @@ require 'spec_helper'
require
Rails
.
root
.
join
(
'db'
,
'post_migrate'
,
'20170926150348_schedule_merge_request_diff_migrations_take_two'
)
describe
ScheduleMergeRequestDiffMigrationsTakeTwo
,
:migration
,
:sidekiq
do
matcher
:be_scheduled_migration
do
|
time
,
*
expected
|
match
do
|
migration
|
BackgroundMigrationWorker
.
jobs
.
any?
do
|
job
|
job
[
'args'
]
==
[
migration
,
expected
]
&&
job
[
'at'
].
to_i
==
time
.
to_i
end
end
failure_message
do
|
migration
|
"Migration `
#{
migration
}
` with args `
#{
expected
.
inspect
}
` not scheduled!"
end
end
let
(
:merge_request_diffs
)
{
table
(
:merge_request_diffs
)
}
let
(
:merge_requests
)
{
table
(
:merge_requests
)
}
let
(
:projects
)
{
table
(
:projects
)
}
...
...
@@ -37,9 +24,9 @@ describe ScheduleMergeRequestDiffMigrationsTakeTwo, :migration, :sidekiq do
Timecop
.
freeze
do
migrate!
expect
(
described_class
::
MIGRATION
).
to
be_scheduled_migration
(
10
.
minutes
.
from_now
,
1
,
1
)
expect
(
described_class
::
MIGRATION
).
to
be_scheduled_migration
(
20
.
minutes
.
from_now
,
2
,
2
)
expect
(
described_class
::
MIGRATION
).
to
be_scheduled_migration
(
30
.
minutes
.
from_now
,
4
,
4
)
expect
(
described_class
::
MIGRATION
).
to
be_scheduled_migration
(
10
.
minutes
,
1
,
1
)
expect
(
described_class
::
MIGRATION
).
to
be_scheduled_migration
(
20
.
minutes
,
2
,
2
)
expect
(
described_class
::
MIGRATION
).
to
be_scheduled_migration
(
30
.
minutes
,
4
,
4
)
expect
(
BackgroundMigrationWorker
.
jobs
.
size
).
to
eq
3
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