Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
7f780046
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,发现更多精彩内容 >>
提交
7f780046
编写于
1月 08, 2019
作者:
D
ddavison
提交者:
Sanad Liaquat
1月 09, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add specs to remote grid. Raise errors for #remote_grid_credentials
Signed-off-by:
N
ddavison
<
ddavison@gitlab.com
>
上级
8677d408
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
66 addition
and
1 deletion
+66
-1
qa/qa/runtime/env.rb
qa/qa/runtime/env.rb
+7
-1
qa/spec/runtime/env_spec.rb
qa/spec/runtime/env_spec.rb
+59
-0
未找到文件。
qa/qa/runtime/env.rb
浏览文件 @
7f780046
...
...
@@ -187,7 +187,13 @@ module QA
private
def
remote_grid_credentials
remote_grid_username
?
"
#{
remote_grid_username
}
:
#{
remote_grid_access_key
}
@"
:
''
if
remote_grid_username
raise
ArgumentError
,
%Q(Please provide an access key for user "
#{
remote_grid_username
}
")
unless
remote_grid_access_key
return
"
#{
remote_grid_username
}
:
#{
remote_grid_access_key
}
@"
end
''
end
def
enabled?
(
value
,
default:
true
)
...
...
qa/spec/runtime/env_spec.rb
浏览文件 @
7f780046
...
...
@@ -207,4 +207,63 @@ describe QA::Runtime::Env do
expect
{
described_class
.
can_test?
:foo
}.
to
raise_error
(
ArgumentError
,
'Unknown feature "foo"'
)
end
end
describe
'remote grid credentials'
do
it
'is blank if username is empty'
do
stub_env
(
'QA_REMOTE_GRID_USERNAME'
,
nil
)
expect
(
described_class
.
send
(
:remote_grid_credentials
)).
to
eq
(
''
)
end
it
'throws ArgumentError if GRID_ACCESS_KEY is not specified with USERNAME'
do
stub_env
(
'QA_REMOTE_GRID_USERNAME'
,
'foo'
)
expect
{
described_class
.
send
(
:remote_grid_credentials
)
}.
to
raise_error
(
ArgumentError
,
'Please provide an access key for user "foo"'
)
end
it
'returns a user:key@ combination when all args are satiated'
do
stub_env
(
'QA_REMOTE_GRID_USERNAME'
,
'foo'
)
stub_env
(
'QA_REMOTE_GRID_ACCESS_KEY'
,
'bar'
)
expect
(
described_class
.
send
(
:remote_grid_credentials
)).
to
eq
(
'foo:bar@'
)
end
end
describe
'.remote_grid_protocol'
do
it
'defaults protocol to http'
do
stub_env
(
'QA_REMOTE_GRID_PROTOCOL'
,
nil
)
expect
(
described_class
.
remote_grid_protocol
).
to
eq
(
'http'
)
end
end
describe
'.remote_grid'
do
it
'is falsey if QA_REMOTE_GRID is not set'
do
expect
(
described_class
.
remote_grid
).
to
be_falsey
end
it
'accepts https protocol'
do
stub_env
(
'QA_REMOTE_GRID'
,
'localhost:4444'
)
stub_env
(
'QA_REMOTE_GRID_PROTOCOL'
,
'https'
)
expect
(
described_class
.
remote_grid
).
to
eq
(
'https://localhost:4444/wd/hub'
)
end
context
'with credentials'
do
it
'has a grid of http://user:key@grid/wd/hub'
do
stub_env
(
'QA_REMOTE_GRID_USERNAME'
,
'foo'
)
stub_env
(
'QA_REMOTE_GRID_ACCESS_KEY'
,
'bar'
)
stub_env
(
'QA_REMOTE_GRID'
,
'localhost:4444'
)
expect
(
described_class
.
remote_grid
).
to
eq
(
'http://foo:bar@localhost:4444/wd/hub'
)
end
end
context
'without credentials'
do
it
'has a grid of http://grid/wd/hub'
do
stub_env
(
'QA_REMOTE_GRID'
,
'localhost:4444'
)
expect
(
described_class
.
remote_grid
).
to
eq
(
'http://localhost:4444/wd/hub'
)
end
end
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录