Skip to content

Commit 72eedea

Browse files
mflemingjacek-lewandowski
authored andcommitted
STAR-431: Add more tests to make sure commands work without --no-file-io too
(cherry picked from commit 033a492)
1 parent 9fbd1b3 commit 72eedea

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

cqlsh_tests/test_cqlsh.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2463,23 +2463,40 @@ def run_cqlsh_catch_toolerror(cmd, env):
24632463
"""
24642464
run_cqlsh will throw ToolError if cqlsh exits with a non-zero exit code.
24652465
"""
2466+
out = ""
2467+
err = ""
24662468
try:
24672469
out, err, _ = self.node1.run_cqlsh(cmd, env)
24682470
except ToolError as e:
24692471
return e.stdout, e.stderr
2472+
return out, err
24702473

2471-
cqlsh_stdout, cqlsh_stderr, = run_cqlsh_catch_toolerror('COPY foo.bar FROM \'blah\';', ['--no-file-io'])
2474+
create_ks(self.session, 'foo', rf=1)
2475+
create_cf(self.session, 'bar', key_type='int', columns={'name': 'text'})
2476+
2477+
cqlsh_stdout, cqlsh_stderr, _ = self.node1.run_cqlsh('COPY foo.bar TO \'/dev/null\';', [])
2478+
assert '0 rows exported to 1 files' in cqlsh_stdout
2479+
assert cqlsh_stderr == ''
2480+
cqlsh_stdout, cqlsh_stderr = run_cqlsh_catch_toolerror('COPY foo.bar TO \'/dev/null\';', ['--no-file-io'])
24722481
assert cqlsh_stdout == ''
24732482
assert 'No file I/O permitted' in cqlsh_stderr
24742483

2484+
cqlsh_stdout, cqlsh_stderr = run_cqlsh_catch_toolerror('DEBUG', [])
2485+
assert '(Pdb)' in cqlsh_stdout
24752486
cqlsh_stdout, cqlsh_stderr = run_cqlsh_catch_toolerror('DEBUG', ['--no-file-io'])
24762487
assert cqlsh_stdout == ''
24772488
assert 'No file I/O permitted' in cqlsh_stderr
24782489

2490+
cqlsh_stdout, cqlsh_stderr = run_cqlsh_catch_toolerror('CAPTURE \'nah\'', [])
2491+
assert cqlsh_stdout == 'Now capturing query output to \'nah\'.\n'
2492+
assert cqlsh_stderr == ''
24792493
cqlsh_stdout, cqlsh_stderr = run_cqlsh_catch_toolerror('CAPTURE \'nah\'', ['--no-file-io'])
24802494
assert cqlsh_stdout == ''
24812495
assert 'No file I/O permitted' in cqlsh_stderr
24822496

2497+
cqlsh_stdout, cqlsh_stderr = run_cqlsh_catch_toolerror('SOURCE \'nah\'', [])
2498+
assert cqlsh_stdout == ''
2499+
assert cqlsh_stderr == ''
24832500
cqlsh_stdout, cqlsh_stderr = run_cqlsh_catch_toolerror('SOURCE \'nah\'', ['--no-file-io'])
24842501
assert cqlsh_stdout == ''
24852502
assert 'No file I/O permitted' in cqlsh_stderr

0 commit comments

Comments
 (0)