Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.toolbox
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
Xiaowu Zhang
slapos.toolbox
Commits
4ff1fc1d
Commit
4ff1fc1d
authored
Nov 28, 2014
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slaprunner: tests are run from erp5testnode.
parent
4cd34701
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
73 additions
and
6 deletions
+73
-6
setup.py
setup.py
+1
-0
slapos/runner/runnertest.py
slapos/runner/runnertest.py
+72
-6
No files found.
setup.py
View file @
4ff1fc1d
...
@@ -84,6 +84,7 @@ setup(name=name,
...
@@ -84,6 +84,7 @@ setup(name=name,
'slapos-kill = slapos.systool:kill'
,
'slapos-kill = slapos.systool:kill'
,
'slapreport = slapos.monitor:run_slapreport'
,
'slapreport = slapos.monitor:run_slapreport'
,
'slaprunnertest = slapos.runner.runnertest:main'
,
'slaprunnertest = slapos.runner.runnertest:main'
,
'slaprunnerteststandalone = slapos.runner.runnertest:runStandaloneUnitTest'
,
'zodbpack = slapos.zodbpack:run [zodbpack]'
,
'zodbpack = slapos.zodbpack:run [zodbpack]'
,
'networkbench = slapos.networkbench:main'
'networkbench = slapos.networkbench:main'
]
]
...
...
slapos/runner/runnertest.py
View file @
4ff1fc1d
...
@@ -18,6 +18,7 @@ import json
...
@@ -18,6 +18,7 @@ import json
import
os
import
os
import
shutil
import
shutil
import
sup_process
import
sup_process
import
StringIO
import
time
import
time
import
unittest
import
unittest
...
@@ -31,11 +32,50 @@ from slapos.runner import views
...
@@ -31,11 +32,50 @@ from slapos.runner import views
import
slapos.slap
import
slapos.slap
from
slapos.htpasswd
import
HtpasswdFile
from
slapos.htpasswd
import
HtpasswdFile
import
erp5.util.taskdistribution
as
taskdistribution
#Helpers
#Helpers
def
loadJson
(
response
):
def
loadJson
(
response
):
return
json
.
loads
(
response
.
data
)
return
json
.
loads
(
response
.
data
)
def
parseArguments
():
"""
Parse arguments for erp5testnode-backed test.
"""
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'--test_result_path'
,
metavar
=
'ERP5_TEST_RESULT_PATH'
,
help
=
'ERP5 relative path of the test result'
)
parser
.
add_argument
(
'--revision'
,
metavar
=
'REVISION'
,
help
=
'Revision of the test_suite'
)
parser
.
add_argument
(
'--test_suite'
,
metavar
=
'TEST_SUITE'
,
help
=
'Name of the test suite'
)
parser
.
add_argument
(
'--test_suite_title'
,
metavar
=
'TEST_SUITE'
,
help
=
'The test suite title'
)
parser
.
add_argument
(
'--test_node_title'
,
metavar
=
'NODE_TITLE'
,
help
=
'Title of the testnode which is running this'
'launcher'
)
parser
.
add_argument
(
'--node_quantity'
,
help
=
'Number of parallel tests to run'
,
default
=
1
,
type
=
int
)
parser
.
add_argument
(
'--master_url'
,
metavar
=
'TEST_SUITE_MASTER_URL'
,
help
=
'Url to connect to the ERP5 Master testsuite taskditributor'
)
parser
.
add_argument
(
'additional_arguments'
,
nargs
=
argparse
.
REMAINDER
)
return
parser
.
parse_args
()
class
Config
:
class
Config
:
def
__init__
(
self
):
def
__init__
(
self
):
...
@@ -594,10 +634,36 @@ class SlaprunnerTestCase(unittest.TestCase):
...
@@ -594,10 +634,36 @@ class SlaprunnerTestCase(unittest.TestCase):
def
main
():
def
main
():
# Empty parser for now - so that erp5testnode is happy when doing --help
"""
parser
=
argparse
.
ArgumentParser
()
Function meant to be run by erp5testnode.
parser
.
parse_args
()
"""
args
=
parseArguments
()
master
=
taskdistribution
.
TaskDistributionTool
(
args
.
master_url
)
test_suite_title
=
args
.
test_suite_title
or
args
.
test_suite
revision
=
args
.
revision
test_result
=
master
.
createTestResult
(
revision
,
[
test_suite_title
],
args
.
test_node_title
,
True
,
test_suite_title
,
'foo'
)
#args.project_title)
test_line
=
test_result
.
start
()
start_time
=
time
.
time
()
stderr
=
StringIO
.
StringIO
()
suite
=
unittest
.
TestLoader
().
loadTestsFromTestCase
(
SlaprunnerTestCase
)
test_result
=
unittest
.
TextTestRunner
(
verbosity
=
2
,
stream
=
stderr
).
run
(
suite
)
test_duration
=
time
.
time
()
-
start_time
test_line
.
stop
(
stderr
=
stderr
.
getvalue
(),
test_count
=
test_result
.
testsRun
,
error_count
=
len
(
test_result
.
errors
),
failure_count
=
len
(
test_result
.
failures
)
+
len
(
test_result
.
unexpectedSuccesses
),
skip_count
=
len
(
test_result
.
skipped
),
duration
=
test_duration
)
def
runStandaloneUnitTest
():
"""
Run unit tests without erp5testnode."
"""
unittest
.
main
(
module
=
__name__
)
unittest
.
main
(
module
=
__name__
)
if
__name__
==
'__main__'
:
main
()
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