Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
53037184
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
53037184
编写于
11月 06, 2018
作者:
T
Thong Kuah
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Minor updates to spec for readability
Based on BE reviewer feedback
上级
675bfd50
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
35 addition
and
23 deletion
+35
-23
spec/controllers/groups/clusters_controller_spec.rb
spec/controllers/groups/clusters_controller_spec.rb
+33
-21
spec/services/clusters/update_service_spec.rb
spec/services/clusters/update_service_spec.rb
+2
-2
未找到文件。
spec/controllers/groups/clusters_controller_spec.rb
浏览文件 @
53037184
...
...
@@ -40,8 +40,15 @@ describe Groups::ClustersController do
describe
'functionality'
do
context
'when group has one or more clusters'
do
let
(
:group
)
{
create
(
:group
)
}
let!
(
:enabled_cluster
)
{
create
(
:cluster
,
:provided_by_gcp
,
cluster_type: :group_type
,
groups:
[
group
])
}
let!
(
:disabled_cluster
)
{
create
(
:cluster
,
:disabled
,
:provided_by_gcp
,
:production_environment
,
cluster_type: :group_type
,
groups:
[
group
])
}
let!
(
:enabled_cluster
)
do
create
(
:cluster
,
:provided_by_gcp
,
cluster_type: :group_type
,
groups:
[
group
])
end
let!
(
:disabled_cluster
)
do
create
(
:cluster
,
:disabled
,
:provided_by_gcp
,
:production_environment
,
cluster_type: :group_type
,
groups:
[
group
])
end
it
'lists available clusters'
do
go
...
...
@@ -204,10 +211,13 @@ describe Groups::ClustersController do
expect
(
ClusterProvisionWorker
).
to
receive
(
:perform_async
)
expect
{
go
}.
to
change
{
Clusters
::
Cluster
.
count
}
.
and
change
{
Clusters
::
Providers
::
Gcp
.
count
}
expect
(
response
).
to
redirect_to
(
group_cluster_path
(
group
,
group
.
clusters
.
first
))
expect
(
group
.
clusters
.
first
).
to
be_gcp
expect
(
group
.
clusters
.
first
).
to
be_kubernetes
expect
(
group
.
clusters
.
first
.
provider_gcp
).
to
be_legacy_abac
cluster
=
group
.
clusters
.
first
expect
(
response
).
to
redirect_to
(
group_cluster_path
(
group
,
cluster
))
expect
(
cluster
).
to
be_gcp
expect
(
cluster
).
to
be_kubernetes
expect
(
cluster
.
provider_gcp
).
to
be_legacy_abac
end
context
'when legacy_abac param is false'
do
...
...
@@ -289,10 +299,11 @@ describe Groups::ClustersController do
expect
{
go
}.
to
change
{
Clusters
::
Cluster
.
count
}
.
and
change
{
Clusters
::
Platforms
::
Kubernetes
.
count
}
expect
(
response
).
to
redirect_to
(
group_cluster_path
(
group
,
group
.
clusters
.
first
))
cluster
=
group
.
clusters
.
first
expect
(
group
.
clusters
.
first
).
to
be_user
expect
(
group
.
clusters
.
first
).
to
be_kubernetes
expect
(
response
).
to
redirect_to
(
group_cluster_path
(
group
,
cluster
))
expect
(
cluster
).
to
be_user
expect
(
cluster
).
to
be_kubernetes
end
end
...
...
@@ -317,11 +328,12 @@ describe Groups::ClustersController do
expect
{
go
}.
to
change
{
Clusters
::
Cluster
.
count
}
.
and
change
{
Clusters
::
Platforms
::
Kubernetes
.
count
}
expect
(
response
).
to
redirect_to
(
group_cluster_path
(
group
,
group
.
clusters
.
first
))
cluster
=
group
.
clusters
.
first
expect
(
group
.
clusters
.
first
).
to
be_user
expect
(
group
.
clusters
.
first
).
to
be_kubernetes
expect
(
group
.
clusters
.
first
).
to
be_platform_kubernetes_rbac
expect
(
response
).
to
redirect_to
(
group_cluster_path
(
group
,
cluster
))
expect
(
cluster
).
to
be_user
expect
(
cluster
).
to
be_kubernetes
expect
(
cluster
).
to
be_platform_kubernetes_rbac
end
end
end
...
...
@@ -349,7 +361,7 @@ describe Groups::ClustersController do
end
describe
'functionality'
do
it
"responds with matching schema"
do
it
'responds with matching schema'
do
go
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
...
...
@@ -385,7 +397,7 @@ describe Groups::ClustersController do
end
describe
'functionality'
do
it
"renders view"
do
it
'renders view'
do
go
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
...
...
@@ -428,7 +440,7 @@ describe Groups::ClustersController do
}
end
it
"updates and redirects back to show page"
do
it
'updates and redirects back to show page'
do
go
cluster
.
reload
...
...
@@ -454,7 +466,7 @@ describe Groups::ClustersController do
}
end
it
"updates and redirects back to show page"
do
it
'updates and redirects back to show page'
do
go
(
format: :json
)
cluster
.
reload
...
...
@@ -477,7 +489,7 @@ describe Groups::ClustersController do
}
end
it
"rejects changes"
do
it
'rejects changes'
do
go
(
format: :json
)
expect
(
response
).
to
have_http_status
(
:bad_request
)
...
...
@@ -512,7 +524,7 @@ describe Groups::ClustersController do
describe
'functionality'
do
context
'when cluster is provided by GCP'
do
context
'when cluster is created'
do
it
"destroys and redirects back to clusters list"
do
it
'destroys and redirects back to clusters list'
do
expect
{
go
}
.
to
change
{
Clusters
::
Cluster
.
count
}.
by
(
-
1
)
.
and
change
{
Clusters
::
Platforms
::
Kubernetes
.
count
}.
by
(
-
1
)
...
...
@@ -526,7 +538,7 @@ describe Groups::ClustersController do
context
'when cluster is being created'
do
let!
(
:cluster
)
{
create
(
:cluster
,
:providing_by_gcp
,
:production_environment
,
cluster_type: :group_type
,
groups:
[
group
])
}
it
"destroys and redirects back to clusters list"
do
it
'destroys and redirects back to clusters list'
do
expect
{
go
}
.
to
change
{
Clusters
::
Cluster
.
count
}.
by
(
-
1
)
.
and
change
{
Clusters
::
Providers
::
Gcp
.
count
}.
by
(
-
1
)
...
...
@@ -540,7 +552,7 @@ describe Groups::ClustersController do
context
'when cluster is provided by user'
do
let!
(
:cluster
)
{
create
(
:cluster
,
:provided_by_user
,
:production_environment
,
cluster_type: :group_type
,
groups:
[
group
])
}
it
"destroys and redirects back to clusters list"
do
it
'destroys and redirects back to clusters list'
do
expect
{
go
}
.
to
change
{
Clusters
::
Cluster
.
count
}.
by
(
-
1
)
.
and
change
{
Clusters
::
Platforms
::
Kubernetes
.
count
}.
by
(
-
1
)
...
...
spec/services/clusters/update_service_spec.rb
浏览文件 @
53037184
...
...
@@ -72,7 +72,7 @@ describe Clusters::UpdateService do
}
end
it
"does not change cluster name"
do
it
'does not change cluster name'
do
is_expected
.
to
eq
(
false
)
cluster
.
reload
...
...
@@ -82,7 +82,7 @@ describe Clusters::UpdateService do
context
'when cluster is being created'
do
let
(
:cluster
)
{
create
(
:cluster
,
:providing_by_gcp
)
}
it
"rejects changes"
do
it
'rejects changes'
do
is_expected
.
to
eq
(
false
)
expect
(
cluster
.
errors
.
full_messages
).
to
include
(
'cannot modify during creation'
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录