-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy patharangosh.py
84 lines (77 loc) · 2.76 KB
/
arangosh.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/env python3
""" launch a testing.js instance with given testsuite and arguments """
import os
from async_client import (
ArangoCLIprogressiveTimeoutExecutor,
make_logfile_params,
logfile_line_result,
delete_logfile_params,
)
class ArangoshExecutor(ArangoCLIprogressiveTimeoutExecutor):
"""configuration"""
def __init__(self, site_config, slot_lock):
self.slot_lock = slot_lock
self.read_only = False
super().__init__(site_config, None)
def get_environment(self, params):
""" hook to implemnet custom environment variable setters """
my_env = os.environ.copy()
my_env.update(params['env'])
return my_env
def run_testing(self,
testcase,
arangosh_args,
testing_args,
timeout,
directory,
logfile,
identifier,
temp_dir,
cov_var,
cov_dir,
verbose
):
# pylint: disable=R0913 disable=R0902
""" testing.js wrapper """
print('------')
print(testing_args)
testscript = self.cfg.base_path / 'js' / 'client' / 'modules' / '@arangodb' / 'testutils' / 'unittest.js'
if not testscript.exists():
testscript = self.cfg.base_path / 'UnitTests' / 'unittest.js'
args = [
'-c', str(self.cfg.cfgdir / 'arangosh.conf'),
"--log.foreground-tty", "true",
"--log.force-direct", "true",
'--log.level', 'warning',
"--log.level", "v8=debug",
'--server.endpoint', 'none',
'--javascript.allow-external-process-control', 'true',
'--javascript.execute', str(testscript),
]
run_cmd = arangosh_args + args +[
'--',
testcase,
'--testOutput', directory ] + testing_args
params = make_logfile_params(verbose, logfile, self.cfg.trace, temp_dir)
params['env'] = {
'TMPDIR': str(params['temp_dir']),
'TEMP': str(params['temp_dir']),
'TMP': str(params['temp_dir'])
}
if cov_dir is not None and cov_var is not None:
params['env'][cov_var] = cov_dir
print("Env:")
print(params['env'])
ret = self.run_monitored(
self.cfg.bin_dir / "arangosh",
run_cmd,
params=params,
progressive_timeout=timeout,
deadline=self.cfg.deadline,
result_line_handler=logfile_line_result,
identifier=identifier
)
delete_logfile_params(params)
ret['error'] = params['error']
ret['pid'] = params['pid']
return ret