Commit 07ffb3ac authored by Julien Muchembled's avatar Julien Muchembled Committed by Klaus Wölfel

erp5.util.testnode: fix values of --firefox_bin and --xvfb_bin

Firefox and Xvfb aren not provided by the tested SR,
but rather by a separate SR that is installed by the testnode.
parent 484b0867
...@@ -87,6 +87,8 @@ class ERP5TestNode(TestCase): ...@@ -87,6 +87,8 @@ class ERP5TestNode(TestCase):
config["server_url"] = "http://foo.bar" config["server_url"] = "http://foo.bar"
config["httpd_ip"] = "ff:ff:ff:ff:ff:ff:ff:ff" config["httpd_ip"] = "ff:ff:ff:ff:ff:ff:ff:ff"
config["httpd_software_access_port"] = "9080" config["httpd_software_access_port"] = "9080"
config["frontend_url"] = "http://frontend/"
config["software_list"] = ["foo", "bar"]
return TestNode(self.log, config) return TestNode(self.log, config)
...@@ -530,20 +532,21 @@ develop = false ...@@ -530,20 +532,21 @@ develop = false
expected_parameter_list.extend(additional_parameter_list) expected_parameter_list.extend(additional_parameter_list)
self.assertEqual(call_parameter_list[0]['args'], expected_parameter_list) self.assertEqual(call_parameter_list[0]['args'], expected_parameter_list)
call_parameter_list = [] def part(path): # in "bar" SR
path = test_node.config['slapos_directory'] \
+ '/soft/37b51d194a7513e45b56f6524f2d51f2/parts/' + path
os.makedirs(os.path.dirname(path))
os.close(os.open(path, os.O_CREAT))
return path
for option in (
('--firefox_bin', part('firefox/firefox-slapos')),
('--frontend_url', 'http://frontend/'),
('--node_quantity', 3),
('--xvfb_bin', part('xserver/bin/Xvfb')),
):
parser.add_argument(option[0])
expected_parameter_list += option
checkRunTestSuiteParameters() checkRunTestSuiteParameters()
_createPath(os.path.join(test_node.config['slapos_directory'], 'soft/a/parts/firefox'),'firefox-slapos')
_createPath(os.path.join(test_node.config['slapos_directory'], 'soft/a/parts/xserver/bin'),'Xvfb')
call_parameter_list = []
checkRunTestSuiteParameters(additional_parameter_list=['--firefox_bin',
'%s/soft/a/parts/firefox/firefox-slapos'
%(test_node.config['slapos_directory']),
'--xvfb_bin',
'%s/soft/a/parts/xserver/bin/Xvfb'
%(test_node.config['slapos_directory'])])
finally:
ProcessManager.getSupportedParameterSet = original_getSupportedParameter
ProcessManager.spawn = original_spawn
def test_10_prepareSlapOS(self, my_test_type='UnitTest'): def test_10_prepareSlapOS(self, my_test_type='UnitTest'):
test_node = self.getTestNode() test_node = self.getTestNode()
......
...@@ -43,6 +43,7 @@ from NodeTestSuite import SlapOSInstance ...@@ -43,6 +43,7 @@ from NodeTestSuite import SlapOSInstance
from Updater import Updater from Updater import Updater
from Utils import dealShebang from Utils import dealShebang
from erp5.util import taskdistribution from erp5.util import taskdistribution
from slapos.grid.utils import md5digest
class UnitTestRunner(): class UnitTestRunner():
def __init__(self, testnode): def __init__(self, testnode):
...@@ -142,26 +143,27 @@ class UnitTestRunner(): ...@@ -142,26 +143,27 @@ class UnitTestRunner():
run_test_suite_revision = node_test_suite.revision run_test_suite_revision = node_test_suite.revision
# Deal with Shebang size limitation # Deal with Shebang size limitation
invocation_list = dealShebang(run_test_suite_path) invocation_list = dealShebang(run_test_suite_path)
invocation_list.extend([run_test_suite_path, invocation_list += (run_test_suite_path,
'--test_suite', node_test_suite.test_suite, '--master_url', portal_url,
'--revision', node_test_suite.revision, '--revision', node_test_suite.revision,
'--test_suite_title', node_test_suite.test_suite_title, '--test_suite', node_test_suite.test_suite,
'--node_quantity', config['node_quantity'], '--test_suite_title', node_test_suite.test_suite_title)
'--master_url', portal_url]) supported_parameter_set = set(self.testnode.process_manager
firefox_bin_list = glob.glob("%s/soft/*/parts/firefox/firefox-slapos" % \ .getSupportedParameterList(run_test_suite_path))
config["slapos_directory"]) def part(path):
if len(firefox_bin_list): path = config['slapos_directory'] + '/soft/%s/parts/' + path
parameter_list.append('--firefox_bin') path, = filter(os.path.exists, (path % md5digest(software)
xvfb_bin_list = glob.glob("%s/soft/*/parts/xserver/bin/Xvfb" % \ for software in config['software_list']))
config["slapos_directory"]) return path
if len(xvfb_bin_list): for option, value in (
parameter_list.append('--xvfb_bin') ('--firefox_bin', lambda: part('firefox/firefox-slapos')),
supported_paramater_set = self.testnode.process_manager.getSupportedParameterSet( ('--frontend_url', lambda: config['frontend_url']),
run_test_suite_path, parameter_list) ('--node_quantity', lambda: config['node_quantity']),
if '--firefox_bin' in supported_paramater_set: ('--xvfb_bin', lambda: part('xserver/bin/Xvfb')),
invocation_list.extend(["--firefox_bin", firefox_bin_list[0]]) ):
if '--xvfb_bin' in supported_paramater_set: if option in supported_parameter_set:
invocation_list.extend(["--xvfb_bin", xvfb_bin_list[0]]) invocation_list += option, value()
# TODO : include testnode correction ( b111682f14890bf ) # TODO : include testnode correction ( b111682f14890bf )
if hasattr(node_test_suite,'additional_bt5_repository_id'): if hasattr(node_test_suite,'additional_bt5_repository_id'):
additional_bt5_path = os.path.join( additional_bt5_path = os.path.join(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment