Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
0778cad2
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,发现更多精彩内容 >>
提交
0778cad2
编写于
3月 13, 2017
作者:
G
Grzegorz Bizon
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Do not use GITLAB_RELEASE env to define QA strategy
[ci skip]
上级
175a3dfd
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
36 addition
and
34 deletion
+36
-34
qa/Dockerfile
qa/Dockerfile
+0
-2
qa/qa/runtime/release.rb
qa/qa/runtime/release.rb
+10
-13
qa/spec/runtime/release_spec.rb
qa/spec/runtime/release_spec.rb
+26
-19
未找到文件。
qa/Dockerfile
浏览文件 @
0778cad2
FROM
ruby:2.3
FROM
ruby:2.3
LABEL
maintainer "Grzegorz Bizon <grzegorz@gitlab.com>"
LABEL
maintainer "Grzegorz Bizon <grzegorz@gitlab.com>"
ENV
GITLAB_RELEASE CE
RUN
sed
-i
"s/httpredir.debian.org/ftp.us.debian.org/"
/etc/apt/sources.list
&&
\
RUN
sed
-i
"s/httpredir.debian.org/ftp.us.debian.org/"
/etc/apt/sources.list
&&
\
apt-get update
&&
apt-get
install
-y
--force-yes
\
apt-get update
&&
apt-get
install
-y
--force-yes
\
libqt5webkit5-dev qt5-qmake qt5-default build-essential xvfb git
&&
\
libqt5webkit5-dev qt5-qmake qt5-default build-essential xvfb git
&&
\
...
...
qa/qa/runtime/release.rb
浏览文件 @
0778cad2
...
@@ -2,35 +2,32 @@ module QA
...
@@ -2,35 +2,32 @@ module QA
module
Runtime
module
Runtime
##
##
# Class that is responsible for plugging CE/EE extensions in, depending on
# Class that is responsible for plugging CE/EE extensions in, depending on
# environment variable GITLAB_RELEASE that should be present in the runtime
# existence of EE module.
# environment.
#
#
# We need that to reduce the probability of conflicts when merging
# We need that to reduce the probability of conflicts when merging
# CE to EE.
# CE to EE.
#
#
class
Release
class
Release
UnspecifiedReleaseError
=
Class
.
new
(
StandardError
)
def
initialize
(
variant
=
nil
)
@version
=
variant
||
version
def
initialize
(
version
=
ENV
[
'GITLAB_RELEASE'
])
@version
=
version
.
to_s
.
upcase
unless
%w[CE EE]
.
include?
(
@version
)
raise
UnspecifiedReleaseError
,
'GITLAB_RELEASE env not defined!'
end
begin
begin
require
"qa/
#{
version
.
downcase
}
/strategy"
require
"qa/
#{
@
version
.
downcase
}
/strategy"
rescue
LoadError
rescue
LoadError
# noop
# noop
end
end
end
end
def
version
File
.
directory?
(
"
#{
__dir__
}
/../ee"
)
?
:EE
:
:CE
end
def
has_strategy?
def
has_strategy?
QA
.
const_defined?
(
"
#{
@version
}
::Strategy"
)
QA
.
const_defined?
(
"
QA::
#{
@version
}
::Strategy"
)
end
end
def
strategy
def
strategy
QA
.
const_get
(
"
#{
@version
}
::Strategy"
)
QA
.
const_get
(
"
QA::
#{
@version
}
::Strategy"
)
end
end
def
self
.
method_missing
(
name
,
*
args
)
def
self
.
method_missing
(
name
,
*
args
)
...
...
qa/spec/runtime/release_spec.rb
浏览文件 @
0778cad2
describe
QA
::
Runtime
::
Release
do
describe
QA
::
Runtime
::
Release
do
context
'when release version has extension strategy'
do
context
'when release version has extension strategy'
do
subject
{
described_class
.
new
(
'
CE
'
)
}
subject
{
described_class
.
new
(
'
VER
'
)
}
let
(
:strategy
)
{
spy
(
'
CE
::Strategy'
)
}
let
(
:strategy
)
{
spy
(
'
VER
::Strategy'
)
}
before
do
before
do
stub_const
(
'QA::CE::Strategy'
,
strategy
)
stub_const
(
'QA::VER::Strategy'
,
strategy
)
stub_const
(
'QA::EE::Strategy'
,
strategy
)
end
end
describe
'#has_strategy?'
do
describe
'#has_strategy?'
do
...
@@ -16,11 +15,19 @@ describe QA::Runtime::Release do
...
@@ -16,11 +15,19 @@ describe QA::Runtime::Release do
describe
'#strategy'
do
describe
'#strategy'
do
it
'return the strategy constant'
do
it
'return the strategy constant'
do
expect
(
subject
.
strategy
).
to
eq
QA
::
CE
::
Strategy
expect
(
subject
.
strategy
).
to
eq
QA
::
VER
::
Strategy
end
end
end
end
describe
'delegated class methods'
do
describe
'delegated class methods'
do
before
do
allow_any_instance_of
(
described_class
)
.
to
receive
(
:has_strategy?
).
and_return
(
true
)
allow_any_instance_of
(
described_class
)
.
to
receive
(
:strategy
).
and_return
(
strategy
)
end
it
'delegates all calls to strategy class'
do
it
'delegates all calls to strategy class'
do
described_class
.
some_method
(
1
,
2
)
described_class
.
some_method
(
1
,
2
)
...
@@ -31,12 +38,7 @@ describe QA::Runtime::Release do
...
@@ -31,12 +38,7 @@ describe QA::Runtime::Release do
end
end
context
'when release version does not have extension strategy'
do
context
'when release version does not have extension strategy'
do
subject
{
described_class
.
new
(
'CE'
)
}
subject
{
described_class
.
new
(
'NOVER'
)
}
before
do
hide_const
(
'QA::CE::Strategy'
)
hide_const
(
'QA::EE::Strategy'
)
end
describe
'#has_strategy?'
do
describe
'#has_strategy?'
do
it
'returns false'
do
it
'returns false'
do
...
@@ -50,18 +52,23 @@ describe QA::Runtime::Release do
...
@@ -50,18 +52,23 @@ describe QA::Runtime::Release do
end
end
end
end
describe
'delegated class methods'
do
describe
'does not delegate class methods'
do
before
do
allow_any_instance_of
(
described_class
)
.
to
receive
(
:has_strategy?
).
and_return
(
false
)
end
it
'behaves like a null object and does nothing'
do
it
'behaves like a null object and does nothing'
do
expect
{
described_class
.
some_method
(
2
,
3
)
}.
not_to
raise_error
expect
{
described_class
.
some_method
(
2
,
3
)
}.
not_to
raise_error
end
end
end
end
context
'when release version is invalid or unspecified'
do
it
'returns nil'
do
describe
'#new'
do
expect
(
described_class
.
something
).
to
be_nil
it
'raises an exception'
do
end
expect
{
described_class
.
new
(
nil
)
}
.
to
raise_error
(
described_class
::
UnspecifiedReleaseError
)
it
'does not delegate to strategy object'
do
expect_any_instance_of
(
described_class
)
.
not_to
receive
(
:strategy
)
end
end
end
end
end
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录