Running CTDB tests

From SambaWiki
Revision as of 00:26, 5 March 2020 by MartinSchwenke (talk | contribs) (More details, reorganise a bit, use only level >=2 headings as per wiki documentation)


CTDB has a standalone test suite, split into several collections:

Tests that do not require CTDB daemons. Useful for testing particular subsets of the CTDB code.
Tests that require a cluster of CTDB daemons. These can be run as an unprivileged user against local CTDB daemons on a test or development machine. Most will also run against a real (or virtual) cluster of nodes - those that do not will be skipped. Each test case will start the CTDB daemons beforehand and stop them afterwards.
These tests require a real (or virtual) cluster of nodes, plus an additional test node. These tests can not be run on a single test or development machine (without virtualising the cluster nodes). Each test case will start the CTDB daemons beforehand and stop them afterwards.

Examples below assume they are run from within the ctdb/ subdirectory.

Running tests

To run all the UNIT tests:

$ ./tests/ UNIT/

See ctdb/tests/README for more detailed information on how to run tests.

Starting a CTDB local daemons test environment

./tests/ can be used to start a local daemons test environment. This is the same environment that is used in the INTEGRATION and CLUSTER test collections.,

$ ./tests/ foo setup
$ ./tests/ foo start all
$ ./tests/ foo onnode 0 ctdb status
[wait a while]
$ ./tests/ foo print-log all | less

The first argument (foo in the above example) is a daemon configuration directory.

See ./tests/ -h for usage information.

Individual commands can also have their usage shown (e.g. ./tests/ foo setup -h). Note that a daemon configuration directory must be given for this to work.