Test
We run our tests using Go’s testing package. For convenience, we bundled test configuration and logging into makefile commands to simplify the process.
Test Categories
Section titled “Test Categories”The Valkey GLIDE Go wrapper has three main categories of tests:
- Unit Tests: Tests that verify individual components in isolation
- Example Tests: Runnable examples that serve as documentation and basic functionality tests
- Integration Tests: Tests that verify the integration with Valkey/Redis servers
- Standard Integration Tests: Tests basic functionality against Valkey/Redis servers
- Module Tests: Tests specific Valkey/Redis modules functionality
- PubSub Tests: Tests PubSub functionality
- Long Timeout Tests: Runs tests with timeouts that may take longer than normal tests
To run unit tests, use:
make unit-testTo run all examples:
make example-testTo run standard integration tests (excluding module tests):
make integ-testTo run module-specific tests:
make modules-testTo run pubsub tests:
make pubsub-testTo run these tests:
make long-timeout-testRunning Specific Tests
Section titled “Running Specific Tests”For all of the above tests, we can specify individual tests, or tests matching a pattern, using the test-filter=<regex> parameter to specify a filter pattern to use.
# Run with a specific prefix (ex. run all tests that start with TestSet)make integ-test test-filter=TestSet
# Run with a specifc pattern (ex. run all tests that start with TestSet or TestGet)make integ-test test-filter="Test\(Set\|Get\)"Additional Parameters
Section titled “Additional Parameters”Integration and modules tests accept standalone-endpoints, cluster-endpoints and tls parameters to run tests on existing servers.
By default, those test suites start standalone and cluster servers without TLS and stop them at the end.
make integ-test standalone-endpoints=localhost:6379 cluster-endpoints=localhost:7000 tls=trueTest Reports and Results
Section titled “Test Reports and Results”Alongside terminal output, test reports are generated in reports folder.
An example of what the report looks like when an error occurs:
