diff --git a/bin/cqlsh b/bin/cqlsh index 79b2a9e44e..2078107c21 100755 --- a/bin/cqlsh +++ b/bin/cqlsh @@ -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 diff --git a/pylib/cqlshlib/cql3handling.py b/pylib/cqlshlib/cql3handling.py index ef18c2aa67..a728fedb67 100644 --- a/pylib/cqlshlib/cql3handling.py +++ b/pylib/cqlshlib/cql3handling.py @@ -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): diff --git a/pylib/cqlshlib/test/test_cqlsh_completion.py b/pylib/cqlshlib/test/test_cqlsh_completion.py index 7c2f0cd6e5..371bddba0d 100644 --- a/pylib/cqlshlib/test/test_cqlsh_completion.py +++ b/pylib/cqlshlib/test/test_cqlsh_completion.py @@ -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']) diff --git a/pylib/cqlshlib/test/test_cqlsh_output.py b/pylib/cqlshlib/test/test_cqlsh_output.py index 7a7ed890ca..40c7efc62e 100644 --- a/pylib/cqlshlib/test/test_cqlsh_output.py +++ b/pylib/cqlshlib/test/test_cqlsh_output.py @@ -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, diff --git a/pylib/cqlshlib/test/test_keyspace_init.cql b/pylib/cqlshlib/test/test_keyspace_init.cql index 542721aa67..2433ca07c3 100644 --- a/pylib/cqlshlib/test/test_keyspace_init.cql +++ b/pylib/cqlshlib/test/test_keyspace_init.cql @@ -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,