Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
03ff1da2
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 搜索 >>
提交
03ff1da2
编写于
5月 23, 2018
作者:
K
Kamil Trzciński
提交者:
Dylan Griffith
5月 31, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix some failures
上级
1fcc9ad7
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
9 addition
and
40 deletion
+9
-40
app/models/clusters/applications/runner.rb
app/models/clusters/applications/runner.rb
+3
-2
spec/factories/ci/runners.rb
spec/factories/ci/runners.rb
+4
-0
spec/requests/api/runners_spec.rb
spec/requests/api/runners_spec.rb
+2
-38
未找到文件。
app/models/clusters/applications/runner.rb
浏览文件 @
03ff1da2
...
...
@@ -43,7 +43,7 @@ module Clusters
def
create_and_assign_runner
transaction
do
project
.
runners
.
create!
(
runner_create_params
).
tap
do
|
runner
|
Ci
::
Runner
.
create!
(
runner_create_params
).
tap
do
|
runner
|
update!
(
runner_id:
runner
.
id
)
end
end
...
...
@@ -53,7 +53,8 @@ module Clusters
{
name:
'kubernetes-cluster'
,
runner_type: :project_type
,
tag_list:
%w(kubernetes cluster)
tag_list:
%w(kubernetes cluster)
,
projects:
[
project
]
}
end
...
...
spec/factories/ci/runners.rb
浏览文件 @
03ff1da2
...
...
@@ -9,6 +9,10 @@ FactoryBot.define do
is_shared
true
runner_type
:instance_type
trait
:online
do
contacted_at
Time
.
now
end
trait
:instance
do
is_shared
true
runner_type
:instance_type
...
...
spec/requests/api/runners_spec.rb
浏览文件 @
03ff1da2
...
...
@@ -12,21 +12,8 @@ describe API::Runners do
let
(
:group2
)
{
create
(
:group
).
tap
{
|
group
|
group
.
add_owner
(
user
)
}
}
let!
(
:shared_runner
)
{
create
(
:ci_runner
,
:instance
,
description:
'Shared runner'
)
}
let!
(
:unused_project_runner
)
{
create
(
:ci_runner
)
}
let!
(
:project_runner
)
do
create
(
:ci_runner
,
description:
'Project runner'
).
tap
do
|
runner
|
create
(
:ci_runner_project
,
runner:
runner
,
project:
project
)
end
end
let!
(
:two_projects_runner
)
do
create
(
:ci_runner
,
description:
'Two projects runner'
).
tap
do
|
runner
|
create
(
:ci_runner_project
,
runner:
runner
,
project:
project
)
create
(
:ci_runner_project
,
runner:
runner
,
project:
project2
)
end
end
let!
(
:project_runner
)
{
create
(
:ci_runner
,
:project
,
description:
'Project runner'
,
projects:
[
project
])
}
let!
(
:two_projects_runner
)
{
create
(
:ci_runner
,
:project
,
description:
'Two projects runner'
,
projects:
[
project
,
project2
])
let!
(
:group_runner
)
{
create
(
:ci_runner
,
:group
,
description:
'Group runner'
,
groups:
[
group
])
}
before
do
...
...
@@ -310,14 +297,6 @@ describe API::Runners do
end
context
'when runner is not shared'
do
it
'deletes unused runner'
do
expect
do
delete
api
(
"/runners/
#{
unused_project_runner
.
id
}
"
,
admin
)
expect
(
response
).
to
have_gitlab_http_status
(
204
)
end
.
to
change
{
Ci
::
Runner
.
specific
.
count
}.
by
(
-
1
)
end
it
'deletes used project runner'
do
expect
do
delete
api
(
"/runners/
#{
project_runner
.
id
}
"
,
admin
)
...
...
@@ -586,13 +565,6 @@ describe API::Runners do
end
context
'user is admin'
do
it
'enables any specific runner'
do
expect
do
post
api
(
"/projects/
#{
project
.
id
}
/runners"
,
admin
),
runner_id:
unused_project_runner
.
id
end
.
to
change
{
project
.
runners
.
count
}.
by
(
+
1
)
expect
(
response
).
to
have_gitlab_http_status
(
201
)
end
it
'enables a shared runner'
do
expect
do
post
api
(
"/projects/
#{
project
.
id
}
/runners"
,
admin
),
runner_id:
shared_runner
.
id
...
...
@@ -603,14 +575,6 @@ describe API::Runners do
end
end
context
'user is not admin'
do
it
'does not enable runner without access to'
do
post
api
(
"/projects/
#{
project
.
id
}
/runners"
,
user
),
runner_id:
unused_project_runner
.
id
expect
(
response
).
to
have_gitlab_http_status
(
403
)
end
end
it
'raises an error when no runner_id param is provided'
do
post
api
(
"/projects/
#{
project
.
id
}
/runners"
,
admin
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录