Skip to content

Instantly share code, notes, and snippets.

@mambocab
Created March 11, 2015 15:20
Show Gist options
  • Save mambocab/00fe2477be5dd87dad94 to your computer and use it in GitHub Desktop.
Save mambocab/00fe2477be5dd87dad94 to your computer and use it in GitHub Desktop.
notes on getting cqlshlib tests running

I got the tests to run with this commit:

https://github.com/mambocab/cassandra/commit/a6562212d56a1054b71883ff7e212fb9c90f7243

I had to manually use ccm to spin up a cluster to test against. As part of getting this running for CI, we might start using ccmlib.

4 of the tests fail:

https://gist.githubusercontent.com/anonymous/046488dcd25f4cd056ee/raw/458be8ee562372d6ba52a32626fce24506b9760d/testout.txt.........................................................................F..F..F.......F.................
======================================================================
FAIL: test_count_output (cqlshlib.test.test_cqlsh_output.TestCqlshOutput)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/mambocab/cstar_src/cassandra/pylib/cqlshlib/test/test_cqlsh_output.py", line 199, in test_count_output
    ), cqlver=cqlsh.DEFAULT_CQLVER)
  File "/home/mambocab/cstar_src/cassandra/pylib/cqlshlib/test/test_cqlsh_output.py", line 74, in assertCqlverQueriesGiveColoredOutput
    self.assertQueriesGiveColoredOutput(queries_and_expected_outputs, cqlver=ver, **kwargs)
  File "/home/mambocab/cstar_src/cassandra/pylib/cqlshlib/test/test_cqlsh_output.py", line 89, in assertQueriesGiveColoredOutput
    self.assertEqual(outputline.plain().rstrip(), plain)
AssertionError: '    13' != '    10'
-------------------- >> begin captured logging << --------------------
test_cqlsh: INFO: Spawning '/home/mambocab/cstar_src/cassandra/bin/cqlsh' subprocess with args: ('127.0.0.1', '9042', '--cqlversion', '3.2.0', '--keyspace', 'CqlshTests_tmno4U') and env: {'PYTHONPATH': '', 'TERM': 'xterm', 'CQLSH_NO_BUNDLED': ''}
test_cqlsh: DEBUG: read 'Connected to \x1b[0;1;34mcqlshlib-test\x1b[0m at 127.0.0.1:9042.' from subproc
test_cqlsh: DEBUG: read '\r\n[cqlsh 5.0.1 | Cassandra 3.0.0-SNAPSHOT | CQL spec 3.2.0 | Native protocol v3]\r\nUse HELP for help.\r\ncqlsh:CqlshTests_tmno4U> ' from subproc
test_cqlsh: DEBUG: Testing 'select count(*) from has_all_types;'
test_cqlsh: DEBUG: read 's' from subproc
test_cqlsh: DEBUG: read 'elect count(' from subproc
test_cqlsh: DEBUG: read '*) from ha' from subproc
test_cqlsh: DEBUG: read 's_all_t' from subproc
test_cqlsh: DEBUG: read 'ypes;\r\n' from subproc
test_cqlsh: DEBUG: read '\r\n' from subproc
test_cqlsh: DEBUG: read ' \x1b[0;1;35mcount\x1b[0m' from subproc
test_cqlsh: DEBUG: read '\r\n-------\r\n     \x1b[0;1;32m5\x1b[0m\r\n\r\n(1 rows)\r\n' from subproc
test_cqlsh: DEBUG: read 'cqlsh:CqlshTests_tmno4U> ' from subproc
test_cqlsh: DEBUG: Testing 'select COUNT(*) FROM empty_table;'
test_cqlsh: DEBUG: read 'sel' from subproc
test_cqlsh: DEBUG: read 'ect COUNT(*) FROM e' from subproc
test_cqlsh: DEBUG: read 'mpty_table;\r\n' from subproc
test_cqlsh: DEBUG: read '\r\n' from subproc
test_cqlsh: DEBUG: read ' \x1b[0;1;35mcount\x1b[0m\r\n-------\r\n     \x1b[0;1;32m0\x1b[0m\r\n\r\n(1 rows)\r\n' from subproc
test_cqlsh: DEBUG: read 'cqlsh:CqlshTests_tmno4U> ' from subproc
test_cqlsh: DEBUG: Testing 'select COUNT(*) FROM empty_composite_table;'
test_cqlsh: DEBUG: read 'sele' from subproc
test_cqlsh: DEBUG: read 'ct COUNT(*) ' from subproc
test_cqlsh: DEBUG: read 'FROM empt' from subproc
test_cqlsh: DEBUG: read 'y_composite_' from subproc
test_cqlsh: DEBUG: read 'table;\r\n' from subproc
test_cqlsh: DEBUG: read '\r\n' from subproc
test_cqlsh: DEBUG: read ' \x1b[0;1;35mcount\x1b[0m\r\n-------\r\n     \x1b[0;1;32m0\x1b[0m\r\n\r\n(1 rows)\r\n' from subproc
test_cqlsh: DEBUG: read 'cqlsh:CqlshTests_tmno4U> ' from subproc
test_cqlsh: DEBUG: Testing 'select COUNT(*) FROM twenty_rows_table limit 10;'
test_cqlsh: DEBUG: read 'sele' from subproc
test_cqlsh: DEBUG: read 'ct COUNT(*) ' from subproc
test_cqlsh: DEBUG: read 'FROM twenty' from subproc
test_cqlsh: DEBUG: read '_rows_ta' from subproc
test_cqlsh: DEBUG: read 'ble limit 10' from subproc
test_cqlsh: DEBUG: read ';\r\n' from subproc
test_cqlsh: DEBUG: read '\r\n' from subproc
test_cqlsh: DEBUG: read ' \x1b[0;1;35mcount\x1b[0m\r\n-------\r\n    \x1b[0;1;32m13\x1b[0m\r\n\r\n(1 rows)\r\n' from subproc
test_cqlsh: DEBUG: read 'cqlsh:CqlshTests_tmno4U> ' from subproc
test_cqlsh: INFO: Closing '/home/mambocab/cstar_src/cassandra/bin/cqlsh' subprocess.
test_cqlsh: DEBUG: Waiting for exit
--------------------- >> end captured logging << ---------------------

