Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
Eteri
erp5
Commits
63b3ccda
Commit
63b3ccda
authored
Oct 31, 2016
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5.util.testnode: strip common '-repository' suffix in test result references
This is only cosmetics.
parent
9634a7d8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
31 deletions
+31
-31
erp5/tests/testERP5TestNode.py
erp5/tests/testERP5TestNode.py
+16
-12
erp5/util/testnode/NodeTestSuite.py
erp5/util/testnode/NodeTestSuite.py
+6
-0
erp5/util/testnode/testnode.py
erp5/util/testnode/testnode.py
+9
-19
No files found.
erp5/tests/testERP5TestNode.py
View file @
63b3ccda
...
@@ -272,7 +272,11 @@ develop = false
...
@@ -272,7 +272,11 @@ develop = false
self
.
assertEquals
(
expected_profile
,
profile
.
read
())
self
.
assertEquals
(
expected_profile
,
profile
.
read
())
profile
.
close
()
profile
.
close
()
def
test_05_getAndUpdateFullRevisionList
(
self
):
def
getAndUpdateFullRevisionList
(
self
,
test_node
,
node_test_suite
)
if
test_node
.
updateRevisionList
(
node_test_suite
):
return
node_test_suite
.
revision
.
split
(
','
)
def
test_05_updateRevisionList
(
self
):
"""
"""
Check if we clone correctly repositories and get right revisions
Check if we clone correctly repositories and get right revisions
"""
"""
...
@@ -280,7 +284,7 @@ develop = false
...
@@ -280,7 +284,7 @@ develop = false
test_node
=
self
.
getTestNode
()
test_node
=
self
.
getTestNode
()
node_test_suite
=
test_node
.
getNodeTestSuite
(
'foo'
)
node_test_suite
=
test_node
.
getNodeTestSuite
(
'foo'
)
self
.
updateNodeTestSuiteData
(
node_test_suite
)
self
.
updateNodeTestSuiteData
(
node_test_suite
)
rev_list
=
test_node
.
getAndUpdateFullRevisionList
(
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
])
...
@@ -289,7 +293,7 @@ develop = false
...
@@ -289,7 +293,7 @@ develop = false
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
=
test_node
.
getAndUpdateFullRevisionList
(
node_test_suite
)
rev_list
=
self
.
getAndUpdateFullRevisionList
(
test_node
,
node_test_suite
)
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
.
assertEquals
(
2
,
len
(
node_test_suite
.
vcs_repository_list
))
self
.
assertEquals
(
2
,
len
(
node_test_suite
.
vcs_repository_list
))
...
@@ -305,7 +309,7 @@ develop = false
...
@@ -305,7 +309,7 @@ develop = false
test_node
=
self
.
getTestNode
()
test_node
=
self
.
getTestNode
()
node_test_suite
=
test_node
.
getNodeTestSuite
(
'foo'
)
node_test_suite
=
test_node
.
getNodeTestSuite
(
'foo'
)
self
.
updateNodeTestSuiteData
(
node_test_suite
,
add_third_repository
=
True
)
self
.
updateNodeTestSuiteData
(
node_test_suite
,
add_third_repository
=
True
)
rev_list
=
test_node
.
getAndUpdateFullRevisionList
(
node_test_suite
)
rev_list
=
self
.
getAndUpdateFullRevisionList
(
test_node
,
node_test_suite
)
self
.
assertEquals
(
3
,
len
(
rev_list
))
self
.
assertEquals
(
3
,
len
(
rev_list
))
self
.
assertEquals
(
3
,
len
(
node_test_suite
.
vcs_repository_list
))
self
.
assertEquals
(
3
,
len
(
node_test_suite
.
vcs_repository_list
))
rep2_clone_path
=
[
x
[
'repository_path'
]
for
x
in
\
rep2_clone_path
=
[
x
[
'repository_path'
]
for
x
in
\
...
@@ -319,7 +323,7 @@ develop = false
...
@@ -319,7 +323,7 @@ develop = false
self
.
assertEquals
(
vcs_repository_info
[
'branch'
],
'foo'
)
self
.
assertEquals
(
vcs_repository_info
[
'branch'
],
'foo'
)
# change it to master
# change it to master
vcs_repository_info
[
'branch'
]
=
'master'
vcs_repository_info
[
'branch'
]
=
'master'
rev_list
=
test_node
.
getAndUpdateFullRevisionList
(
node_test_suite
)
rev_list
=
self
.
getAndUpdateFullRevisionList
(
test_node
,
node_test_suite
)
output
=
call
(
"git branch"
.
split
()).
strip
()
output
=
call
(
"git branch"
.
split
()).
strip
()
print
output
print
output
self
.
assertTrue
(
"* master"
in
output
.
split
(
'
\
n
'
))
self
.
assertTrue
(
"* master"
in
output
.
split
(
'
\
n
'
))
...
@@ -327,7 +331,7 @@ develop = false
...
@@ -327,7 +331,7 @@ develop = false
remote_call
=
self
.
getCaller
(
cwd
=
self
.
remote_repository2
)
remote_call
=
self
.
getCaller
(
cwd
=
self
.
remote_repository2
)
output
=
remote_call
(
'git checkout master -b bar'
.
split
())
output
=
remote_call
(
'git checkout master -b bar'
.
split
())
vcs_repository_info
[
'branch'
]
=
'bar'
vcs_repository_info
[
'branch'
]
=
'bar'
rev_list
=
test_node
.
getAndUpdateFullRevisionList
(
node_test_suite
)
rev_list
=
self
.
getAndUpdateFullRevisionList
(
test_node
,
node_test_suite
)
output
=
call
(
"git branch"
.
split
()).
strip
()
output
=
call
(
"git branch"
.
split
()).
strip
()
self
.
assertTrue
(
"* bar"
in
output
.
split
(
'
\
n
'
))
self
.
assertTrue
(
"* bar"
in
output
.
split
(
'
\
n
'
))
...
@@ -341,7 +345,7 @@ develop = false
...
@@ -341,7 +345,7 @@ develop = false
test_node
=
self
.
getTestNode
()
test_node
=
self
.
getTestNode
()
node_test_suite
=
test_node
.
getNodeTestSuite
(
'foo'
)
node_test_suite
=
test_node
.
getNodeTestSuite
(
'foo'
)
self
.
updateNodeTestSuiteData
(
node_test_suite
)
self
.
updateNodeTestSuiteData
(
node_test_suite
)
rev_list
=
test_node
.
getAndUpdateFullRevisionList
(
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
(
2
,
len
(
node_test_suite
.
vcs_repository_list
))
self
.
assertEquals
(
2
,
len
(
node_test_suite
.
vcs_repository_list
))
# patch deleteRepository to make sure it will be called once for the wrong
# patch deleteRepository to make sure it will be called once for the wrong
...
@@ -362,7 +366,7 @@ develop = false
...
@@ -362,7 +366,7 @@ develop = false
call
=
self
.
getCaller
(
cwd
=
rep0_clone_path
)
call
=
self
.
getCaller
(
cwd
=
rep0_clone_path
)
self
.
assertEquals
(
call
(
"git config --get remote.origin.url"
.
split
()).
strip
(),
self
.
assertEquals
(
call
(
"git config --get remote.origin.url"
.
split
()).
strip
(),
self
.
remote_repository0
)
self
.
remote_repository0
)
rev_list
=
test_node
.
getAndUpdateFullRevisionList
(
node_test_suite
)
rev_list
=
self
.
getAndUpdateFullRevisionList
(
test_node
,
node_test_suite
)
self
.
assertEquals
(
call
(
"git config --get remote.origin.url"
.
split
()).
strip
(),
self
.
assertEquals
(
call
(
"git config --get remote.origin.url"
.
split
()).
strip
(),
self
.
remote_repository2
)
self
.
remote_repository2
)
self
.
assertEquals
([
rep0_clone_path
],
deleted_repository_path_list
)
self
.
assertEquals
([
rep0_clone_path
],
deleted_repository_path_list
)
...
@@ -380,7 +384,7 @@ develop = false
...
@@ -380,7 +384,7 @@ develop = false
test_node
=
self
.
getTestNode
()
test_node
=
self
.
getTestNode
()
node_test_suite
=
test_node
.
getNodeTestSuite
(
'foo'
)
node_test_suite
=
test_node
.
getNodeTestSuite
(
'foo'
)
self
.
updateNodeTestSuiteData
(
node_test_suite
)
self
.
updateNodeTestSuiteData
(
node_test_suite
)
rev_list
=
test_node
.
getAndUpdateFullRevisionList
(
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
(
2
,
len
(
node_test_suite
.
vcs_repository_list
))
self
.
assertEquals
(
2
,
len
(
node_test_suite
.
vcs_repository_list
))
rep0_clone_path
=
[
x
[
'repository_path'
]
for
x
in
\
rep0_clone_path
=
[
x
[
'repository_path'
]
for
x
in
\
...
@@ -390,7 +394,7 @@ develop = false
...
@@ -390,7 +394,7 @@ develop = false
my_file
.
write
(
"next_content"
)
my_file
.
write
(
"next_content"
)
my_file
.
close
()
my_file
.
close
()
# make sure code still works
# make sure code still works
rev_list
=
test_node
.
getAndUpdateFullRevisionList
(
node_test_suite
)
rev_list
=
self
.
getAndUpdateFullRevisionList
(
test_node
,
node_test_suite
)
self
.
assertEqual
(
2
,
len
(
rev_list
))
self
.
assertEqual
(
2
,
len
(
rev_list
))
self
.
assertEqual
(
2
,
len
(
node_test_suite
.
vcs_repository_list
))
self
.
assertEqual
(
2
,
len
(
node_test_suite
.
vcs_repository_list
))
# and check local change was resetted
# and check local change was resetted
...
@@ -408,7 +412,7 @@ develop = false
...
@@ -408,7 +412,7 @@ develop = false
test_node
=
self
.
getTestNode
()
test_node
=
self
.
getTestNode
()
node_test_suite
=
test_node
.
getNodeTestSuite
(
'foo'
)
node_test_suite
=
test_node
.
getNodeTestSuite
(
'foo'
)
self
.
updateNodeTestSuiteData
(
node_test_suite
,
add_broken_repository
=
True
)
self
.
updateNodeTestSuiteData
(
node_test_suite
,
add_broken_repository
=
True
)
rev_list
=
test_node
.
getAndUpdateFullRevisionList
(
node_test_suite
)
rev_list
=
self
.
getAndUpdateFullRevisionList
(
test_node
,
node_test_suite
)
self
.
assertEqual
(
None
,
rev_list
)
self
.
assertEqual
(
None
,
rev_list
)
def
test_06_checkRevision
(
self
):
def
test_06_checkRevision
(
self
):
...
@@ -419,7 +423,7 @@ develop = false
...
@@ -419,7 +423,7 @@ develop = false
test_node
=
self
.
getTestNode
()
test_node
=
self
.
getTestNode
()
node_test_suite
=
test_node
.
getNodeTestSuite
(
'foo'
)
node_test_suite
=
test_node
.
getNodeTestSuite
(
'foo'
)
self
.
updateNodeTestSuiteData
(
node_test_suite
)
self
.
updateNodeTestSuiteData
(
node_test_suite
)
rev_list
=
test_node
.
getAndUpdateFullRevisionList
(
node_test_suite
)
rev_list
=
self
.
getAndUpdateFullRevisionList
(
test_node
,
node_test_suite
)
def
getRepInfo
(
count
=
0
,
hash
=
0
):
def
getRepInfo
(
count
=
0
,
hash
=
0
):
assert
count
or
hash
assert
count
or
hash
info_list
=
[]
info_list
=
[]
...
...
erp5/util/testnode/NodeTestSuite.py
View file @
63b3ccda
...
@@ -107,3 +107,9 @@ class NodeTestSuite(SlapOSInstance):
...
@@ -107,3 +107,9 @@ class NodeTestSuite(SlapOSInstance):
def
getSuiteLogPath
(
self
):
def
getSuiteLogPath
(
self
):
return
getattr
(
self
,
"suite_log_path"
,
None
)
return
getattr
(
self
,
"suite_log_path"
,
None
)
@
property
def
revision
(
self
):
return
','
.
join
(
'%s=%s-%s'
%
(
repository
[:
-
11
]
if
repository
.
endswith
(
'-repository'
)
else
repository
,
count
,
revision
)
for
repository
,
(
count
,
revision
)
in
self
.
revision_list
)
erp5/util/testnode/testnode.py
View file @
63b3ccda
...
@@ -112,6 +112,7 @@ class TestNode(object):
...
@@ -112,6 +112,7 @@ class TestNode(object):
assert
len
(
node_test_suite
.
vcs_repository_list
),
"we must have at least one repository"
assert
len
(
node_test_suite
.
vcs_repository_list
),
"we must have at least one repository"
profile_path_count
=
0
profile_path_count
=
0
profile_content_list
=
[]
profile_content_list
=
[]
revision_dict
=
dict
(
node_test_suite
.
revision_list
)
for
vcs_repository
in
node_test_suite
.
vcs_repository_list
:
for
vcs_repository
in
node_test_suite
.
vcs_repository_list
:
url
=
vcs_repository
[
'url'
]
url
=
vcs_repository
[
'url'
]
buildout_section_id
=
vcs_repository
.
get
(
'buildout_section_id'
,
None
)
buildout_section_id
=
vcs_repository
.
get
(
'buildout_section_id'
,
None
)
...
@@ -147,15 +148,6 @@ extends = %(software_config_path)s
...
@@ -147,15 +148,6 @@ extends = %(software_config_path)s
repository_path
=
os
.
path
.
relpath
(
repository_path
,
from_path
)
repository_path
=
os
.
path
.
relpath
(
repository_path
,
from_path
)
if
test_type
==
"ScalabilityTest"
:
if
test_type
==
"ScalabilityTest"
:
# updater = Updater(repository_path, git_binary=self.config['git_binary'],
# branch = vcs_repository.get('branch','master'), log=self.log, process_manager=self.process_manager)
# updater.checkout()
# revision = updater.getRevision()[1]
all_revision
=
node_test_suite
.
revision
# from 'sec1=xx-azer,sec2=yy-qwer,..' to [[sec1,azer],[sec2,qwer],..]
revision_list
=
[
[
x
.
split
(
'='
)[
0
],
x
.
split
(
'='
)[
1
].
split
(
'-'
)[
1
]]
for
x
in
all_revision
.
split
(
','
)
]
# from [[sec1,azer],[sec2,qwer],..] to {sec1:azer,sec2:qwer,..}
revision_dict
=
{
branch
:
revision
for
branch
,
revision
in
revision_list
}
# <obfuscated_url> word is modified by in runner.prepareSlapOSForTestSuite()
# <obfuscated_url> word is modified by in runner.prepareSlapOSForTestSuite()
profile_content_list
.
append
(
"""
profile_content_list
.
append
(
"""
[%(buildout_section_id)s]
[%(buildout_section_id)s]
...
@@ -165,7 +157,7 @@ ignore-ssl-certificate = true
...
@@ -165,7 +157,7 @@ ignore-ssl-certificate = true
develop = false
develop = false
shared = true
shared = true
"""
%
{
'buildout_section_id'
:
buildout_section_id
,
"""
%
{
'buildout_section_id'
:
buildout_section_id
,
'revision'
:
revision_dict
[
buildout_section_id
]})
'revision'
:
revision_dict
[
buildout_section_id
]
[
1
]
})
else
:
else
:
profile_content_list
.
append
(
"""
profile_content_list
.
append
(
"""
[%(buildout_section_id)s]
[%(buildout_section_id)s]
...
@@ -187,10 +179,10 @@ shared = true
...
@@ -187,10 +179,10 @@ shared = true
custom_profile
.
close
()
custom_profile
.
close
()
sys
.
path
.
append
(
repository_path
)
sys
.
path
.
append
(
repository_path
)
def
getAndUpdateFullRevisionList
(
self
,
node_test_suite
):
def
updateRevisionList
(
self
,
node_test_suite
):
full_revision_list
=
[]
config
=
self
.
config
config
=
self
.
config
log
=
self
.
log
log
=
self
.
log
revision_list
=
[]
try
:
try
:
for
vcs_repository
in
node_test_suite
.
vcs_repository_list
:
for
vcs_repository
in
node_test_suite
.
vcs_repository_list
:
repository_path
=
vcs_repository
[
'repository_path'
]
repository_path
=
vcs_repository
[
'repository_path'
]
...
@@ -202,13 +194,12 @@ shared = true
...
@@ -202,13 +194,12 @@ shared = true
working_directory
=
node_test_suite
.
working_directory
,
working_directory
=
node_test_suite
.
working_directory
,
url
=
vcs_repository
[
"url"
])
url
=
vcs_repository
[
"url"
])
updater
.
checkout
()
updater
.
checkout
()
revision
=
"-"
.
join
(
updater
.
getRevision
())
revision_list
.
append
((
repository_id
,
updater
.
getRevision
()))
full_revision_list
.
append
(
'%s=%s'
%
(
repository_id
,
revision
))
node_test_suite
.
revision
=
','
.
join
(
full_revision_list
)
except
SubprocessError
,
e
:
except
SubprocessError
,
e
:
log
(
"Error while getting repository, ignoring this test suite : %r"
%
(
e
,),
exc_info
=
sys
.
exc_info
())
log
(
"Error while getting repository, ignoring this test suite : %r"
%
(
e
,),
exc_info
=
sys
.
exc_info
())
full_revision_list
=
None
return
False
return
full_revision_list
node_test_suite
.
revision_list
=
revision_list
return
True
def
registerSuiteLog
(
self
,
test_result
,
node_test_suite
):
def
registerSuiteLog
(
self
,
test_result
,
node_test_suite
):
"""
"""
...
@@ -385,8 +376,7 @@ from the distributor.")
...
@@ -385,8 +376,7 @@ from the distributor.")
run_software
=
True
run_software
=
True
# kill processes from previous loop if any
# kill processes from previous loop if any
self
.
process_manager
.
killPreviousRun
()
self
.
process_manager
.
killPreviousRun
()
revision_list
=
self
.
getAndUpdateFullRevisionList
(
node_test_suite
)
if
not
self
.
updateRevisionList
(
node_test_suite
):
if
revision_list
is
None
:
continue
continue
# Write our own software.cfg to use the local repository
# Write our own software.cfg to use the local repository
self
.
constructProfile
(
node_test_suite
,
my_test_type
,
self
.
constructProfile
(
node_test_suite
,
my_test_type
,
...
...
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