Files
scylladb/test/cql-pytest/run
Botond Dénes e32fdcba06 test/cql-pytest: add option to omit scylla's output from the test output
Scylla's output is often unnecessary to debug a failed test, or even
detrimental because one has to scroll back in the terminal after each
test run, to see the actual test's output. Add an option,
--omit-scylla-output, which when present on the command line of `run`,
the output of scylla will be omitted from the test output.
Also, to help discover this option (and others), don't run the tests
when either -h or --help is present on the command line. Just invoke
pytest (with said option) and exit.
2023-06-16 06:20:14 -04:00

51 lines
1.5 KiB
Python
Executable File

#!/usr/bin/env python3
import sys
import run # run.py in this directory
print('Scylla is: ' + run.find_scylla() + '.')
ssl = '--ssl' in sys.argv
if ssl:
cmd = run.run_scylla_ssl_cql_cmd
check_cql = run.check_ssl_cql
else:
cmd = run.run_scylla_cmd
check_cql = run.check_cql
# If the "--raft" option is given, switch to the experimental Raft-based
# implementation of schema operations. Some tests are expected to fail
# when not in raft mode, so they use the fails_without_consistent_cluster_management fixture
# that will cause them to xfail when raft isn't used.
if '--raft' in sys.argv:
sys.argv.remove('--raft')
def run_with_raft(pid, dir):
(c, e) = run_with_raft.orig_cmd(pid, dir)
return (c + ['--consistent-cluster-management', 'true'], e)
run_with_raft.orig_cmd = cmd
cmd = run_with_raft
if "-h" in sys.argv or "--help" in sys.argv:
run.run_pytest(sys.path[0], sys.argv)
exit(0)
run.omit_scylla_output = "--omit-scylla-output" in sys.argv
pid = run.run_with_temporary_dir(cmd)
ip = run.pid_to_ip(pid)
run.wait_for_services(pid, [
lambda: run.check_rest_api(ip),
lambda: check_cql(ip)
])
success = run.run_pytest(sys.path[0], ['--host=' + ip] + sys.argv[1:])
run.summary = 'Scylla tests pass' if success else 'Scylla tests failure'
exit(0 if success else 1)
# Note that the run.cleanup_all() function runs now, just like on any exit
# for any reason in this script. It will delete the temporary files and
# announce the failure or success of the test (printing run.summary).