======================================================================
FAIL: test_describe_columnfamily_output (cqlshlib.test.test_cqlsh_output.TestCqlshOutput)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/mambocab/cstar_src/cassandra/pylib/cqlshlib/test/test_cqlsh_output.py", line 633, in test_describe_columnfamily_output
    self.assertEqual(output, table_desc3)
AssertionError: '\nCREATE TABLE "CqlshTests_tmno4U".has_all_types (\n    num int PRIMARY KEY,\n    asciicol ascii,\n    bigintcol bigint,\n    blobcol blob,\n    booleancol boolean,\n    decimalcol decimal,\n    doublecol double,\n    floatcol float,\n    intcol int,\n    textcol text,\n    timestampcol timestamp,\n    uuidcol uuid,\n    varcharcol text,\n    varintcol varint\n) WITH bloom_filter_fp_chance = 0.01\n    AND caching = \'{"keys":"ALL", "rows_per_partition":"NONE"}\'\n    AND comment = \'\'\n    AND compaction = {\'min_threshold\': \'4\', \'class\': \'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy\', \'max_threshold\': \'32\'}\n    AND compression = {\'sstable_compression\': \'org.apache.cassandra.io.compress.LZ4Compressor\'}\n    AND dclocal_read_repair_chance = 0.1\n    AND default_time_to_live = 0\n    AND gc_grace_seconds = 864000\n    AND max_index_interval = 2048\n    AND memtable_flush_period_in_ms = 0\n    AND min_index_interval = 128\n    AND read_repair_chance = 0.0\n    AND speculative_retry = \'99.0PERCENTILE\';\n\n' != '\nCREATE TABLE "CqlshTests_tmno4U".has_all_types (\n    num int PRIMARY KEY,\n    asciicol ascii,\n    bigintcol bigint,\n    blobcol blob,\n    booleancol boolean,\n    datecol date,\n    decimalcol decimal,\n    doublecol double,\n    floatcol float,\n    intcol int,\n    textcol text,\n    timecol time,\n    timestampcol timestamp,\n    uuidcol uuid,\n    varcharcol text,\n    varintcol varint\n) WITH bloom_filter_fp_chance = 0.01\n    AND caching = \'{"keys":"ALL", "rows_per_partition":"NONE"}\'\n    AND comment = \'\'\n    AND compaction = {\'min_threshold\': \'4\', \'class\': \'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy\', \'max_threshold\': \'32\'}\n    AND compression = {\'sstable_compression\': \'org.apache.cassandra.io.compress.LZ4Compressor\'}\n    AND dclocal_read_repair_chance = 0.1\n    AND default_time_to_live = 0\n    AND gc_grace_seconds = 864000\n    AND max_index_interval = 2048\n    AND memtable_flush_period_in_ms = 0\n    AND min_index_interval = 128\n    AND read_repair_chance = 0.0\n    AND speculative_retry = \'99.0PERCENTILE\';\n\n'
-------------------- >> begin captured logging << --------------------
test_cqlsh: INFO: Spawning '/home/mambocab/cstar_src/cassandra/bin/cqlsh' subprocess with args: ('127.0.0.1', '9042', '--cqlversion', '3.2.0', '--keyspace', 'CqlshTests_tmno4U') and env: {'PYTHONPATH': '', 'TERM': 'xterm', 'CQLSH_NO_BUNDLED': ''}
test_cqlsh: DEBUG: read 'Connected to \x1b[0;1;34mcqlshlib-test\x1b[0m at 127.0.0.1:9042.' from subproc
test_cqlsh: DEBUG: read '\r\n[cqlsh 5.0.1 | Cassandra 3.0.0-SNAPSHOT | CQL spec 3.2.0 | Native protocol v3]\r\nUse HELP for help.\r\ncqlsh:CqlshTests_tmno4U> ' from subproc
test_cqlsh: DEBUG: read 'descr' from subproc
test_cqlsh: DEBUG: read 'ibe table has' from subproc
test_cqlsh: DEBUG: read '_all_types;' from subproc
test_cqlsh: DEBUG: read '\r\n' from subproc
test_cqlsh: DEBUG: read '\r\n' from subproc
test_cqlsh: DEBUG: read 'CREATE TABLE "CqlshTests_tmno4U".has_all_types (' from subproc
test_cqlsh: DEBUG: read '\r\n    num int PRIMARY KEY,\r\n    asciicol ascii,\r\n    bigintcol bigint,\r\n    blobcol blob,\r\n    booleancol boolean,\r\n    decimalcol decimal,\r\n    doublecol double,\r\n    floatcol float,\r\n    intcol int,\r\n    textcol text,\r\n    timestampcol timestamp,\r\n    uuidcol uuid,\r\n    varcharcol text,\r\n    varintcol varint\r\n) WITH bloom_filter_fp_chance = 0.01\r\n    AND caching = \'{"keys":"ALL", "rows_per_partition":"NONE"}\'\r\n    AND comment = \'\'\r\n    AND compaction = {\'min_threshold\': \'4\', \'class\': \'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy\', \'max_threshold\': \'32\'}\r\n    AND compression = {\'sstable_compression\': \'org.apache.cassandra.io.compress.LZ4Compressor\'}\r\n    AND dclocal_read_repair_chance = 0.1\r\n' from subproc
test_cqlsh: DEBUG: read "    AND default_time_to_live = 0\r\n    AND gc_grace_seconds = 864000\r\n    AND max_index_interval = 2048\r\n    AND memtable_flush_period_in_ms = 0\r\n    AND min_index_interval = 128\r\n    AND read_repair_chance = 0.0\r\n    AND speculative_retry = '99.0PERCENTILE';\r\n\r\n" from subproc
test_cqlsh: DEBUG: read 'cqlsh:CqlshTests_tmno4U> ' from subproc
test_cqlsh: INFO: Closing '/home/mambocab/cstar_src/cassandra/bin/cqlsh' subprocess.
test_cqlsh: DEBUG: Waiting for exit
--------------------- >> end captured logging << ---------------------

