Cassandra Distributed Tests
Python Shell
Latest commit a4814c7 Aug 26, 2016 @c-kodman c-kodman committed with ptnapoleon Adds assert_stderr_clean for ignoring safe errors on OS X(#1248)
ebases

* allows for meta_tests/assertion.py to have longer than 200 character strings and corrected import statement in scrub_test.py
Permalink
Failed to load latest commit information.
bin
byteman
cassandra-thrift Restore thrift interface for slice test Aug 22, 2014
conf
cqlsh_tests tools reorg and paging dedupe (#1261) Aug 26, 2016
doxygen
lib
meta_tests Adds assert_stderr_clean for ignoring safe errors on OS X(#1248) Aug 26, 2016
plugins
repair_tests tools reorg and paging dedupe (#1261) Aug 26, 2016
thrift_bindings
tools
upgrade_tests
.gitignore Add pycharm files to .gitignore Jul 14, 2016
.isort.cfg tools reorg and paging dedupe (#1261) Aug 26, 2016
.travis.yml
CONTRIBUTING.md tools reorg and paging dedupe (#1261) Aug 26, 2016
INSTALL.md
LICENSE
README.md tools reorg and paging dedupe (#1261) Aug 26, 2016
auth_test.py
batch_test.py
bootstrap_test.py
cdc_test.py
cfid_test.py
commitlog_test.py
compaction_test.py
compression_test.py
concurrent_schema_changes_test.py
configuration_test.py
consistency_test.py
consistent_bootstrap_test.py
counter_tests.py
cql_prepared_test.py
cql_tests.py
cql_tracing_test.py
delete_insert_test.py
deletion_test.py
disk_balance_test.py
dtest.py tools reorg and paging dedupe (#1261) Aug 26, 2016
env.txt update call sites to use new ccm subprocess API (#1147) Aug 4, 2016
findlibjemalloc.sh
global_row_key_cache_test.py
hintedhandoff_test.py
internode_ssl_test.py
jmx_auth_test.py
jmx_test.py
json_test.py
json_tools_test.py
largecolumn_test.py
license.txt
linter_check.sh
materialized_views_test.py
metadata_tests.py tools reorg and paging dedupe (#1261) Aug 26, 2016
mixed_version_test.py
multidc_putget_test.py tools reorg and paging dedupe (#1261) Aug 26, 2016
native_transport_ssl_test.py
nodetool_test.py
offline_tools_test.py
paging_test.py
paxos_tests.py
pending_range_test.py
prepared_statements_test.py
pushed_notifications_test.py
putget_test.py tools reorg and paging dedupe (#1261) Aug 26, 2016
range_ghost_test.py
read_failures_test.py
read_repair_test.py
rebuild_test.py
replace_address_test.py
replication_test.py
requirements.txt
run_dtests.py
schema_metadata_test.py
schema_test.py
scrub_test.py
secondary_indexes_test.py
snapshot_test.py
snitch_test.py
sslkeytool.py
sslnodetonode_test.py tools reorg and paging dedupe (#1261) Aug 26, 2016
sstable_generation_loading_test.py
sstablesplit_test.py
sstableutil_test.py tools reorg and paging dedupe (#1261) Aug 26, 2016
stress_tool_test.py
super_column_cache_test.py
super_counter_test.py bulk isort Mar 23, 2016
thrift_hsha_test.py
thrift_tests.py tools reorg and paging dedupe (#1261) Aug 26, 2016
token_generator_test.py
topology_test.py
ttl_test.py
udtencoding_test.py
upgrade_crc_check_chance_test.py
upgrade_internal_auth_test.py
upgrade_supercolumns_test.py
user_functions_test.py
user_types_test.py tools reorg and paging dedupe (#1261) Aug 26, 2016
wide_rows_test.py tools reorg and paging dedupe (#1261) Aug 26, 2016
write_failures_test.py

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.