...
Independent components can be exercised by instantiating them independently in a test.
Unit tests for SQL functionality can be exercised via the SQL logic test framework (see pkg/sql/logictest and
dev testlogic
)Other unit tests that needs a functional SQL or KV layer can use TestServer and TestCluster.
Conversely, avoid using TestServer/TestCluster in unit tests that do not need a full SQL/KV layer. This will make the test run faster.
Integration testing
Integration tests are valuable to exercise a product journey as experienced by an end-user.
...
To exercise user-facing automatable functionality, using standard SQL client drivers, we use the roachtest framework.
Often in combination with the
workload
utility.Also see Large scale testing.
To exercise user-facing interactive functionality, we have two test approaches:
To exercise interactions in a text terminal, we use the TCL interactive test suite (
pkg/cli/interactive_tests
)To exercise interactions via a web browser, we use a standard javascript interactive test package (somewhere in pkg/ui)
To exercise non-standard SQL drivers and certain system libraries, we use:
The acceptance test framework (
pkg/acceptance
), which imports a Docker image containing many non-standard libraries and client drivers.The Examples-ORMs test suite in CI. This imports and runs the tests from https://github.com/cockroachdb/examples-orms