======================================================================
FAIL: test_empty_cf_output (cqlshlib.test.test_cqlsh_output.TestCqlshOutput)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/mambocab/cstar_src/cassandra/pylib/cqlshlib/test/test_cqlsh_output.py", line 285, in test_empty_cf_output
    ), cqlver=cqlsh.DEFAULT_CQLVER)
  File "/home/mambocab/cstar_src/cassandra/pylib/cqlshlib/test/test_cqlsh_output.py", line 89, in assertQueriesGiveColoredOutput
    self.assertEqual(outputline.plain().rstrip(), plain)
AssertionError: ' num | asciicol | bigintcol | blobcol | booleancol | decimalcol | doublecol | floatcol | intcol | textcol | timestampcol | uuidcol | varcharcol | varintcol' != ' num | asciicol | bigintcol | blobcol | booleancol | datecol | decimalcol | doublecol | floatcol | intcol | textcol | timecol | timestampcol | uuidcol | varcharcol | varintcol'
-------------------- >> begin captured logging << --------------------
test_cqlsh: INFO: Spawning '/home/mambocab/cstar_src/cassandra/bin/cqlsh' subprocess with args: ('127.0.0.1', '9042', '--cqlversion', '3.2.0', '--keyspace', 'CqlshTests_tmno4U') and env: {'PYTHONPATH': '', 'TERM': 'xterm', 'CQLSH_NO_BUNDLED': ''}
test_cqlsh: DEBUG: read 'Connected to \x1b[0;1;34mcqlshlib-test\x1b[0m at 127.0.0.1:9042.\r\n[cqlsh 5.0.1 | Cassandra 3.0.0-SNAPSHOT | CQL spec 3.2.0 | Native protocol v3]\r\nUse HELP for help.\r\ncqlsh:CqlshTests_tmno4U> ' from subproc
test_cqlsh: DEBUG: Testing 'select * from empty_table;'
test_cqlsh: DEBUG: read 'select * from empty_table;\r\n' from subproc
test_cqlsh: DEBUG: read '\r\n' from subproc
test_cqlsh: DEBUG: read ' \x1b[0;1;31mlonelykey\x1b[0m | \x1b[0;1;35mlonelycol\x1b[0m\r\n-----------+-----------\r\n\r\n(0 rows)\r\n' from subproc
test_cqlsh: DEBUG: read 'cqlsh:CqlshTests_tmno4U> ' from subproc
test_cqlsh: INFO: Closing '/home/mambocab/cstar_src/cassandra/bin/cqlsh' subprocess.
test_cqlsh: DEBUG: Waiting for exit
test_cqlsh: INFO: Spawning '/home/mambocab/cstar_src/cassandra/bin/cqlsh' subprocess with args: ('127.0.0.1', '9042', '--cqlversion', '3.2.0', '--keyspace', 'CqlshTests_tmno4U') and env: {'PYTHONPATH': '', 'TERM': 'xterm', 'CQLSH_NO_BUNDLED': ''}
test_cqlsh: DEBUG: read 'Connected to \x1b[0;1;34mcqlshlib-test\x1b[0m at 127.0.0.1:9042.' from subproc
test_cqlsh: DEBUG: read '\r\n[cqlsh 5.0.1 | Cassandra 3.0.0-SNAPSHOT | CQL spec 3.2.0 | Native protocol v3]\r\nUse HELP for help.\r\ncqlsh:CqlshTests_tmno4U> ' from subproc
test_cqlsh: DEBUG: Testing 'select * from has_all_types where num = 999;'
test_cqlsh: DEBUG: read 'sele' from subproc
test_cqlsh: DEBUG: read 'ct * from h' from subproc
test_cqlsh: DEBUG: read 'as_all_ty' from subproc
test_cqlsh: DEBUG: read 'pes wher' from subproc
test_cqlsh: DEBUG: read 'e num = 9' from subproc
test_cqlsh: DEBUG: read '99;\r\n' from subproc
test_cqlsh: DEBUG: read '\r\n' from subproc
test_cqlsh: DEBUG: read ' \x1b[0;1;31mnum\x1b[0m | \x1b[0;1;35masciicol\x1b[0m | \x1b[0;1;35mbigintcol\x1b[0m | \x1b[0;1;35mblobcol\x1b[0m | \x1b[0;1;35mbooleancol\x1b[0m | \x1b[0;1;35mdecimalcol\x1b[0m | \x1b[0;1;35mdoublecol\x1b[0m | \x1b[0;1;35mfloatcol\x1b[0m | \x1b[0;1;35mintcol\x1b[0m | \x1b[0;1;35mtextcol\x1b[0m | \x1b[0;1;35mtimestampcol\x1b[0m | \x1b[0;1;35muuidcol\x1b[0m | \x1b[0;1;35mvarcharcol\x1b[0m | \x1b[0;1;35mvarintcol\x1b[0m' from subproc
test_cqlsh: DEBUG: read '\r\n-----+----------+-----------+---------+------------+------------+-----------+----------+--------+---------+--------------+---------+------------+-----------\r\n\r\n(0 rows)\r\ncqlsh:CqlshTests_tmno4U> ' from subproc
test_cqlsh: INFO: Closing '/home/mambocab/cstar_src/cassandra/bin/cqlsh' subprocess.
test_cqlsh: DEBUG: Waiting for exit
--------------------- >> end captured logging << ---------------------

