...

TestServer and TestCluster are two frameworks we built to create Go unit tests for CockroachDB:, for tests that need a functional SQL layer and/or KV layer.

  • TestServer simulates a single CockroachDB node.

  • TestCluster simulates a multi-node CockroachDB cluster. Each node is simulated using one TestServer.

...

For integration tests, consider using roachtest instead. See: the pages Overview of all test frameworks and Roachtest vs TestServer for details.

For other unit tests that do not need a full SQL or KV layer, consider a more narrow unit test that only instantiates the components it cares about. This will make the test run faster.

Here are the main differences between a regular CockroachDB node (e.g. one started via cockroach start) and one simulated via TestServer:

...