Cassandra Distributed Tests
Python Shell
Latest commit f60755c Sep 23, 2016 @ptnapoleon ptnapoleon committed on GitHub Stop ignoring cdc error on upgrade (#1341)
Permalink
Failed to load latest commit information.
bin tools reorg and paging dedupe (#1261) Aug 26, 2016
byteman Added tests for pre-join 2i callback Sep 20, 2016
cassandra-thrift Restore thrift interface for slice test Aug 22, 2014
conf skip replace_address_test tests on small instances Aug 15, 2016
cqlsh_tests Basic security tests for cqlsh copy, CASSANDRA-12642 Sep 21, 2016
doxygen Make doxygen html look nicer Jul 29, 2015
lib Add jolokia license to lib/ May 11, 2015
meta_tests Pep8 cleanup of assertion_test.py Aug 29, 2016
plugins add plugin & runner for global configuration Feb 22, 2016
repair_tests version-gate capturing new log portion Sep 22, 2016
thrift_bindings bulk isort Mar 23, 2016
tools Added tests for pre-join 2i callback Sep 20, 2016
upgrade_tests Stop ignoring cdc error on upgrade (#1341) Sep 23, 2016
.gitignore Add pycharm files to .gitignore Jul 14, 2016
.isort.cfg tools reorg and paging dedupe (#1261) Aug 26, 2016
.travis.yml Adds assert_stderr_clean for ignoring safe errors on OS X(#1248) Aug 26, 2016
CONTRIBUTING.md Add note on version comparisons to contributing Sep 16, 2016
INSTALL.md Update INSTALL.md for most recent method of installing CQL Aug 3, 2016
LICENSE Add Apache 2.0 License file Aug 10, 2015
README.md tools reorg and paging dedupe (#1261) Aug 26, 2016
auth_test.py Expect LooseVersion from ccm version() calls (#1318) Sep 16, 2016
batch_test.py Read with a higher CL to make sure repair happens after logged batch … Sep 19, 2016
bootstrap_test.py Added tests for pre-join 2i callback Sep 20, 2016
cdc_test.py Remove 12537 annotation Aug 31, 2016
cfid_test.py bulk isort Mar 23, 2016
commitlog_test.py Expect LooseVersion from ccm version() calls (#1318) Sep 16, 2016
compaction_test.py Expect LooseVersion from ccm version() calls (#1318) Sep 16, 2016
compression_test.py tools reorg and paging dedupe (#1261) Aug 26, 2016
concurrent_schema_changes_test.py remove unnecessary init methods (#1294) Sep 14, 2016
configuration_test.py tools reorg and paging dedupe (#1261) Aug 26, 2016
consistency_test.py CASSANDRA-12092: fixed nits Aug 31, 2016
consistent_bootstrap_test.py tools reorg and paging dedupe (#1261) Aug 26, 2016
counter_tests.py tools reorg and paging dedupe (#1261) Aug 26, 2016
cql_prepared_test.py tools reorg and paging dedupe (#1261) Aug 26, 2016
cql_tests.py Adjust tests for new LWT behaviour in CASSANDRA-12060 Sep 20, 2016
cql_tracing_test.py Expect LooseVersion from ccm version() calls (#1318) Sep 16, 2016
delete_insert_test.py remove unnecessary init methods (#1294) Sep 14, 2016
deletion_test.py Remove remaining stale annotations Aug 31, 2016
disk_balance_test.py tools reorg and paging dedupe (#1261) Aug 26, 2016
dtest.py deps for pcmanus/ccm#554 (#1338) Sep 22, 2016
env.txt update call sites to use new ccm subprocess API (#1147) Aug 4, 2016
findlibjemalloc.sh Improve startup time by prelocating libjemalloc Jun 23, 2016
global_row_key_cache_test.py update known_failure annotations Aug 15, 2016
hintedhandoff_test.py tools reorg and paging dedupe (#1261) Aug 26, 2016
internode_ssl_test.py remove unnecessary init methods (#1294) Sep 14, 2016
jmx_auth_test.py Expect LooseVersion from ccm version() calls (#1318) Sep 16, 2016
jmx_test.py tools reorg and paging dedupe (#1261) Aug 26, 2016
json_test.py Expect LooseVersion from ccm version() calls (#1318) Sep 16, 2016
json_tools_test.py Fix C-12665 Sep 19, 2016
largecolumn_test.py Remove remaining stale annotations Aug 31, 2016
license.txt permissions May 30, 2014
linter_check.sh Adds assert_stderr_clean for ignoring safe errors on OS X(#1248) Aug 26, 2016
materialized_views_test.py Add simple test to build MV with wide partition Sep 21, 2016
metadata_tests.py remove unnecessary init methods (#1294) Sep 14, 2016
mixed_version_test.py Expect LooseVersion from ccm version() calls (#1318) Sep 16, 2016
multidc_putget_test.py tools reorg and paging dedupe (#1261) Aug 26, 2016
native_transport_ssl_test.py tools reorg and paging dedupe (#1261) Aug 26, 2016
nodetool_test.py tools reorg and paging dedupe (#1261) Aug 26, 2016
offline_tools_test.py add known_failure annotations Sep 6, 2016
paging_test.py add known_failure annotations Sep 19, 2016
paxos_tests.py tools reorg and paging dedupe (#1261) Aug 26, 2016
pending_range_test.py tools reorg and paging dedupe (#1261) Aug 26, 2016
prepared_statements_test.py bulk isort Mar 23, 2016
pushed_notifications_test.py More flexible expectations for 2.1 nodes in pushed_notifications_test ( Sep 22, 2016
putget_test.py remove unnecessary init methods (#1294) Sep 14, 2016
range_ghost_test.py tools reorg and paging dedupe (#1261) Aug 26, 2016
read_failures_test.py remove unnecessary init methods (#1294) Sep 14, 2016
read_repair_test.py tools reorg and paging dedupe (#1261) Aug 26, 2016
rebuild_test.py Added tests for pre-join 2i callback Sep 20, 2016
replace_address_test.py Added tests for pre-join 2i callback Sep 20, 2016
replication_test.py tools reorg and paging dedupe (#1261) Aug 26, 2016
requirements.txt deps for pcmanus/ccm#554 (#1338) Sep 22, 2016
run_dtests.py Dtest runner tweaks (#1271) Aug 26, 2016
schema_metadata_test.py tools reorg and paging dedupe (#1261) Aug 26, 2016
schema_test.py tools reorg and paging dedupe (#1261) Aug 26, 2016
scrub_test.py Remove 11446 annotation Aug 31, 2016
secondary_indexes_test.py Added tests for pre-join 2i callback Sep 20, 2016
snapshot_test.py remove unnecessary init methods (#1294) Sep 14, 2016
snitch_test.py Regex error message in snitch_test after typo fix in C* Sep 16, 2016
sslnodetonode_test.py move sslkeytool into tools/ and tweak name (#1295) Sep 1, 2016
sstable_generation_loading_test.py remove unnecessary init methods (#1294) Sep 14, 2016
sstablesplit_test.py remove unnecessary init methods (#1294) Sep 14, 2016
sstableutil_test.py remove unnecessary init methods (#1294) Sep 14, 2016
stress_tool_test.py tools reorg and paging dedupe (#1261) Aug 26, 2016
super_column_cache_test.py remove unnecessary init methods (#1294) Sep 14, 2016
super_counter_test.py remove unnecessary init methods (#1294) Sep 14, 2016
thrift_hsha_test.py remove unnecessary init methods (#1294) Sep 14, 2016
thrift_tests.py Version gate tests that dont run on 3.9 (#1312) Sep 13, 2016
token_generator_test.py tools reorg and paging dedupe (#1261) Aug 26, 2016
topology_test.py skip hanging test concurrent_decommission_not_allowed_test Sep 2, 2016
ttl_test.py tools reorg and paging dedupe (#1261) Aug 26, 2016
udtencoding_test.py tools reorg and paging dedupe (#1261) Aug 26, 2016
upgrade_crc_check_chance_test.py remove unnecessary init methods (#1294) Sep 14, 2016
upgrade_internal_auth_test.py remove unnecessary init methods (#1294) Sep 14, 2016
upgrade_supercolumns_test.py Expect LooseVersion from ccm version() calls (#1318) Sep 16, 2016
user_functions_test.py Expect LooseVersion from ccm version() calls (#1318) Sep 16, 2016
user_types_test.py Remove 12639 annotation Sep 14, 2016
wide_rows_test.py remove unnecessary init methods (#1294) Sep 14, 2016
write_failures_test.py Expect LooseVersion from ccm version() calls (#1318) Sep 16, 2016

README.md

Cassandra Distributed Tests

Tests for Apache Cassandra clusters.

Prerequisites

An up to date copy of ccm should be installed for starting and stopping Cassandra. The tests are run using nosetests. These tests require the datastax python driver. A few tests still require the deprecated python CQL over thrift driver.

Usage

The tests are run by nosetests. The only thing the framework needs to know is the location of the (compiled) sources for Cassandra. There are two options:

Use existing sources:

CASSANDRA_DIR=~/path/to/cassandra nosetests

Use ccm ability to download/compile released sources from archives.apache.org:

CASSANDRA_VERSION=1.0.0 nosetests

A convenient option if tests are regularly run against the same existing directory is to set a default_dir in ~/.cassandra-dtest. Create the file and set it to something like:

[main]
default_dir=~/path/to/cassandra

The tests will use this directory by default, avoiding the need for any environment variable (that still will have precedence if given though).

Existing tests are probably the best place to start to look at how to write tests.

Each test spawns a new fresh cluster and tears it down after the test, unless REUSE_CLUSTER is set to true. Then some tests will share cassandra instances. If a test fails, the logs for the node are saved in a logs/<timestamp> directory for analysis (it's not perfect but has been good enough so far, I'm open to better suggestions).

To run the upgrade tests, you have must both JDK7 and JDK8 installed. Paths to these installations should be defined in the environment variables JAVA7_HOME and JAVA8_HOME, respectively.

Installation Instructions

See more detailed instructions in the included INSTALL file.

Writing Tests

  • Most of the time when you start a cluster with cluster.start(), you'll want to pass in wait_for_binary_proto=True so the call blocks until the cluster is ready to accept CQL connections. We tried setting this to True by default once, but the problems caused there (e.g. when it waited the full timeout time on a node that was deliberately down) were more unpleasant and more difficult to debug than the problems caused by having it False by default.
  • If you're using JMX via the tools.jmxutils module, make sure to call remove_perf_disable_shared_mem on the node or nodes you want to query with JMX before starting the nodes. remove_perf_disable_shared_mem disables a JVM option that's incompatible with JMX (see this JMX ticket). It works by performing a string replacement in the node's Cassandra startup script, so changes will only propagate to the node at startup time.

If you'd like to know what to expect during a code review, please see the included CONTRIBUTING file.