Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
c0c5f896
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,发现更多精彩内容 >>
提交
c0c5f896
编写于
5月 28, 2018
作者:
K
Kamil Trzciński
提交者:
Dylan Griffith
5月 31, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Bring back deleted specs
上级
47c11248
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
42 addition
and
5 deletion
+42
-5
spec/factories/ci/runners.rb
spec/factories/ci/runners.rb
+8
-0
spec/models/ci/runner_spec.rb
spec/models/ci/runner_spec.rb
+1
-5
spec/requests/api/runners_spec.rb
spec/requests/api/runners_spec.rb
+33
-0
未找到文件。
spec/factories/ci/runners.rb
浏览文件 @
c0c5f896
...
...
@@ -36,6 +36,14 @@ FactoryBot.define do
end
end
trait
:without_projects
do
# we use that to create invalid runner:
# the one without projects
after
(
:create
)
do
|
runner
,
evaluator
|
runner
.
runner_projects
.
delete_all
end
end
trait
:inactive
do
active
false
end
...
...
spec/models/ci/runner_spec.rb
浏览文件 @
c0c5f896
...
...
@@ -766,11 +766,7 @@ describe Ci::Runner do
end
describe
'project runner without projects is destroyable'
do
subject
{
create
(
:ci_runner
,
:project
)
}
before
do
subject
.
runner_projects
.
delete_all
end
subject
{
create
(
:ci_runner
,
:project
,
:without_projects
)
}
it
'does not have projects'
do
expect
(
subject
.
runner_projects
).
to
be_empty
...
...
spec/requests/api/runners_spec.rb
浏览文件 @
c0c5f896
...
...
@@ -128,6 +128,18 @@ describe API::Runners do
end
context
'when runner is not shared'
do
context
'when unused runner is present'
do
let!
(
:unused_project_runner
)
{
create
(
:ci_runner
,
:project
,
:without_projects
)
}
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
end
it
"returns runner's details"
do
get
api
(
"/runners/
#{
project_runner
.
id
}
"
,
admin
)
...
...
@@ -561,6 +573,17 @@ describe API::Runners do
end
context
'user is admin'
do
context
'when project runner is used'
do
let!
(
:new_project_runner
)
{
create
(
:ci_runner
,
:project
)
}
it
'enables any specific runner'
do
expect
do
post
api
(
"/projects/
#{
project
.
id
}
/runners"
,
admin
),
runner_id:
new_project_runner
.
id
end
.
to
change
{
project
.
runners
.
count
}.
by
(
+
1
)
expect
(
response
).
to
have_gitlab_http_status
(
201
)
end
end
it
'enables a shared runner'
do
expect
do
post
api
(
"/projects/
#{
project
.
id
}
/runners"
,
admin
),
runner_id:
shared_runner
.
id
...
...
@@ -578,6 +601,16 @@ describe API::Runners do
end
end
context
'user is not admin'
do
let!
(
:new_project_runner
)
{
create
(
:ci_runner
,
:project
)
}
it
'does not enable runner without access to'
do
post
api
(
"/projects/
#{
project
.
id
}
/runners"
,
user
),
runner_id:
new_project_runner
.
id
expect
(
response
).
to
have_gitlab_http_status
(
403
)
end
end
context
'authorized user without permissions'
do
it
'does not enable runner'
do
post
api
(
"/projects/
#{
project
.
id
}
/runners"
,
user2
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录