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
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
amrani
erp5
Commits
40a3804e
Commit
40a3804e
authored
Nov 04, 2016
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5.util: update unit tests and fix recent regressions
parent
cc5792d6
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
26 deletions
+32
-26
erp5/tests/testERP5TestNode.py
erp5/tests/testERP5TestNode.py
+16
-10
erp5/util/testnode/UnitTestRunner.py
erp5/util/testnode/UnitTestRunner.py
+1
-1
erp5/util/testnode/testnode.py
erp5/util/testnode/testnode.py
+15
-15
No files found.
erp5/tests/testERP5TestNode.py
View file @
40a3804e
...
...
@@ -2,7 +2,7 @@ import unittest
from
unittest
import
TestCase
from
erp5.util.testnode.testnode
import
TestNode
from
erp5.util.testnode.NodeTestSuite
import
SlapOSInstance
from
erp5.util.testnode.NodeTestSuite
import
SlapOSInstance
,
NodeTestSuite
from
erp5.util.testnode.ProcessManager
import
ProcessManager
,
SubprocessError
from
erp5.util.testnode.Updater
import
Updater
...
...
@@ -87,6 +87,7 @@ class ERP5TestNode(TestCase):
config
[
"server_url"
]
=
"http://foo.bar"
config
[
"httpd_ip"
]
=
"ff:ff:ff:ff:ff:ff:ff:ff"
config
[
"httpd_software_access_port"
]
=
"9080"
config
[
"frontend_url"
]
=
"http://frontend/"
return
TestNode
(
self
.
log
,
config
)
...
...
@@ -228,7 +229,8 @@ class ERP5TestNode(TestCase):
test_node
.
test_suite_portal
.
getTestNode
=
TaskDistributor
.
getTestType
node_test_suite
=
test_node
.
getNodeTestSuite
(
'foo'
)
self
.
updateNodeTestSuiteData
(
node_test_suite
,
add_third_repository
=
True
)
node_test_suite
.
revision
=
'rep1=1234-azerty,rep2=3456-qwerty'
node_test_suite
.
revision_list
=
((
'rep1'
,
(
1234
,
'azerty'
)),
(
'rep2'
,
(
3456
,
'qwerty'
)))
test_node
.
constructProfile
(
node_test_suite
,
my_test_type
)
self
.
assertEquals
(
"%s/software.cfg"
%
(
node_test_suite
.
working_directory
,),
node_test_suite
.
custom_profile_path
)
...
...
@@ -243,12 +245,14 @@ repository = %(temp_dir)s/testnode/foo/rep1
branch = master
revision =
develop = false
shared = true
[rep2]
repository = %(temp_dir)s/testnode/foo/rep2
branch = foo
revision =
develop = false
shared = true
"""
%
{
'temp_dir'
:
self
.
_temp_dir
}
else
:
revision1
=
"azerty"
...
...
@@ -262,12 +266,14 @@ repository = <obfuscated_url>/rep1/rep1.git
revision = %(revision1)s
ignore-ssl-certificate = true
develop = false
shared = true
[rep2]
repository = <obfuscated_url>/rep2/rep2.git
revision = %(revision2)s
ignore-ssl-certificate = true
develop = false
shared = true
"""
%
{
'temp_dir'
:
self
.
_temp_dir
,
'revision1'
:
revision1
,
'revision2'
:
revision2
}
self
.
assertEquals
(
expected_profile
,
profile
.
read
())
profile
.
close
()
...
...
@@ -440,14 +446,13 @@ develop = false
self
.
assertEquals
([
commit_dict
[
'rep0'
][
0
][
0
],
commit_dict
[
'rep1'
][
0
][
0
]],
getRepInfo
(
hash
=
1
))
class
TestResult
(
object
):
pass
revision
=
NodeTestSuite
.
revision
test_result
=
TestResult
()
# for test result to be one commit late for rep1 to force testnode to
# reset tree to older version
test_result
.
revision
=
'rep0=2-%s,rep1=1-%s'
%
(
commit_dict
[
'rep0'
][
0
][
0
]
,
commit_dict
[
'rep1'
][
1
][
0
]
)
test_result
.
revision
_list
=
((
'rep0'
,
(
2
,
commit_dict
[
'rep0'
][
0
][
0
]))
,
(
'rep1'
,
(
1
,
commit_dict
[
'rep1'
][
1
][
0
]))
)
test_node
.
checkRevision
(
test_result
,
node_test_suite
)
expected_count_list
=
[
'2'
,
'1'
]
self
.
assertEquals
([
'2'
,
'1'
],
getRepInfo
(
count
=
1
))
self
.
assertEquals
([
commit_dict
[
'rep0'
][
0
][
0
],
commit_dict
[
'rep1'
][
1
][
0
]],
getRepInfo
(
hash
=
1
))
...
...
@@ -515,7 +520,7 @@ develop = false
# Create and initialise/regenerate a nodetestsuite
node_test_suite
=
test_node
.
getNodeTestSuite
(
'foo'
)
self
.
updateNodeTestSuiteData
(
node_test_suite
)
node_test_suite
.
revision
=
'dummy'
node_test_suite
.
revision
_list
=
(
'dummy'
,
(
0
,
''
)),
# Path to the dummy runable
run_test_suite_path
=
_createPath
(
os
.
path
.
join
(
slapos_controler
.
instance_root
,
'a/bin'
),
'runTestSuite'
)
...
...
@@ -527,9 +532,10 @@ develop = false
runner
=
RunnerClass
(
test_node
)
runner
.
runTestSuite
(
node_test_suite
,
"http://foo.bar"
)
expected_parameter_list
=
[
'%s/a/bin/runTestSuite'
%
(
slapos_controler
.
instance_root
),
'--test_suite'
,
'Foo'
,
'--revision'
,
'dummy'
,
'--test_suite_title'
,
'Foo-Test'
,
'--node_quantity'
,
3
,
'--master_url'
,
'http://foo.bar'
]
%
(
slapos_controler
.
instance_root
),
'--test_suite'
,
'Foo'
,
'--revision'
,
'dummy=0-'
,
'--test_suite_title'
,
'Foo-Test'
,
'--node_quantity'
,
3
,
'--master_url'
,
'http://foo.bar'
,
'--frontend_url'
,
'http://frontend/'
]
if
additional_parameter_list
:
expected_parameter_list
.
extend
(
additional_parameter_list
)
self
.
assertEqual
(
call_parameter_list
[
0
][
'args'
],
expected_parameter_list
)
...
...
erp5/util/testnode/UnitTestRunner.py
View file @
40a3804e
...
...
@@ -148,7 +148,7 @@ class UnitTestRunner():
'--test_suite_title'
,
node_test_suite
.
test_suite_title
,
'--node_quantity'
,
config
[
'node_quantity'
],
'--master_url'
,
portal_url
,
'--frontend_url'
,
slapos_controler
.
config
[
'frontend_url'
]])
'--frontend_url'
,
config
[
'frontend_url'
]])
firefox_bin_list
=
glob
.
glob
(
"%s/soft/*/parts/firefox/firefox-slapos"
%
\
config
[
"slapos_directory"
])
if
len
(
firefox_bin_list
):
...
...
erp5/util/testnode/testnode.py
View file @
40a3804e
...
...
@@ -234,27 +234,27 @@ shared = true
self
.
suite_log
=
logger
.
info
def
checkRevision
(
self
,
test_result
,
node_test_suite
):
config
=
self
.
config
log
=
self
.
log
if
log
is
None
:
if
node_test_suite
.
revision
==
test_result
.
revision
:
return
log
=
self
.
log
if
node_test_suite
.
revision
!=
test_result
.
revision
:
log
(
'Disagreement on tested revision, checking out: %r'
%
(
(
node_test_suite
.
revision
,
test_result
.
revision
),))
for
i
,
repository_revision
in
enumerate
(
test_result
.
revision
.
split
(
','
)):
log
(
'Disagreement on tested revision, checking out: %r != %r'
,
node_test_suite
.
revision
,
test_result
.
revision
)
updater_kw
=
dict
(
git_binary
=
self
.
config
[
'git_binary'
],
log
=
log
,
process_manager
=
self
.
process_manager
)
revision_list
=
[]
for
i
,
revision
in
enumerate
(
test_result
.
revision
.
split
(
','
)):
vcs_repository
=
node_test_suite
.
vcs_repository_list
[
i
]
repository_path
=
vcs_repository
[
'repository_path'
]
revision
=
repository_revision
.
rsplit
(
'-'
,
1
)[
1
]
count
,
revision
=
revision
.
split
(
'='
)[
1
].
split
(
'-'
)
revision_list
.
append
((
vcs_repository
[
'repository_id'
],
(
int
(
count
),
revision
)))
# other testnodes on other boxes are already ready to test another
# revision
log
(
' %s at %s'
%
(
repository_path
,
node_test_suite
.
revision
))
updater
=
Updater
(
repository_path
,
git_binary
=
config
[
'git_binary'
],
revision
=
revision
,
log
=
log
,
process_manager
=
self
.
process_manager
)
updater
=
Updater
(
repository_path
,
revision
=
revision
,
**
updater_kw
)
updater
.
checkout
()
updater
.
git_update_server_info
()
updater
.
git_create_repository_link
()
node_test_suite
.
revision
=
test_result
.
revision
node_test_suite
.
revision_list
=
revision_list
def
_cleanupLog
(
self
):
config
=
self
.
config
...
...
@@ -460,12 +460,12 @@ shared = true
sleep_time
=
120
-
(
now
-
begin
)
log
(
"End of processing, going to sleep %s"
,
sleep_time
)
time
.
sleep
(
sleep_time
)
except
Exception
:
log
(
""
,
exc_info
=
1
)
except
:
log
(
""
,
exc_info
=
1
)
raise
finally
:
if
'tb'
in
locals
():
del
tb
# Nice way to kill *everything* generated by run process -- process
# groups working only in POSIX compilant systems
# Exceptions are swallowed during cleanup phase
...
...
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