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
dd8713aa
Commit
dd8713aa
authored
Feb 09, 2022
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Connect to the proper database while testing Geo migrations
parent
6dd69bb1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
8 deletions
+20
-8
ee/db/geo/migrate/20180402170913_add_missing_on_primary_to_job_artifact_registry..rb
...70913_add_missing_on_primary_to_job_artifact_registry..rb
+1
-1
ee/spec/migrations/geo/fix_state_column_in_file_registry_spec.rb
.../migrations/geo/fix_state_column_in_file_registry_spec.rb
+1
-1
ee/spec/migrations/geo/fix_state_column_in_lfs_object_registry_spec.rb
...tions/geo/fix_state_column_in_lfs_object_registry_spec.rb
+5
-5
ee/spec/support/helpers/ee/migrations_helpers.rb
ee/spec/support/helpers/ee/migrations_helpers.rb
+13
-1
No files found.
ee/db/geo/migrate/20180402170913_add_missing_on_primary_to_job_artifact_registry..rb
View file @
dd8713aa
...
...
@@ -12,6 +12,6 @@ class AddMissingOnPrimaryToJobArtifactRegistry < ActiveRecord::Migration[4.2]
end
def
down
remove_column
:job_artifact_registry
,
:missing_on_primary
remove_column
:job_artifact_registry
,
:missing_on_primary
if
column_exists?
(
:job_artifact_registry
,
:missing_on_primary
)
end
end
ee/spec/migrations/geo/fix_state_column_in_file_registry_spec.rb
View file @
dd8713aa
...
...
@@ -4,7 +4,7 @@ require 'spec_helper'
require_migration!
RSpec
.
describe
FixStateColumnInFileRegistry
do
RSpec
.
describe
FixStateColumnInFileRegistry
,
:geo
do
let
(
:registry
)
{
table
(
:file_registry
)
}
it
'correctly sets registry state value'
do
...
...
ee/spec/migrations/geo/fix_state_column_in_lfs_object_registry_spec.rb
View file @
dd8713aa
...
...
@@ -4,7 +4,7 @@ require 'spec_helper'
require_migration!
RSpec
.
describe
FixStateColumnInLfsObjectRegistry
do
RSpec
.
describe
FixStateColumnInLfsObjectRegistry
,
:geo
do
let
(
:registry
)
{
table
(
:lfs_object_registry
)
}
before
do
...
...
@@ -19,12 +19,12 @@ RSpec.describe FixStateColumnInLfsObjectRegistry do
pending_registries
=
registry
.
where
(
state:
0
)
synced_registries
=
registry
.
where
(
state:
2
)
expect
(
pending_registries
.
pluck
(
:id
)).
to
contain_exactly
(
1
,
2
)
expect
(
synced_registries
.
pluck
(
:id
)).
to
contain_exactly
(
4
)
expect
(
pending_registries
.
pluck
(
:
lfs_object_
id
)).
to
contain_exactly
(
1
,
2
)
expect
(
synced_registries
.
pluck
(
:
lfs_object_
id
)).
to
contain_exactly
(
4
)
migrate!
expect
(
pending_registries
.
pluck
(
:id
)).
to
contain_exactly
(
1
)
expect
(
synced_registries
.
pluck
(
:id
)).
to
contain_exactly
(
2
,
4
)
expect
(
pending_registries
.
pluck
(
:
lfs_object_
id
)).
to
contain_exactly
(
1
)
expect
(
synced_registries
.
pluck
(
:
lfs_object_
id
)).
to
contain_exactly
(
2
,
4
)
end
end
ee/spec/support/helpers/ee/migrations_helpers.rb
View file @
dd8713aa
...
...
@@ -45,12 +45,24 @@ module EE
def
with_db_config
(
&
block
)
if
geo_migration?
::
Geo
::
TrackingBase
.
connected_to
(
database: :geo
)
{
yield
}
with_added_geo_connection
{
yield
}
else
yield
end
end
def
with_added_geo_connection
with_reestablished_active_record_base
(
reconnect:
true
)
do
reconfigure_db_connection
(
name: :geo
,
config_model:
Geo
::
TrackingBase
,
model:
ActiveRecord
::
Base
)
yield
end
end
def
geo_migration?
self
.
class
.
metadata
[
:geo
]
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