Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
9567778f
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 搜索 >>
提交
9567778f
编写于
9月 29, 2014
作者:
C
Ciro Santilli
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix version of test seed branches.
上级
88d3e97e
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
39 addition
and
6 deletion
+39
-6
spec/support/test_env.rb
spec/support/test_env.rb
+39
-6
未找到文件。
spec/support/test_env.rb
浏览文件 @
9567778f
...
...
@@ -3,6 +3,16 @@ require 'rspec/mocks'
module
TestEnv
extend
self
# When developing the seed repository, comment out the branch you will modify.
BRANCH_SHA
=
{
'feature'
=>
'0b4bc9a'
,
'feature_conflict'
=>
'bb5206f'
,
'fix'
=>
'12d65c8'
,
'improve/awesome'
=>
'5937ac0'
,
'markdown'
=>
'0ed8c6c'
,
'master'
=>
'5937ac0'
}
# Test environment
#
# See gitlab.yml.example test section for paths
...
...
@@ -18,13 +28,13 @@ module TestEnv
if
File
.
directory?
(
tmp_test_path
)
Dir
.
entries
(
tmp_test_path
).
each
do
|
entry
|
unless
[
'.'
,
'..'
,
'gitlab-shell'
].
include?
(
entry
)
unless
[
'.'
,
'..'
,
'gitlab-shell'
,
factory_repo_name
].
include?
(
entry
)
FileUtils
.
rm_r
(
File
.
join
(
tmp_test_path
,
entry
))
end
end
end
FileUtils
.
mkdir_p
(
tmp_test
_path
)
FileUtils
.
mkdir_p
(
repos
_path
)
# Setup GitLab shell for test instance
setup_gitlab_shell
...
...
@@ -49,13 +59,32 @@ module TestEnv
clone_url
=
"https://gitlab.com/gitlab-org/
#{
factory_repo_name
}
.git"
unless
File
.
directory?
(
factory_repo_path
)
git_cmd
=
%W(git clone --bare
#{
clone_url
}
#{
factory_repo_path
}
)
system
(
*
git_cmd
)
system
(
*
%W(git clone
#{
clone_url
}
#{
factory_repo_path
}
)
)
end
Dir
.
chdir
(
factory_repo_path
)
do
BRANCH_SHA
.
each
do
|
branch
,
sha
|
# Try to reset without fetching to avoid using the network.
reset
=
%W(git update-ref refs/heads/
#{
branch
}
#{
sha
}
)
unless
system
(
*
reset
)
if
system
(
*
%w(git fetch origin)
)
unless
system
(
*
reset
)
raise
'The fetched test seed '
\
'does not contain the required revision.'
end
else
raise
'Could not fetch test seed repository.'
end
end
end
end
# We must copy bare repositories because we will push to them.
system
(
*
%W(git clone --bare
#{
factory_repo_path
}
#{
factory_repo_path_bare
}
)
)
end
def
copy_repo
(
project
)
base_repo_path
=
File
.
expand_path
(
factory_repo_path
)
base_repo_path
=
File
.
expand_path
(
factory_repo_path
_bare
)
target_repo_path
=
File
.
expand_path
(
repos_path
+
"/
#{
project
.
namespace
.
path
}
/
#{
project
.
path
}
.git"
)
FileUtils
.
mkdir_p
(
target_repo_path
)
FileUtils
.
cp_r
(
"
#{
base_repo_path
}
/."
,
target_repo_path
)
...
...
@@ -69,7 +98,11 @@ module TestEnv
private
def
factory_repo_path
@factory_repo_path
||=
repos_path
+
"/root/
#{
factory_repo_name
}
.git"
@factory_repo_path
||=
Rails
.
root
.
join
(
'tmp'
,
'tests'
,
factory_repo_name
)
end
def
factory_repo_path_bare
factory_repo_path
.
to_s
+
'_bare'
end
def
factory_repo_name
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录