Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5-Boxiang
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Hamza
erp5-Boxiang
Commits
1e9c43b4
Commit
1e9c43b4
authored
Jun 20, 2019
by
Boxiang Sun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testnode: Add submodule check when checking revision
parent
ed27624b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
1 deletion
+21
-1
erp5/tests/testERP5TestNode.py
erp5/tests/testERP5TestNode.py
+21
-1
No files found.
erp5/tests/testERP5TestNode.py
View file @
1e9c43b4
...
@@ -186,6 +186,11 @@ class ERP5TestNode(TestCase):
...
@@ -186,6 +186,11 @@ class ERP5TestNode(TestCase):
# ['4f1d14de1b04b4f878a442ee859791fa337bcf85', 'first_commit']]}
# ['4f1d14de1b04b4f878a442ee859791fa337bcf85', 'first_commit']]}
return
commit_dict
return
commit_dict
def
setUpSubmodule
(
self
):
repository_path
=
self
.
remote_repository1
call
=
self
.
getCaller
(
cwd
=
repository_path
)
call
([
'git'
,
'submodule'
,
'add'
,
self
.
remote_repository2
+
'/.git'
,
'repo2'
])
def
test_01_getDelNodeTestSuite
(
self
):
def
test_01_getDelNodeTestSuite
(
self
):
"""
"""
We should be able to get/delete NodeTestSuite objects inside test_node
We should be able to get/delete NodeTestSuite objects inside test_node
...
@@ -293,22 +298,37 @@ shared = true
...
@@ -293,22 +298,37 @@ shared = true
"""
"""
Check if we clone correctly repositories and get right revisions
Check if we clone correctly repositories and get right revisions
"""
"""
commit_dict
=
self
.
generateTestRepositoryList
()
commit_dict
=
self
.
generateTestRepositoryList
(
add_third_repository
=
True
)
self
.
setUpSubmodule
()
test_node
=
self
.
getTestNode
()
test_node
=
self
.
getTestNode
()
node_test_suite
=
test_node
.
getNodeTestSuite
(
'foo'
)
node_test_suite
=
test_node
.
getNodeTestSuite
(
'foo'
)
# just add the third repository, but not set the vcs_repository_list
# because it is invisible to the buildout
# the submodule was set up in setUpSubmodule function
self
.
updateNodeTestSuiteData
(
node_test_suite
)
self
.
updateNodeTestSuiteData
(
node_test_suite
)
rev_list
=
self
.
getAndUpdateFullRevisionList
(
test_node
,
node_test_suite
)
rev_list
=
self
.
getAndUpdateFullRevisionList
(
test_node
,
node_test_suite
)
self
.
assertEquals
(
2
,
len
(
rev_list
))
self
.
assertEquals
(
2
,
len
(
rev_list
))
self
.
assertEquals
(
rev_list
[
0
],
'rep0=2-%s'
%
commit_dict
[
'rep0'
][
0
][
0
])
self
.
assertEquals
(
rev_list
[
0
],
'rep0=2-%s'
%
commit_dict
[
'rep0'
][
0
][
0
])
self
.
assertEquals
(
rev_list
[
1
],
'rep1=2-%s'
%
commit_dict
[
'rep1'
][
0
][
0
])
self
.
assertEquals
(
rev_list
[
1
],
'rep1=2-%s'
%
commit_dict
[
'rep1'
][
0
][
0
])
call
=
self
.
getCaller
(
cwd
=
self
.
remote_repository0
)
submodule_revision0
=
call
(
"git rev-parse HEAD"
.
split
())
submodule_file
=
open
(
os
.
path
.
join
(
self
.
remote_repository1
,
'.gitmodules'
),
'r'
)
submodule_line
=
submodule_file
.
readline
()
submodule_file
.
close
()
self
.
assertEquals
(
'[submodule "repo2"]
\
n
'
,
submodule_line
)
submodule_commit_file
=
open
(
os
.
path
.
join
(
self
.
remote_repository2
,
'first_file'
),
'w'
)
submodule_commit_file
.
write
(
"next_content"
)
submodule_commit_file
.
close
()
my_file
=
open
(
os
.
path
.
join
(
self
.
remote_repository1
,
'first_file'
),
'w'
)
my_file
=
open
(
os
.
path
.
join
(
self
.
remote_repository1
,
'first_file'
),
'w'
)
my_file
.
write
(
"next_content"
)
my_file
.
write
(
"next_content"
)
my_file
.
close
()
my_file
.
close
()
call
=
self
.
getCaller
(
cwd
=
self
.
remote_repository1
)
call
=
self
.
getCaller
(
cwd
=
self
.
remote_repository1
)
call
(
"git commit -av -m new_commit"
.
split
())
call
(
"git commit -av -m new_commit"
.
split
())
rev_list
=
self
.
getAndUpdateFullRevisionList
(
test_node
,
node_test_suite
)
rev_list
=
self
.
getAndUpdateFullRevisionList
(
test_node
,
node_test_suite
)
submodule_revision1
=
call
(
"git rev-parse HEAD"
.
split
())
self
.
assertTrue
(
rev_list
[
0
].
startswith
(
'rep0=2-'
))
self
.
assertTrue
(
rev_list
[
0
].
startswith
(
'rep0=2-'
))
self
.
assertTrue
(
rev_list
[
1
].
startswith
(
'rep1=3-'
))
self
.
assertTrue
(
rev_list
[
1
].
startswith
(
'rep1=3-'
))
self
.
assertNotEquals
(
submodule_revision0
,
submodule_revision1
)
self
.
assertEquals
(
2
,
len
(
node_test_suite
.
vcs_repository_list
))
self
.
assertEquals
(
2
,
len
(
node_test_suite
.
vcs_repository_list
))
for
vcs_repository
in
node_test_suite
.
vcs_repository_list
:
for
vcs_repository
in
node_test_suite
.
vcs_repository_list
:
self
.
assertTrue
(
os
.
path
.
exists
(
vcs_repository
[
'repository_path'
]))
self
.
assertTrue
(
os
.
path
.
exists
(
vcs_repository
[
'repository_path'
]))
...
...
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