This is a comprehensive guide to the automated test suites included in Manticore Search. Testing ensures that new changes are stable, free of bugs, and don't introduce regressions. This document covers the test frameworks used in Manticore Search: UberTest tests (PHP-based), Google Tests (C++ unit tests), and CLT (Command Line Testing) tests.
Manticore Search uses several types of automated tests:
test/test_XXX/ directories, executed via ubertest.phpsrc/gtests/test/clt-tests/ using the CLT frameworkCTest (CMake's testing tool) is used to run UberTest tests and Google Tests locally.
PHP-based functional tests located in test/test_XXX/ directories. These tests verify searchd functionality by comparing actual output against reference results. Executed via ubertest.php and run through CTest.
C++ unit tests located in src/gtests/. These tests verify core C++ functionality, including tokenizers, JSON processing, filters, and internal data structures. Run via CTest.
Located in test/clt-tests/ and organized by functionality. Key categories include:
See test/clt-tests/ directory for complete list of test categories.
Recommended for most contributors: Instead of setting up a local test environment, you can use GitHub Actions to run tests automatically.
GitHub Actions will run the full test suite across multiple platforms (Linux, macOS, Windows) and report results directly in your PR.
This approach is recommended because:
For contributors who need to run tests locally or develop new tests.
mysql, curl, xml, mbstring# Install build dependencies
sudo apt-get update
sudo apt-get install -y libmysqlclient-dev php php-mysql php-curl php-xml php-mbstring mysql-server docker.io jq
# Configure MySQL for tests
sudo mysql -e "CREATE DATABASE IF NOT EXISTS test;"
sudo mysql -e "CREATE USER IF NOT EXISTS 'test'@'localhost';"
sudo mysql -e "GRANT ALL PRIVILEGES ON test.* TO 'test'@'localhost';"
sudo mysql -e "FLUSH PRIVILEGES;"
# Install Homebrew if not already installed
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install dependencies
brew install mysql php jq
brew install --cask docker
# Start MySQL
brew services start mysql
# Configure MySQL for tests
mysql -u root -e "CREATE DATABASE IF NOT EXISTS test;"
mysql -u root -e "CREATE USER IF NOT EXISTS 'test'@'localhost';"
mysql -u root -e "GRANT ALL PRIVILEGES ON test.* TO 'test'@'localhost';"
mysql -u root -e "FLUSH PRIVILEGES;"
For Windows, we strongly recommend using WSL2 (Windows Subsystem for Linux) and following the Linux instructions above, or using Docker Desktop for Windows.
Alternatively, use GitHub Actions for testing (see Testing via GitHub Actions).
UberTest tests are PHP-based functional tests located in test/test_XXX/ directories.
# Run all tests
cd test
php ubertest.php t
# Run specific test
php ubertest.php t test_101
# Run multiple tests by number or range
php ubertest.php t 31 37 41 53-64
# With MySQL credentials
php ubertest.php t --user test --password test
For more options, run php ubertest.php without arguments to see full usage.
CLT (Command Line Testing) is the modern testing framework for Manticore Search. CLT tests are primarily run via GitHub Actions, but can also be run locally using the CLT Docker action.
The easiest way to run CLT tests is through GitHub Actions:
CLT tests are organized into test suites defined in .github/workflows/clt_tests.yml.
CLT tests run inside Docker containers to ensure consistent environment. There are two main scenarios for local testing:
For quick testing of existing functionality using public Docker images:
# Pull the test-kit image (contains latest development build from the main/master branch)
docker pull ghcr.io/manticoresoftware/manticoresearch:test-kit-latest
# Start Manticore container
docker run -d --name manticore-test \
-p 9306:9306 -p 9308:9308 \
ghcr.io/manticoresoftware/manticoresearch:test-kit-latest
# Test connection
mysql -h127.0.0.1 -P9306 -e "SHOW TABLES;"
Running CLT tests against public images:
# Clone CLT repository
git clone https://github.com/manticoresoftware/clt.git
cd clt
# Run a specific test
./clt test -t /path/to/manticoresearch/test/clt-tests/buddy-plugins/test-fuzzy-search.rec \
-d ghcr.io/manticoresoftware/manticoresearch:test-kit-latest
# Record a new test interactively
./clt record ghcr.io/manticoresoftware/manticoresearch:test-kit-latest
See CLT documentation for more details on test recording and replay.
When you've made changes to Manticore Search code and want to test them with CLT tests before creating a PR, use the build-local-test-kit.sh script.
Usage:
cd misc
./build-local-test-kit.sh # Build image with your changes (~10-30 min)
./build-local-test-kit.sh --clean # Clean build from scratch
./build-local-test-kit.sh --help # Show detailed help
What it does:
test-kit-latest (contains latest development build from the main/master branch)test-kit:local ready for CLT testingExample workflow:
# 1. Make code changes
vim src/searchdhttp.cpp
# 2. Build test-kit with your changes
cd misc && ./build-local-test-kit.sh
# 3. Run CLT tests against your image
cd /path/to/clt
./clt test -t /path/to/test.rec -d test-kit:local
# 4. Tests pass! Commit and push
git add . && git commit -m "Add feature" && git push
Options:
./build-local-test-kit.sh --help for full documentationGitHub Actions will automatically build and test your PR the same way.
CLT uses two types of files:
.rec (test case) - Complete test file that CLT executes. Contains test steps and can include reusable blocks..recb (reusable block) - Shared test component that can be included in multiple .rec files using ––– block: path/to/block –––Example .rec file (complete test):
––– block: ../base/start-searchd-with-buddy –––
––– input –––
mysql -h0 -P9306 -e "CREATE TABLE test(content TEXT);"
––– output –––
––– input –––
mysql -h0 -P9306 -e "SELECT * FROM test;"
––– output –––
+------+---------+
| id | content |
+------+---------+
The first line includes a reusable block from ../base/start-searchd-with-buddy.recb which contains common setup steps (starting searchd and Buddy).
When to use each:
.rec for your actual test cases.recb for common setup/teardown steps that multiple tests need (see Base Blocks section below)See existing tests in test/clt-tests/ for more examples.
test/test_XXX/test/clt-tests/.rec file with your testtest/clt-tests/base/ for common setupExample:
# Create new test
cat > test/clt-tests/buddy-plugins/test-my-feature.rec << 'EOF'
––– block: ../base/start-searchd-with-buddy –––
––– input –––
mysql -h0 -P9306 -e "SELECT 1;"
––– output –––
+------+
| 1 |
+------+
| 1 |
+------+
EOF
# Run your test via GitHub Actions by pushing to your fork
git add test/clt-tests/buddy-plugins/test-my-feature.rec
git commit -m "Add test for my feature"
git push origin your-branch
expected-errors/ for error conditionstest-fuzzy-search-with-layouts.rec is better than test1.recReusable test components are located in test/clt-tests/base/. These include common setup/teardown blocks for starting searchd, Kafka integration, replication tests, and more. See the directory for available blocks.
Tests are automatically run via GitHub Actions when you create a pull request:
.github/workflows/test.yml - Main test workflow (runs automatically on PR).github/workflows/clt_tests.yml - CLT tests (runs automatically on PR).github/workflows/clt_nightly.yml - Extended nightly testsFor contributors: Simply add your tests to the appropriate directory in test/clt-tests/. When you create a PR, GitHub Actions will automatically run all relevant tests. Maintainers will determine if additional test coverage (e.g., nightly tests) is needed during code review.
You don't need to worry about which workflow runs your tests - just add them to the appropriate directory and GitHub Actions will execute them as part of the standard test suite.
After building from source, the compiled binaries are located at <build_directory>/src/ (searchd, indexer, indextool), where <build_directory> is where you ran cmake.
When submitting a pull request:
For more details, see CONTRIBUTING.md.