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
600d5f4f
Commit
600d5f4f
authored
Nov 03, 2017
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix tests. Remove NOT NULL constraint from cluster.user.
parent
6ebe6792
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
16 additions
and
8 deletions
+16
-8
app/models/clusters/platforms/kubernetes.rb
app/models/clusters/platforms/kubernetes.rb
+3
-0
db/migrate/20171013094327_create_new_clusters_architectures.rb
...grate/20171013094327_create_new_clusters_architectures.rb
+1
-1
db/schema.rb
db/schema.rb
+1
-1
spec/javascripts/fixtures/clusters.rb
spec/javascripts/fixtures/clusters.rb
+1
-1
spec/lib/gitlab/import_export/all_models.yml
spec/lib/gitlab/import_export/all_models.yml
+9
-3
spec/models/clusters/platforms/kubernetes_spec.rb
spec/models/clusters/platforms/kubernetes_spec.rb
+1
-2
No files found.
app/models/clusters/platforms/kubernetes.rb
View file @
600d5f4f
...
@@ -58,6 +58,9 @@ module Clusters
...
@@ -58,6 +58,9 @@ module Clusters
def
update_kubernetes_integration!
def
update_kubernetes_integration!
raise
'Kubernetes service already configured'
unless
manages_kubernetes_service?
raise
'Kubernetes service already configured'
unless
manages_kubernetes_service?
# This is neccesary, otheriwse enabled? returns true even though cluster updated with enabled: false
cluster
.
reload
ensure_kubernetes_service
&
.
update!
(
ensure_kubernetes_service
&
.
update!
(
active:
enabled?
,
active:
enabled?
,
api_url:
api_url
,
api_url:
api_url
,
...
...
db/migrate/20171013094327_create_new_clusters_architectures.rb
View file @
600d5f4f
...
@@ -3,7 +3,7 @@ class CreateNewClustersArchitectures < ActiveRecord::Migration
...
@@ -3,7 +3,7 @@ class CreateNewClustersArchitectures < ActiveRecord::Migration
def
change
def
change
create_table
:clusters
do
|
t
|
create_table
:clusters
do
|
t
|
t
.
references
:user
,
null:
false
,
index:
true
,
foreign_key:
{
on_delete: :nullify
}
t
.
references
:user
,
index:
true
,
foreign_key:
{
on_delete: :nullify
}
t
.
integer
:provider_type
t
.
integer
:provider_type
t
.
integer
:platform_type
t
.
integer
:platform_type
...
...
db/schema.rb
View file @
600d5f4f
...
@@ -507,7 +507,7 @@ ActiveRecord::Schema.define(version: 20171026082505) do
...
@@ -507,7 +507,7 @@ ActiveRecord::Schema.define(version: 20171026082505) do
add_index
"cluster_providers_gcp"
,
[
"cluster_id"
],
name:
"index_cluster_providers_gcp_on_cluster_id"
,
unique:
true
,
using: :btree
add_index
"cluster_providers_gcp"
,
[
"cluster_id"
],
name:
"index_cluster_providers_gcp_on_cluster_id"
,
unique:
true
,
using: :btree
create_table
"clusters"
,
force: :cascade
do
|
t
|
create_table
"clusters"
,
force: :cascade
do
|
t
|
t
.
integer
"user_id"
,
null:
false
t
.
integer
"user_id"
t
.
integer
"provider_type"
t
.
integer
"provider_type"
t
.
integer
"platform_type"
t
.
integer
"platform_type"
t
.
datetime_with_timezone
"created_at"
,
null:
false
t
.
datetime_with_timezone
"created_at"
,
null:
false
...
...
spec/javascripts/fixtures/clusters.rb
View file @
600d5f4f
...
@@ -6,7 +6,7 @@ describe Projects::ClustersController, '(JavaScript fixtures)', type: :controlle
...
@@ -6,7 +6,7 @@ describe Projects::ClustersController, '(JavaScript fixtures)', type: :controlle
let
(
:admin
)
{
create
(
:admin
)
}
let
(
:admin
)
{
create
(
:admin
)
}
let
(
:namespace
)
{
create
(
:namespace
,
name:
'frontend-fixtures'
)}
let
(
:namespace
)
{
create
(
:namespace
,
name:
'frontend-fixtures'
)}
let
(
:project
)
{
create
(
:project
,
:repository
,
namespace:
namespace
)
}
let
(
:project
)
{
create
(
:project
,
:repository
,
namespace:
namespace
)
}
let
(
:cluster
)
{
project
.
create_cluster!
(
gcp_cluster_name:
"gke-test-creation-1"
,
gcp_project_id:
'gitlab-internal-153318'
,
gcp_cluster_zone:
'us-central1-a'
,
gcp_cluster_size:
'1'
,
project_namespace:
'aaa'
,
gcp_machine_type:
'n1-standard-1'
)
}
let
(
:cluster
)
{
create
(
:cluster
,
:provided_by_gcp
,
projects:
[
project
])
}
render_views
render_views
...
...
spec/lib/gitlab/import_export/all_models.yml
View file @
600d5f4f
...
@@ -147,10 +147,16 @@ deploy_keys:
...
@@ -147,10 +147,16 @@ deploy_keys:
-
user
-
user
-
deploy_keys_projects
-
deploy_keys_projects
-
projects
-
projects
cluster
:
cluster
s
:
-
project
-
project
s
-
user
-
user
-
service
cluster_projects
:
-
projects
-
clusters
provider_gcp
:
-
cluster
platform_kubernetes
:
-
cluster
services
:
services
:
-
project
-
project
-
service_hook
-
service_hook
...
...
spec/models/clusters/platforms/kubernetes_spec.rb
View file @
600d5f4f
...
@@ -117,7 +117,6 @@ describe Clusters::Platforms::Kubernetes, :use_clean_rails_memory_store_caching
...
@@ -117,7 +117,6 @@ describe Clusters::Platforms::Kubernetes, :use_clean_rails_memory_store_caching
let
(
:kubernetes_service
)
{
project
.
kubernetes_service
}
let
(
:kubernetes_service
)
{
project
.
kubernetes_service
}
it
'updates KubernetesService'
do
it
'updates KubernetesService'
do
# TODO: This doesn't work as intended because `enabled?` in Clusters::Platforms::Kubernetes is still true without `reload`
cluster
.
update
(
enabled:
enabled
)
cluster
.
update
(
enabled:
enabled
)
expect
(
kubernetes_service
.
active
).
to
eq
(
enabled
)
expect
(
kubernetes_service
.
active
).
to
eq
(
enabled
)
...
@@ -135,7 +134,7 @@ describe Clusters::Platforms::Kubernetes, :use_clean_rails_memory_store_caching
...
@@ -135,7 +134,7 @@ describe Clusters::Platforms::Kubernetes, :use_clean_rails_memory_store_caching
end
end
it
'raises an error'
do
it
'raises an error'
do
expect
{
cluster
.
save!
}.
to
raise_error
(
'Kubernetes service already configured'
)
expect
{
cluster
.
save!
}.
to
raise_error
(
'Kubernetes service already configured'
)
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