Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
628cc848
Commit
628cc848
authored
May 10, 2017
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Factorize TestEvent#copy_repo
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
a67bb1f0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
13 deletions
+4
-13
spec/factories/projects.rb
spec/factories/projects.rb
+1
-1
spec/support/test_env.rb
spec/support/test_env.rb
+3
-12
No files found.
spec/factories/projects.rb
View file @
628cc848
...
@@ -172,7 +172,7 @@ FactoryGirl.define do
...
@@ -172,7 +172,7 @@ FactoryGirl.define do
path
{
'forked-gitlabhq'
}
path
{
'forked-gitlabhq'
}
after
:create
do
|
project
|
after
:create
do
|
project
|
TestEnv
.
copy_
forked_repo_with_submodules
(
project
)
TestEnv
.
copy_
repo
(
project
,
copy_fork:
true
)
end
end
end
end
...
...
spec/support/test_env.rb
View file @
628cc848
...
@@ -170,13 +170,13 @@ module TestEnv
...
@@ -170,13 +170,13 @@ module TestEnv
end
end
end
end
def
copy_repo
(
project
)
def
copy_repo
(
project
,
copy_fork:
false
)
base_repo_path
=
File
.
expand_path
(
factory_repo_path_bare
)
base_repo_path
=
File
.
expand_path
(
copy_fork
?
forked_repo_path_bare
:
factory_repo_path_bare
)
target_repo_path
=
File
.
expand_path
(
project
.
repository_storage_path
+
"/
#{
project
.
full_path
}
.git"
)
target_repo_path
=
File
.
expand_path
(
project
.
repository_storage_path
+
"/
#{
project
.
full_path
}
.git"
)
FileUtils
.
mkdir_p
(
target_repo_path
)
FileUtils
.
mkdir_p
(
target_repo_path
)
FileUtils
.
cp_r
(
"
#{
base_repo_path
}
/."
,
target_repo_path
)
FileUtils
.
cp_r
(
"
#{
base_repo_path
}
/."
,
target_repo_path
)
FileUtils
.
chmod_R
0755
,
target_repo_path
FileUtils
.
chmod_R
0755
,
target_repo_path
set_repo_refs
(
target_repo_path
,
BRANCH_SHA
)
set_repo_refs
(
target_repo_path
,
copy_fork
?
FORKED_BRANCH_SHA
:
BRANCH_SHA
)
end
end
def
repos_path
def
repos_path
...
@@ -191,15 +191,6 @@ module TestEnv
...
@@ -191,15 +191,6 @@ module TestEnv
Gitlab
.
config
.
pages
.
path
Gitlab
.
config
.
pages
.
path
end
end
def
copy_forked_repo_with_submodules
(
project
)
base_repo_path
=
File
.
expand_path
(
forked_repo_path_bare
)
target_repo_path
=
File
.
expand_path
(
project
.
repository_storage_path
+
"/
#{
project
.
full_path
}
.git"
)
FileUtils
.
mkdir_p
(
target_repo_path
)
FileUtils
.
cp_r
(
"
#{
base_repo_path
}
/."
,
target_repo_path
)
FileUtils
.
chmod_R
0755
,
target_repo_path
set_repo_refs
(
target_repo_path
,
FORKED_BRANCH_SHA
)
end
# When no cached assets exist, manually hit the root path to create them
# When no cached assets exist, manually hit the root path to create them
#
#
# Otherwise they'd be created by the first test, often timing out and
# Otherwise they'd be created by the first test, often timing out and
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment