Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
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
Lu Xu
slapos
Commits
6b48ba76
Commit
6b48ba76
authored
Feb 03, 2016
by
Ivan Tyagov
Committed by
Julien Muchembled
Apr 01, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
neoppod: run NEO test suite within SlapOS/ERP5 testing infrastructure
parent
8cf6cb4c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
190 additions
and
3 deletions
+190
-3
software/neoppod/instance-neo-storage-mysql.cfg.in
software/neoppod/instance-neo-storage-mysql.cfg.in
+14
-0
software/neoppod/instance.cfg.in
software/neoppod/instance.cfg.in
+4
-0
software/neoppod/runTestSuite.in
software/neoppod/runTestSuite.in
+134
-0
software/neoppod/software-common.cfg
software/neoppod/software-common.cfg
+2
-2
software/neoppod/software-zodb4.cfg
software/neoppod/software-zodb4.cfg
+17
-0
software/neoppod/software.cfg
software/neoppod/software.cfg
+19
-1
No files found.
software/neoppod/instance-neo-storage-mysql.cfg.in
View file @
6b48ba76
...
...
@@ -125,6 +125,7 @@ etc_run = ${:etc}/run
var_run = ${:var}/run
srv_mariadb = ${buildout:directory}/srv/mariadb
log = ${buildout:directory}/var/log
tmp = ${buildout:directory}/tmp
[logrotate-mysql]
recipe = slapos.cookbook:logrotate.d
...
...
@@ -134,6 +135,19 @@ name = mariadb
log = ${my-cnf-parameters:error-log} ${my-cnf-parameters:slow-query-log}
post = ${mysqld:mysql-base-directory}/bin/mysql --defaults-file="${my-cnf:rendered}" -e "FLUSH LOGS"
{% if runTestSuite_in is defined -%}
# bin/runTestSuite to run NEO tests
[{{ section('runTestSuite') }}]
recipe = slapos.recipe.template:jinja2
rendered = ${directory:bin}/${:_buildout_section_name_}
template = {{ runTestSuite_in }}
mode = 0755
context =
section directory directory
section my_cnf_parameters my-cnf-parameters
raw bin_directory {{ bin_directory }}
{% endif -%}
[buildout]
extends =
{{ logrotate_cfg }}
...
...
software/neoppod/instance.cfg.in
View file @
6b48ba76
...
...
@@ -12,6 +12,10 @@ extra-context =
import-list =
rawfile root_common {{ root_common }}
[neo-storage-mysql]
extra-context +=
raw runTestSuite_in {{ runTestSuite_in }}
[switch-softwaretype]
recipe = slapos.cookbook:switch-softwaretype
override = {{ dumps(override_switch_softwaretype |default) }}
...
...
software/neoppod/runTestSuite.in
0 → 100644
View file @
6b48ba76
#!{{ bin_directory }}/runTestSuite_py
"""
Script to run NEO test suite using Nexedi's test node framework.
"""
import argparse, os, re, shutil, subprocess, sys, traceback
from erp5.util import taskdistribution
from time import gmtime, strftime
# pattern to get test counts from stdout
SUMMARY_RE = re.compile(
r'^(.*)Summary (.*) (?P<test_count>\d+) (.*) (?P<unexpected_count>\d+|\.)'
r' (.*) (?P<expected_count>\d+|\.) (.*) (?P<skip_count>\d+|\.)'
r' (.*) (?P<duration>\d+(\.\d*)?|\.\d+)s', re.MULTILINE)
# NEO specific environment
TEMP_DIRECTORY = '{{directory.tmp}}/neo_tests'
NEO_DB_SOCKET = '{{my_cnf_parameters.socket}}'
RUN_NEO_TESTS_COMMAND = '{{ bin_directory }}/neotestrunner'
def parseTestStdOut(data):
"""
Parse output of NEO testrunner script.
"""
test_count = 0
unexpected_count = 0
expected_count = 0
skip_count = 0
duration = 0
search = SUMMARY_RE.search(data)
if search:
groupdict = search.groupdict()
test_count = int(groupdict['test_count'])
duration = float(groupdict['duration'])
try:
# it can match '.'!
skip_count = int(groupdict['skip_count'])
except ValueError:
pass
try:
# it can match '.'!
unexpected_count = int(groupdict['unexpected_count'])
except ValueError:
pass
try:
# it can match '.'!
expected_count = int(groupdict['expected_count'])
except ValueError:
pass
return test_count, unexpected_count, expected_count, skip_count, duration
def main():
parser = argparse.ArgumentParser(description='Run a test suite.')
parser.add_argument('--test_suite', help='The test suite name')
parser.add_argument('--test_suite_title', help='The test suite title')
parser.add_argument('--test_node_title', help='The test node title')
parser.add_argument('--project_title', help='The project title')
parser.add_argument('--revision', help='The revision to test',
default='dummy_revision')
parser.add_argument('--node_quantity', help='ignored', type=int)
parser.add_argument('--master_url',
help='The Url of Master controling many suites')
args = parser.parse_args()
test_suite_title = args.test_suite_title or args.test_suite
revision = args.revision
test_name_list = 'SQLite', 'MySQL'
tool = taskdistribution.TaskDistributionTool(portal_url = args.master_url)
test_result = tool.createTestResult(revision = revision,
test_name_list = test_name_list,
node_title = args.test_node_title,
test_title = test_suite_title,
project_title = args.project_title)
if test_result is None:
return
# run NEO tests
while 1:
test_result_line = test_result.start()
if not test_result_line:
break
if os.path.exists(TEMP_DIRECTORY):
shutil.rmtree(TEMP_DIRECTORY)
os.mkdir(TEMP_DIRECTORY)
args = [RUN_NEO_TESTS_COMMAND, '-ufz']
command = ' '.join(args)
env = {'TEMP': TEMP_DIRECTORY,
'NEO_TESTS_ADAPTER': test_result_line.name,
'NEO_TEST_ZODB_FUNCTIONAL': '1',
'NEO_DB_USER': 'root',
'NEO_DB_SOCKET': NEO_DB_SOCKET}
try:
with open(os.devnull) as stdin:
p = subprocess.Popen(args, stdin=stdin, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, env=env)
except Exception:
# Catch any exception here, to warn user instead of being silent,
# by generating fake error result
result = dict(status_code=-1,
command=command,
stderr=traceback.format_exc(),
stdout='')
# XXX: inform test node master of error
raise EnvironmentError(result)
# parse test stdout / stderr, hint to speed up use files first!
stdout, stderr = p.communicate()
date = strftime("%Y/%m/%d %H:%M:%S", gmtime())
test_count, unexpected_count, expected_count, skip_count, duration = \
parseTestStdOut(stdout)
# print to stdout so we can see in testnode logs
sys.stdout.write(stdout)
sys.stderr.write(stderr)
# report status back to Nexedi ERP5
test_result_line.stop(
test_count = test_count,
error_count = unexpected_count, # XXX
failure_count = expected_count, # XXX
skip_count = skip_count,
duration = duration,
date = date,
command = command,
stdout= stdout,
stderr= stderr,
html_test_result='')
if __name__ == "__main__":
main()
software/neoppod/software-common.cfg
View file @
6b48ba76
...
...
@@ -36,7 +36,7 @@ setup = ${neoppod-repository:location}
[neoppod]
recipe = zc.recipe.egg
eggs = neoppod[admin, ctl, master, storage-importer, storage-mysqldb]
eggs = neoppod[admin, ctl, master, storage-importer, storage-mysqldb
, tests
]
${python-mysqlclient:egg}
ZODB3
ZODB3-patches =
...
...
@@ -102,7 +102,7 @@ md5sum = 82f3f76f54ee9db355966a7ada61f56e
[instance-neo-storage-mysql]
<= download-base-neo
md5sum =
84b1150ce30ec827485f9c17debd6b44
md5sum =
4572f8d3f92f1b1639600d0eb7119ab5
[template-neo-my-cnf]
<= download-base-neo
...
...
software/neoppod/software-zodb4.cfg
0 → 100644
View file @
6b48ba76
[buildout]
extends = software.cfg
[neoppod]
eggs = neoppod
${python-mysqlclient:egg}
psutil
ZODB
zope.testing
ZODB-patches =
${neoppod-repository:location}/ZODB.patch
ZODB-patch-options = -p1
[versions]
ZODB = 4.2.0+SlapOSPatched001
transaction =
zdaemon =
software/neoppod/software.cfg
View file @
6b48ba76
...
...
@@ -5,23 +5,41 @@ extends =
parts +=
# NEO instanciation
template
runTestSuite_py
[template]
recipe = slapos.recipe.template:jinja2
template = ${:_profile_base_location_}/instance.cfg.in
md5sum =
777c00a7dbcb145a75f980421a9b20b5
md5sum =
aaf5da66d45d4c08cadb0cd1c5342c54
# XXX: "template.cfg" is hardcoded in instanciation recipe
rendered = ${buildout:directory}/template.cfg
context =
key cluster cluster:target
key instance_common_cfg instance-common:rendered
key root_common root-common:target
key runTestSuite_in runTestSuite.in:target
[cluster]
<= download-base-neo
md5sum = ee8401a4e7d82bf488a57e3399f9ce48
[runTestSuite.in]
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/${:_buildout_section_name_}
md5sum = 1c8d903624310166629a173ecb8ad9f5
[runTestSuite_py]
recipe = zc.recipe.egg
eggs = erp5.util
interpreter = ${:_buildout_section_name_}
[neoppod]
ZODB3-patches +=
${neoppod-repository:location}/ZODB3.patch
[versions]
ZODB3 = 3.10.5+SlapOSPatched002
erp5.util = 0.4.44
# To match ERP5
transaction = 1.1.1
ZConfig = 2.9.1
...
...
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