You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by mi...@apache.org on 2014/09/04 22:52:10 UTC
[2/6] git commit: Ninja: cqlsh test fixed for 2.1.0
Ninja: cqlsh test fixed for 2.1.0
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/dd4fbbcd
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/dd4fbbcd
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/dd4fbbcd
Branch: refs/heads/cassandra-2.1.0
Commit: dd4fbbcd8cce48d763b4ec93c97b09d80ebd532e
Parents: 37c6b2f
Author: Mikhail Stepura <mi...@apache.org>
Authored: Thu Sep 4 13:31:50 2014 -0700
Committer: Mikhail Stepura <mi...@apache.org>
Committed: Thu Sep 4 13:49:43 2014 -0700
----------------------------------------------------------------------
pylib/cqlshlib/test/test_cqlsh_output.py | 77 +++++--------------------
pylib/cqlshlib/test/test_keyspace_init.cql | 17 ++----
2 files changed, 20 insertions(+), 74 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/dd4fbbcd/pylib/cqlshlib/test/test_cqlsh_output.py
----------------------------------------------------------------------
diff --git a/pylib/cqlshlib/test/test_cqlsh_output.py b/pylib/cqlshlib/test/test_cqlsh_output.py
index 6fb4f41..072dd23 100644
--- a/pylib/cqlshlib/test/test_cqlsh_output.py
+++ b/pylib/cqlshlib/test/test_cqlsh_output.py
@@ -101,25 +101,22 @@ class TestCqlshOutput(BaseTestCase):
self.assertNoHasColors(c.read_to_next_prompt())
def test_no_prompt_or_colors_output(self):
- # CQL queries and number of lines expected in output:
- queries = (('select * from has_all_types limit 1;', 7),
- ('select * from has_value_encoding_errors limit 1;', 8))
for termname in ('', 'dumb', 'vt100', 'xterm'):
cqlshlog.debug('TERM=%r' % termname)
- for cql, lines_expected in queries:
- output, result = testcall_cqlsh(prompt=None, env={'TERM': termname},
- tty=False, input=cql + '\n')
- output = output.splitlines()
- for line in output:
- self.assertNoHasColors(line)
- self.assertNotRegexpMatches(line, r'^cqlsh\S*>')
- self.assertEqual(len(output), lines_expected,
- msg='output: %r' % '\n'.join(output))
- self.assertEqual(output[0], '')
- self.assertNicelyFormattedTableHeader(output[1])
- self.assertNicelyFormattedTableRule(output[2])
- self.assertNicelyFormattedTableData(output[3])
- self.assertEqual(output[4].strip(), '')
+ query = 'select * from has_all_types limit 1;'
+ output, result = testcall_cqlsh(prompt=None, env={'TERM': termname},
+ tty=False, input=query + '\n')
+ output = output.splitlines()
+ 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(output[0], '')
+ self.assertNicelyFormattedTableHeader(output[1])
+ self.assertNicelyFormattedTableRule(output[2])
+ self.assertNicelyFormattedTableData(output[3])
+ self.assertEqual(output[4].strip(), '')
def test_color_output(self):
for termname in ('xterm', 'unknown-garbage'):
@@ -449,13 +446,11 @@ class TestCqlshOutput(BaseTestCase):
G YYYYYYmmYYYYYYYYmmmmY
2 | \x00\x01\x02\x03\x04\x05control chars\x06\x07
G mmmmmmmmmmmmmmmmmmmmmmmmYYYYYYYYYYYYYmmmmmmmm
- 3 | \xfe\xffbyte order mark
- G mmmmmmmmYYYYYYYYYYYYYYY
4 | fake special chars\x00\n
G YYYYYYYYYYYYYYYYYYYYYYYY
- (5 rows)
+ (4 rows)
nnnnnnnn
"""),
), cqlver=cqlsh.DEFAULT_CQLVER)
@@ -525,46 +520,6 @@ class TestCqlshOutput(BaseTestCase):
# explicitly generate an exception on the deserialization of type X..
pass
- def test_colval_decoding_errors(self):
- self.assertCqlverQueriesGiveColoredOutput((
- ("select * from has_value_encoding_errors;", r"""
- pkey | utf8col
- MMMM MMMMMMM
- ------+--------------------
-
- A | '\x00\xff\x00\xff'
- Y RRRRRRRRRRRRRRRRRR
-
-
- (1 rows)
- nnnnnnnn
-
-
- Failed to decode value '\x00\xff\x00\xff' (for column 'utf8col') as text: 'utf8' codec can't decode byte 0xff in position 1: invalid start byte
- RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
- """),
- ), cqlver=cqlsh.DEFAULT_CQLVER)
-
- def test_key_decoding_errors(self):
- self.assertCqlverQueriesGiveColoredOutput((
- ("select * from has_key_encoding_errors;", r"""
- pkey | col
- MMMM MMM
- --------------------+----------
-
- '\x00\xff\x02\x8f' | whatever
- RRRRRRRRRRRRRRRRRR YYYYYYYY
-
-
- (1 rows)
- nnnnnnnn
-
-
- Failed to decode value '\x00\xff\x02\x8f' (for column 'pkey') as text: 'utf8' codec can't decode byte 0xff in position 1: invalid start byte
- RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
- """),
- ), cqlver=cqlsh.DEFAULT_CQLVER)
-
def test_prompt(self):
with testrun_cqlsh(tty=True, keyspace=None, cqlver=cqlsh.DEFAULT_CQLVER) as c:
self.assertEqual(c.output_header.splitlines()[-1], 'cqlsh> ')
@@ -656,6 +611,7 @@ class TestCqlshOutput(BaseTestCase):
AND comment = ''
AND compaction = {'min_threshold': '4', 'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32'}
AND compression = {'sstable_compression': 'org.apache.cassandra.io.compress.LZ4Compressor'}
+ AND dclocal_read_repair_chance = 0.1
AND default_time_to_live = 0
AND gc_grace_seconds = 864000
AND max_index_interval = 2048
@@ -716,7 +672,6 @@ class TestCqlshOutput(BaseTestCase):
self.assertEqual(output[0], '\n')
self.assertEqual(output[-1], '\n')
self.assertNotIn('Keyspace %s' % quote_name(ks), output)
- self.assertIn('has_value_encoding_errors', output)
self.assertIn('undefined_values_table', output)
def test_describe_cluster_output(self):
http://git-wip-us.apache.org/repos/asf/cassandra/blob/dd4fbbcd/pylib/cqlshlib/test/test_keyspace_init.cql
----------------------------------------------------------------------
diff --git a/pylib/cqlshlib/test/test_keyspace_init.cql b/pylib/cqlshlib/test/test_keyspace_init.cql
index 98932bc..7e01b10 100644
--- a/pylib/cqlshlib/test/test_keyspace_init.cql
+++ b/pylib/cqlshlib/test/test_keyspace_init.cql
@@ -52,13 +52,6 @@ VALUES (4, blobAsInt(0x), '', blobAsBigint(0x), 0x, blobAsBoolean(0x), blobAsDec
blobAsVarint(0x));
-CREATE TABLE has_value_encoding_errors (
- pkey ascii PRIMARY KEY,
- utf8col text
-);
-
-INSERT INTO has_value_encoding_errors (pkey, utf8col) VALUES ('A', blobAsText(0x00ff00ff));
-
CREATE TABLE has_key_encoding_errors (
pkey blob PRIMARY KEY,
col text
@@ -138,8 +131,6 @@ INSERT INTO ascii_with_invalid_and_special_chars (k, val) VALUES (0, blobAsAscii
INSERT INTO ascii_with_invalid_and_special_chars (k, val) VALUES (1, blobAsAscii(0x72657475726e0d616e64206e756c6c0021));
-- "\x00\x01\x02\x03\x04\x05control chars\x06\x07"
INSERT INTO ascii_with_invalid_and_special_chars (k, val) VALUES (2, blobAsAscii(0x000102030405636f6e74726f6c2063686172730607));
--- "\xfe\xffbyte order mark"
-INSERT INTO ascii_with_invalid_and_special_chars (k, val) VALUES (3, blobAsAscii(0xfeff62797465206f72646572206d61726b));
-- "fake special chars\\x00\\n"
INSERT INTO ascii_with_invalid_and_special_chars (k, val) VALUES (4, blobAsAscii(0x66616b65207370656369616c2063686172735c7830305c6e));
@@ -212,8 +203,8 @@ CREATE TYPE phone_number (
CREATE TABLE users (
login text PRIMARY KEY,
name text,
- addresses set<address>,
- phone_numbers set<phone_number>
+ addresses set<frozen<address>>,
+ phone_numbers set<frozen<phone_number>>
);
insert into users (login, name, addresses, phone_numbers)
@@ -245,8 +236,8 @@ CREATE TYPE tags (
CREATE TABLE songs (
title text PRIMARY KEY,
band text,
- info band_info_type,
- tags tags
+ info frozen<band_info_type>,
+ tags frozen<tags>
);
insert into songs (title, band, info, tags)