======================================================================
FAIL: test_no_prompt_or_colors_output (cqlshlib.test.test_cqlsh_output.TestCqlshOutput)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/mambocab/cstar_src/cassandra/pylib/cqlshlib/test/test_cqlsh_output.py", line 116, in test_no_prompt_or_colors_output
    self.assertEqual(output[1], 'Warning!  Non-ISO 8601 dates detected (< 1-1-1 or > 9999-12-31).  Returning raw days since epoch.');
AssertionError: ' num | asciicol   | bigintcol           | blobcol              | booleancol | decimalcol | doublecol | floatcol | intcol     | textcol                               | timestampcol                        | uuidcol                              | varcharcol    | varintcol' != 'Warning!  Non-ISO 8601 dates detected (< 1-1-1 or > 9999-12-31).  Returning raw days since epoch.'
-------------------- >> begin captured logging << --------------------
test_cqlsh: DEBUG: TERM=''
test_cqlsh: INFO: Spawning '/home/mambocab/cstar_src/cassandra/bin/cqlsh' subprocess with args: ('127.0.0.1', '9042', '--keyspace', 'CqlshTests_tmno4U') and env: {'PYTHONPATH': '', 'TERM': '', 'CQLSH_NO_BUNDLED': ''}
test_cqlsh: INFO: Closing '/home/mambocab/cstar_src/cassandra/bin/cqlsh' subprocess.
test_cqlsh: DEBUG: Waiting for exit
--------------------- >> end captured logging << ---------------------

----------------------------------------------------------------------
Ran 105 tests in 185.948s

FAILED (failures=4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment