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
zhifan huang
slapos
Commits
ac187959
Commit
ac187959
authored
Mar 01, 2022
by
zhifan huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add unit test in buildout
parent
d64893e5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
125 additions
and
3 deletions
+125
-3
software/re6stnet/buildout.hash.cfg
software/re6stnet/buildout.hash.cfg
+5
-1
software/re6stnet/instance.cfg.in
software/re6stnet/instance.cfg.in
+10
-1
software/re6stnet/run-unit-test.in
software/re6stnet/run-unit-test.in
+92
-0
software/re6stnet/software.cfg
software/re6stnet/software.cfg
+18
-1
No files found.
software/re6stnet/buildout.hash.cfg
View file @
ac187959
...
...
@@ -14,7 +14,7 @@
# not need these here).
[template]
filename = instance.cfg.in
md5sum =
71531ed9c9b79fa769ab367e7ea2d2a5
md5sum =
903551f51064dce6a7596c78ab687d48
[template-re6stnet]
filename = instance-re6stnet.cfg.in
...
...
@@ -27,3 +27,7 @@ md5sum = 3d55f7c9c4fc7279f06bfe6313a78a4b
[template-re6st-registry-conf]
filename = re6st-registry.conf.in
md5sum = feb4b3318f37414d1bf3d16a03aec93d
[template-runTestSuite]
filename = run-unit-test.in
md5sum = 3f55419497b7440200e4733ee4ffa6f6
software/re6stnet/instance.cfg.in
View file @
ac187959
[buildout]
parts = switch-softwaretype
parts = switch-softwaretype
runTestSuite-instance
eggs-directory = {{ eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }}
...
...
@@ -49,3 +49,12 @@ default = dynamic-template-re6stnet:rendered
registry = ${:default}
# BBB
RootSoftwareInstance = ${:default}
[runTestSuite-instance]
recipe = slapos.recipe.template
url = {{template_re6st_runTestSuite}}
output = {{ bin_directory }}/runTestSuite
python-executable = {{ python_with_eggs }}
directory = ${buildout:directory}
mode = 0700
software/re6stnet/run-unit-test.in
0 → 100644
View file @
ac187959
#!${buildout:bin-directory}/${re6stnet:interpreter}
import sys
import argparse
import subprocess
import json
import time
from erp5.util import taskdistribution
class DummyTestResult:
class DummyTestResultLine:
def stop(self, **kw):
print json.dumps(kw)
done = 0
def __init__(self, test_name_list):
self.test_name_list = test_name_list
def start(self):
test_result_line = self.DummyTestResultLine()
try:
test_result_line.name = self.test_name_list[self.done]
except IndexError:
return
self.done += 1
return test_result_line
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
test_name_list = ['Registry']
if args.master_url:
tool = taskdistribution.TaskDistributor(portal_url = args.master_url)
test_result = tool.createTestResult(args.revision,
test_name_list,
node_title=args.test_node_title,
test_title=test_suite_title,
project_title=args.project_title)
else:
test_result = DummyTestResult(test_name_list)
if test_result is None:
return
while 1:
test_result_line = test_result.start()
if not test_result_line:
break
command = ["./re6st-testrunner"]
p = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
out, err = p.communicate()
result = out.replace("'", '"')
status_dict = json.loads(result)
end = time.time()
# print to stdout so we can see in testnode logs
sys.stdout.write(out)
sys.stderr.write(err)
# report status back to Nexedi ERP5
test_result_line.stop(
command = command,
date = time.strftime("%Y/%m/%d %H:%M:%S", time.gmtime(end)),
stderr=err,
stdout=out,
**status_dict)
if __name__ == "__main__":
main()
software/re6stnet/software.cfg
View file @
ac187959
...
...
@@ -88,6 +88,7 @@ context =
key template_apache_conf template-apache-conf:target
key template_re6stnet template-re6stnet:target
key template_re6st_registry_conf template-re6st-registry-conf:target
key template_re6st_runTestSuite template-runTestSuite:output
key template_logrotate_base template-logrotate-base:rendered
key monitor2_template_rendered monitor2-template:rendered
raw python_with_eggs ${buildout:bin-directory}/${re6stnet:interpreter}
...
...
@@ -106,6 +107,22 @@ miniupnpc = 1.9
# No test suite for re6stnet for now. The revision is hardcoded.
# unit test part
[re6stnet-repository]
revision = ba573ab79903858e73766ede84d63bc283f52bf4
repository = https://lab.nexedi.com/zf.huang/re6stnet.git
revision =
branch = unittest
# develop = true
[template-runTestSuite]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/${:filename}
mode = 0644
output = ${buildout:directory}/runTestSuite.in
[re6stnet]
eggs +=
erp5.util
mock
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