Update cqlsh tests for latest trunk

Patch by Jim Witschey; reviewed by Tyler Hobbs for CASSANDRA-9173
This commit is contained in:
Jim Witschey 2015-04-14 11:39:33 -05:00 committed by Tyler Hobbs
parent 4a3ca5c70e
commit 23e77f10a4
5 changed files with 17 additions and 19 deletions

View File

@ -209,8 +209,6 @@ CQL_ERRORS = (
debug_completion = bool(os.environ.get('CQLSH_DEBUG_COMPLETION', '') == 'YES')
SYSTEM_KEYSPACES = ('system', 'system_traces', 'system_auth')
# we want the cql parser to understand our cqlsh-specific commands too
my_commands_ending_with_newline = (
'help',
@ -1288,7 +1286,7 @@ class Shell(cmd.Cmd):
def describe_schema(self, include_system=False):
print
for k in self.get_keyspaces():
if include_system or not k.name in SYSTEM_KEYSPACES:
if include_system or not k.name in cql3handling.SYSTEM_KEYSPACES:
self.print_recreate_keyspace(k, sys.stdout)
print

View File

@ -33,7 +33,7 @@ class UnexpectedTableStructure(UserWarning):
def __str__(self):
return 'Unexpected table structure; may not translate correctly to CQL. ' + self.msg
SYSTEM_KEYSPACES = ('system', 'system_traces', 'system_auth')
SYSTEM_KEYSPACES = ('system', 'system_traces', 'system_auth', 'system_distributed')
NONALTERBALE_KEYSPACES = ('system')
class Cql3ParsingRuleSet(CqlParsingRuleSet):

View File

@ -389,7 +389,8 @@ class TestCqlshCompletion(CqlshCompletionCase):
'twenty_rows_composite_table',
'utf8_with_special_chars',
'system_traces.', 'songs',
'"' + self.cqlsh.keyspace + '".'])
'"' + self.cqlsh.keyspace + '".'],
other_choices_ok=True)
self.trycompletions('DELETE FROM ',
choices=['twenty_rows_table',
@ -401,7 +402,8 @@ class TestCqlshCompletion(CqlshCompletionCase):
'twenty_rows_composite_table',
'utf8_with_special_chars',
'system_traces.', 'songs',
'"' + self.cqlsh.keyspace + '".'])
'"' + self.cqlsh.keyspace + '".'],
other_choices_ok=True)
self.trycompletions('DELETE FROM twenty_rows_composite_table ',
choices=['USING', 'WHERE'])

View File

@ -110,14 +110,14 @@ class TestCqlshOutput(BaseTestCase):
for line in output:
self.assertNoHasColors(line)
self.assertNotRegexpMatches(line, r'^cqlsh\S*>')
self.assertTrue(6 <= len(output) <= 8,
msg='output: %r' % '\n'.join(output))
self.assertEqual(len(output), 6,
msg='output: %r' % '\n'.join(output))
self.assertEqual(output[0], '')
self.assertEqual(output[1], 'Warning! Non-ISO 8601 dates detected (< 1-1-1 or > 9999-12-31). Returning raw days since epoch.');
self.assertNicelyFormattedTableHeader(output[2])
self.assertNicelyFormattedTableRule(output[3])
self.assertNicelyFormattedTableData(output[4])
self.assertEqual(output[5].strip(), '')
self.assertNicelyFormattedTableHeader(output[1])
self.assertNicelyFormattedTableRule(output[2])
self.assertNicelyFormattedTableData(output[3])
self.assertEqual(output[4].strip(), '')
self.assertEqual(output[5].strip(), '(1 rows)')
def test_color_output(self):
for termname in ('xterm', 'unknown-garbage'):
@ -275,9 +275,9 @@ class TestCqlshOutput(BaseTestCase):
# same query should show up as empty in cql 3
self.assertQueriesGiveColoredOutput((
(q, """
num | asciicol | bigintcol | blobcol | booleancol | datecol | decimalcol | doublecol | floatcol | intcol | textcol | timecol | timestampcol | uuidcol | varcharcol | varintcol
RRR MMMMMMMM MMMMMMMMM MMMMMMM MMMMMMMMMM MMMMMMM MMMMMMMMMM MMMMMMMMM MMMMMMMM MMMMMM MMMMMMM MMMMMMM MMMMMMMMMMMM MMMMMMM MMMMMMMMMM MMMMMMMMM
-----+----------+-----------+---------+------------+---------+------------+-----------+----------+--------+---------+---------+--------------+---------+------------+-----------
num | asciicol | bigintcol | blobcol | booleancol | decimalcol | doublecol | floatcol | intcol | textcol | timestampcol | uuidcol | varcharcol | varintcol
RRR MMMMMMMM MMMMMMMMM MMMMMMM MMMMMMMMMM MMMMMMMMMM MMMMMMMMM MMMMMMMM MMMMMM MMMMMMM MMMMMMMMMMMM MMMMMMM MMMMMMMMMM MMMMMMMMM
-----+----------+-----------+---------+------------+------------+-----------+----------+--------+---------+--------------+---------+------------+-----------
(0 rows)
@ -598,13 +598,11 @@ class TestCqlshOutput(BaseTestCase):
bigintcol bigint,
blobcol blob,
booleancol boolean,
datecol date,
decimalcol decimal,
doublecol double,
floatcol float,
intcol int,
textcol text,
timecol time,
timestampcol timestamp,
uuidcol uuid,
varcharcol text,

View File

@ -27,7 +27,7 @@ INSERT INTO has_all_types (num, intcol, asciicol, bigintcol, blobcol, booleancol
timestampcol, uuidcol, varcharcol, varintcol)
VALUES (1, 2147483647, '__!''$#@!~"', 9223372036854775807, 0xffffffffffffffffff, true,
0.00000000000001, 9999999.999, 99999.99, '∭Ƕ⑮ฑ➳❏''',
'1900-01-01+0000', ffffffff-ffff-ffff-ffff-ffffffffffff, 'newline->
'1950-01-01+0000', ffffffff-ffff-ffff-ffff-ffffffffffff, 'newline->
<-', 9);
INSERT INTO has_all_types (num, intcol, asciicol, bigintcol, blobcol, booleancol,