This repository contains a suite of unit and integration tests for the DiceDB project. The tests cover various features and functionalities of the system, ensuring both correctness and performance.
The DiceDB test suite consists of:
- Unit Tests: Validating individual components of the system.
- Integration Tests: Testing the interaction between components.
The suite leverages TCL (Tool Command Language) for testing, and it can be executed locally with minimal setup. The script automates server setup, running tests, and teardown.
Before running the test suite, ensure the following tools are installed on your system:
- Git (for cloning the repository)
- Go (for running the server)
- Air (optional, for hot-reloading the Go server)
- TCL (for running the tests)
To install Go and Git:
# Install Git
sudo apt-get install git
# Install Go
sudo apt install golang-go
# Install air
go install github.com/cosmtrek/air@latest
A patch allows you to modify the dice repository's code without permanently changing the source files in the master branch. It's useful for testing features, fixing bugs, or adjusting configurations temporarily.
head over to the dice-patch
folder and make modifications if required to ignore any commands while running the test suite.
To run the test suite, just execute the binary tcltest
, It will automatically do following steps:
- Clone the dice repository
- It applies patch on the cloned repository to do modifications before running the test suite
- Test suite automatically starts the DiceDB server using
air
command in the background and waits till the serve starts successfully. - It then runs configures and runs the tcl tests available in the
/tcltests/unit
and/tcltests/integration
subdirectories using the following command:
./runtest --host 0.0.0.0 --port 7379 --tags -needs:debug --tags -cluster:skip --singledb --ignore-encoding
Once the test suite has finished running:
- The server will be stopped automatically.
- If the repository was cloned for testing purposes, it will be removed after the tests.
We welcome contributions to the test suite. if you would like to add more test coverage, head over to the redis repository and check the and [integration] subdirectories under the tests folder.
We welcome and encourage contributions to enhance the DiceDB test suite. Whether you're improving existing tests or adding new ones, your efforts help make the project more robust.
If you're looking to expand test coverage or contribute new tests, we recommend checking out the Redis repository for inspiration, particularly in the areas of unit tests and integration tests.
Add your new tests or improve existing ones in the appropriate test directories. Once you’ve completed your changes, push your branch to GitHub and open a pull request against the main repository. Ensure your PR includes a clear description of the changes made.