|
36 | 36 | import time |
37 | 37 | import logging |
38 | 38 |
|
39 | | -sys.path.append(os.path.realpath( |
40 | | - os.path.join(os.path.dirname(__file__), "../.."))) |
41 | | -from tests.support import MIG_BASE, PY2, is_path_within |
42 | | - |
43 | 39 | from mig.shared.base import client_id_dir, client_dir_id, get_short_id, \ |
44 | 40 | invisible_path, allow_script, brief_list |
45 | 41 |
|
46 | 42 |
|
47 | | -_TEST_CONF_FILE = os.environ['MIG_CONF'] |
48 | | -_TEST_CONF_DIR = os.path.dirname(_TEST_CONF_FILE) |
49 | | -_TEST_CONF_SYMLINK = os.path.join(MIG_BASE, "envhelp/output/testconfs") |
50 | | - |
51 | | - |
52 | | -def _assert_local_config(): |
53 | | - try: |
54 | | - #link_stat = os.lstat(_TEST_CONF_SYMLINK) |
55 | | - #assert stat.S_ISLNK(link_stat.st_mode) |
56 | | - _test_conf_dir = os.path.dirname(_TEST_CONF_DIR) |
57 | | - configdir_stat = os.stat(_test_conf_dir) |
58 | | - assert stat.S_ISDIR(configdir_stat.st_mode) |
59 | | - config = ConfigParser() |
60 | | - config.read([_TEST_CONF_FILE]) |
61 | | - return config |
62 | | - except Exception as exc: |
63 | | - raise AssertionError( |
64 | | - 'local configuration invalid or missing: %s' % (str(exc),)) |
65 | | - |
66 | | - |
67 | | -def _assert_local_config_global_values(config): |
68 | | - config_global_values = dict(config.items('GLOBAL')) |
69 | | - |
70 | | - for path in ('mig_path', 'certs_path', 'state_path'): |
71 | | - path_value = config_global_values.get(path) |
72 | | - if not is_path_within(path_value, start=MIG_BASE): |
73 | | - raise AssertionError('local config contains bad path: %s=%s' % (path, path_value)) |
74 | | - |
75 | | - return config_global_values |
76 | | - |
77 | | - |
78 | | -def main(configuration, _exit=sys.exit): |
79 | | - config = _assert_local_config() |
80 | | - config_global_values = _assert_local_config_global_values(config) |
| 43 | +def legacy_main(configuration, print=print, _exit=sys.exit): |
81 | 44 |
|
82 | 45 | print("Running unit test on shared core functions ..") |
83 | 46 |
|
@@ -188,4 +151,5 @@ def main(configuration, _exit=sys.exit): |
188 | 151 |
|
189 | 152 | if __name__ == "__main__": |
190 | 153 | from mig.shared.conf import get_configuration_object |
191 | | - main(get_configuration_object()) |
| 154 | + conf = get_configuration_object(skip_log=True, disable_auth_log=True) |
| 155 | + legacy_main(conf) |
0 commit comments