()
| 1327 | config = enum.auto() |
| 1328 | |
| 1329 | def exec_test(): |
| 1330 | # Parse arguments |
| 1331 | global opt_interactive_on_error |
| 1332 | opt_interactive_on_error = False |
| 1333 | opt_create_cluster = False |
| 1334 | opt_create_cluster_only = False |
| 1335 | opt_ignore_missing_binaries = False |
| 1336 | opt_teardown_cluster = False |
| 1337 | global opt_log_ps_output |
| 1338 | opt_log_ps_output = False |
| 1339 | use_kernel_client = False |
| 1340 | global opt_use_ns |
| 1341 | opt_use_ns = False |
| 1342 | opt_brxnet= None |
| 1343 | opt_verbose = True |
| 1344 | global opt_rotate_logs |
| 1345 | opt_rotate_logs = False |
| 1346 | global opt_exit_on_test_failure |
| 1347 | opt_exit_on_test_failure = True |
| 1348 | mode = Mode.unittest |
| 1349 | |
| 1350 | args = sys.argv[1:] |
| 1351 | flags = [a for a in args if a.startswith("-")] |
| 1352 | modules = [a for a in args if not a.startswith("-")] |
| 1353 | for f in flags: |
| 1354 | if f == '-': |
| 1355 | # using `-` here as a module name for the --config-mode |
| 1356 | # In config mode modules are config paths, |
| 1357 | # and `-` means reading the config from stdin |
| 1358 | # This won't mean much for the unit test mode, but it will fail quickly. |
| 1359 | modules.append("-") |
| 1360 | elif f == "--interactive": |
| 1361 | opt_interactive_on_error = True |
| 1362 | elif f == "--create": |
| 1363 | opt_create_cluster = True |
| 1364 | elif f == "--create-cluster-only": |
| 1365 | opt_create_cluster_only = True |
| 1366 | elif f == "--ignore-missing-binaries": |
| 1367 | opt_ignore_missing_binaries = True |
| 1368 | elif f == '--teardown': |
| 1369 | opt_teardown_cluster = True |
| 1370 | elif f == '--log-ps-output': |
| 1371 | opt_log_ps_output = True |
| 1372 | elif f == '--clear-old-log': |
| 1373 | clear_old_log() |
| 1374 | elif f == "--kclient": |
| 1375 | use_kernel_client = True |
| 1376 | elif f == '--usens': |
| 1377 | opt_use_ns = True |
| 1378 | elif '--brxnet' in f: |
| 1379 | if re.search(r'=[0-9./]+', f) is None: |
| 1380 | log.error("--brxnet=<ip/mask> option needs one argument: '{0}'".format(f)) |
| 1381 | sys.exit(-1) |
| 1382 | opt_brxnet=f.split('=')[1] |
| 1383 | try: |
| 1384 | IP(opt_brxnet) |
| 1385 | if IP(opt_brxnet).iptype() == 'PUBLIC': |
| 1386 | raise RuntimeError('is public') |
no test coverage detected