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
0f8d7012
Commit
0f8d7012
authored
Sep 02, 2017
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Make it possible to provide schema version in tests"
This reverts commit
775cee73
.
parent
2cec1c54
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
24 deletions
+25
-24
spec/lib/gitlab/background_migration/migrate_events_to_push_event_payloads_spec.rb
...d_migration/migrate_events_to_push_event_payloads_spec.rb
+16
-5
spec/spec_helper.rb
spec/spec_helper.rb
+9
-4
spec/support/migrations_helpers.rb
spec/support/migrations_helpers.rb
+0
-15
No files found.
spec/lib/gitlab/background_migration/migrate_events_to_push_event_payloads_spec.rb
View file @
0f8d7012
...
@@ -210,11 +210,7 @@ describe Gitlab::BackgroundMigration::MigrateEventsToPushEventPayloads::Event do
...
@@ -210,11 +210,7 @@ describe Gitlab::BackgroundMigration::MigrateEventsToPushEventPayloads::Event do
end
end
end
end
##
describe
Gitlab
::
BackgroundMigration
::
MigrateEventsToPushEventPayloads
do
# The background migration relies on a temporary table, hence we're migrating
# to a specific version of the database where said table is still present.
#
describe
Gitlab
::
BackgroundMigration
::
MigrateEventsToPushEventPayloads
,
:migration
,
schema:
20170608152748
do
let
(
:migration
)
{
described_class
.
new
}
let
(
:migration
)
{
described_class
.
new
}
let
(
:project
)
{
create
(
:project_empty_repo
)
}
let
(
:project
)
{
create
(
:project_empty_repo
)
}
let
(
:author
)
{
create
(
:user
)
}
let
(
:author
)
{
create
(
:user
)
}
...
@@ -233,6 +229,21 @@ describe Gitlab::BackgroundMigration::MigrateEventsToPushEventPayloads, :migrati
...
@@ -233,6 +229,21 @@ describe Gitlab::BackgroundMigration::MigrateEventsToPushEventPayloads, :migrati
)
)
end
end
# The background migration relies on a temporary table, hence we're migrating
# to a specific version of the database where said table is still present.
before
:all
do
ActiveRecord
::
Migration
.
verbose
=
false
ActiveRecord
::
Migrator
.
migrate
(
ActiveRecord
::
Migrator
.
migrations_paths
,
20170608152748
)
end
after
:all
do
ActiveRecord
::
Migrator
.
migrate
(
ActiveRecord
::
Migrator
.
migrations_paths
)
ActiveRecord
::
Migration
.
verbose
=
true
end
describe
'#perform'
do
describe
'#perform'
do
it
'returns if data should not be migrated'
do
it
'returns if data should not be migrated'
do
allow
(
migration
).
to
receive
(
:migrate?
).
and_return
(
false
)
allow
(
migration
).
to
receive
(
:migrate?
).
and_return
(
false
)
...
...
spec/spec_helper.rb
View file @
0f8d7012
...
@@ -136,12 +136,17 @@ RSpec.configure do |config|
...
@@ -136,12 +136,17 @@ RSpec.configure do |config|
Sidekiq
.
redis
(
&
:flushall
)
Sidekiq
.
redis
(
&
:flushall
)
end
end
config
.
before
(
:context
,
:migration
)
do
config
.
before
(
:example
,
:migration
)
do
schema_migrate_down!
ActiveRecord
::
Migrator
.
migrate
(
migrations_paths
,
previous_migration
.
version
)
reset_column_in_migration_models
end
end
config
.
after
(
:context
,
:migration
)
do
config
.
after
(
:example
,
:migration
)
do
schema_migrate_up!
ActiveRecord
::
Migrator
.
migrate
(
migrations_paths
)
reset_column_in_migration_models
end
end
config
.
around
(
:each
,
:nested_groups
)
do
|
example
|
config
.
around
(
:each
,
:nested_groups
)
do
|
example
|
...
...
spec/support/migrations_helpers.rb
View file @
0f8d7012
...
@@ -33,21 +33,6 @@ module MigrationsHelpers
...
@@ -33,21 +33,6 @@ module MigrationsHelpers
end
end
end
end
def
migration_schema_version
self
.
class
.
metadata
[
:schema
]
||
previous_migration
.
version
end
def
schema_migrate_down!
ActiveRecord
::
Migrator
.
migrate
(
migrations_paths
,
migration_schema_version
)
reset_column_in_migration_models
end
def
schema_migrate_up!
ActiveRecord
::
Migrator
.
migrate
(
migrations_paths
)
reset_column_in_migration_models
end
def
migrate!
def
migrate!
ActiveRecord
::
Migrator
.
up
(
migrations_paths
)
do
|
migration
|
ActiveRecord
::
Migrator
.
up
(
migrations_paths
)
do
|
migration
|
migration
.
name
==
described_class
.
name
migration
.
name
==
described_class
.
name
...
...
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