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
Jérome Perrin
gitlab-ce
Commits
acfb8464
Commit
acfb8464
authored
Jan 05, 2018
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix static anylysy
parent
b8a275d3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
9 deletions
+10
-9
db/post_migrate/20171124104327_migrate_kubernetes_service_to_new_clusters_architectures.rb
...grate_kubernetes_service_to_new_clusters_architectures.rb
+3
-2
spec/migrations/migrate_kubernetes_service_to_new_clusters_architectures_spec.rb
..._kubernetes_service_to_new_clusters_architectures_spec.rb
+7
-7
No files found.
db/post_migrate/20171124104327_migrate_kubernetes_service_to_new_clusters_architectures.rb
View file @
acfb8464
...
@@ -85,9 +85,10 @@ class MigrateKubernetesServiceToNewClustersArchitectures < ActiveRecord::Migrati
...
@@ -85,9 +85,10 @@ class MigrateKubernetesServiceToNewClustersArchitectures < ActiveRecord::Migrati
unique_iid
=
0
unique_iid
=
0
# If it's still conflicted, finding an unique environment scope incrementaly
# If it's still conflicted, finding an unique environment scope incrementaly
while
true
loop
do
candidate
=
"migrated
#{
unique_iid
}
/*"
candidate
=
"migrated
#{
unique_iid
}
/*"
return
candidate
if
environment_scopes
.
exclude?
(
candidate
)
return
candidate
if
environment_scopes
.
exclude?
(
candidate
)
unique_iid
+=
1
unique_iid
+=
1
end
end
end
end
...
...
spec/migrations/migrate_kubernetes_service_to_new_clusters_architectures_spec.rb
View file @
acfb8464
...
@@ -19,7 +19,7 @@ describe MigrateKubernetesServiceToNewClustersArchitectures, :migration do
...
@@ -19,7 +19,7 @@ describe MigrateKubernetesServiceToNewClustersArchitectures, :migration do
end
end
it
'migrates the KubernetesService to Platform::Kubernetes'
do
it
'migrates the KubernetesService to Platform::Kubernetes'
do
expect
{
migrate!
}.
to
change
{
Clusters
::
Cluster
.
count
}.
by
(
sample_num
)
expect
{
migrate!
}.
to
change
{
Clusters
::
Cluster
.
count
}.
by
(
sample_num
)
projects
.
each
do
|
project
|
projects
.
each
do
|
project
|
project
.
clusters
.
last
.
tap
do
|
cluster
|
project
.
clusters
.
last
.
tap
do
|
cluster
|
...
@@ -76,7 +76,7 @@ describe MigrateKubernetesServiceToNewClustersArchitectures, :migration do
...
@@ -76,7 +76,7 @@ describe MigrateKubernetesServiceToNewClustersArchitectures, :migration do
end
end
it
'migrates the KubernetesService to Platform::Kubernetes without template'
do
it
'migrates the KubernetesService to Platform::Kubernetes without template'
do
expect
{
migrate!
}.
to
change
{
Clusters
::
Cluster
.
count
}.
by
(
sample_num
)
expect
{
migrate!
}.
to
change
{
Clusters
::
Cluster
.
count
}.
by
(
sample_num
)
projects
.
each
do
|
project
|
projects
.
each
do
|
project
|
project
.
clusters
.
last
.
tap
do
|
cluster
|
project
.
clusters
.
last
.
tap
do
|
cluster
|
...
@@ -104,7 +104,7 @@ describe MigrateKubernetesServiceToNewClustersArchitectures, :migration do
...
@@ -104,7 +104,7 @@ describe MigrateKubernetesServiceToNewClustersArchitectures, :migration do
end
end
it
'does not migrate the KubernetesService and disables the kubernetes_service'
do
# Because the corresponding Platform::Kubernetes already exists
it
'does not migrate the KubernetesService and disables the kubernetes_service'
do
# Because the corresponding Platform::Kubernetes already exists
expect
{
migrate!
}.
not_to
change
{
Clusters
::
Cluster
.
count
}
expect
{
migrate!
}.
not_to
change
{
Clusters
::
Cluster
.
count
}
kubernetes_service
.
reload
kubernetes_service
.
reload
expect
(
kubernetes_service
).
not_to
be_active
expect
(
kubernetes_service
).
not_to
be_active
...
@@ -117,7 +117,7 @@ describe MigrateKubernetesServiceToNewClustersArchitectures, :migration do
...
@@ -117,7 +117,7 @@ describe MigrateKubernetesServiceToNewClustersArchitectures, :migration do
let!
(
:kubernetes_service
)
{
create
(
:kubernetes_service
,
api_url:
'https://debug.kube.com'
,
active:
true
,
project:
project
)
}
let!
(
:kubernetes_service
)
{
create
(
:kubernetes_service
,
api_url:
'https://debug.kube.com'
,
active:
true
,
project:
project
)
}
it
'migrates the KubernetesService to Platform::Kubernetes'
do
it
'migrates the KubernetesService to Platform::Kubernetes'
do
expect
{
migrate!
}.
to
change
{
Clusters
::
Cluster
.
count
}.
by
(
1
)
expect
{
migrate!
}.
to
change
{
Clusters
::
Cluster
.
count
}.
by
(
1
)
kubernetes_service
.
reload
kubernetes_service
.
reload
project
.
clusters
.
last
.
tap
do
|
cluster
|
project
.
clusters
.
last
.
tap
do
|
cluster
|
...
@@ -136,7 +136,7 @@ describe MigrateKubernetesServiceToNewClustersArchitectures, :migration do
...
@@ -136,7 +136,7 @@ describe MigrateKubernetesServiceToNewClustersArchitectures, :migration do
let!
(
:kubernetes_service
)
{
create
(
:kubernetes_service
,
api_url:
'https://debug.kube.com'
,
active:
true
,
project:
project
)
}
let!
(
:kubernetes_service
)
{
create
(
:kubernetes_service
,
api_url:
'https://debug.kube.com'
,
active:
true
,
project:
project
)
}
it
'migrates the KubernetesService to Platform::Kubernetes with dedicated environment_scope'
do
# Because environment_scope is duplicated
it
'migrates the KubernetesService to Platform::Kubernetes with dedicated environment_scope'
do
# Because environment_scope is duplicated
expect
{
migrate!
}.
to
change
{
Clusters
::
Cluster
.
count
}.
by
(
1
)
expect
{
migrate!
}.
to
change
{
Clusters
::
Cluster
.
count
}.
by
(
1
)
kubernetes_service
.
reload
kubernetes_service
.
reload
project
.
clusters
.
last
.
tap
do
|
cluster
|
project
.
clusters
.
last
.
tap
do
|
cluster
|
...
@@ -156,7 +156,7 @@ describe MigrateKubernetesServiceToNewClustersArchitectures, :migration do
...
@@ -156,7 +156,7 @@ describe MigrateKubernetesServiceToNewClustersArchitectures, :migration do
let!
(
:kubernetes_service
)
{
create
(
:kubernetes_service
,
api_url:
'https://debug.kube.com'
,
active:
true
,
project:
project
)
}
let!
(
:kubernetes_service
)
{
create
(
:kubernetes_service
,
api_url:
'https://debug.kube.com'
,
active:
true
,
project:
project
)
}
it
'migrates the KubernetesService to Platform::Kubernetes with dedicated environment_scope'
do
# Because environment_scope is duplicated
it
'migrates the KubernetesService to Platform::Kubernetes with dedicated environment_scope'
do
# Because environment_scope is duplicated
expect
{
migrate!
}.
to
change
{
Clusters
::
Cluster
.
count
}.
by
(
1
)
expect
{
migrate!
}.
to
change
{
Clusters
::
Cluster
.
count
}.
by
(
1
)
kubernetes_service
.
reload
kubernetes_service
.
reload
project
.
clusters
.
last
.
tap
do
|
cluster
|
project
.
clusters
.
last
.
tap
do
|
cluster
|
...
@@ -173,7 +173,7 @@ describe MigrateKubernetesServiceToNewClustersArchitectures, :migration do
...
@@ -173,7 +173,7 @@ describe MigrateKubernetesServiceToNewClustersArchitectures, :migration do
let!
(
:project
)
{
create
(
:project
)
}
let!
(
:project
)
{
create
(
:project
)
}
it
'does not migrate the KubernetesService'
do
it
'does not migrate the KubernetesService'
do
expect
{
migrate!
}.
not_to
change
{
Clusters
::
Cluster
.
count
}
expect
{
migrate!
}.
not_to
change
{
Clusters
::
Cluster
.
count
}
end
end
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