This directory contains the integration setup for running Complement, the official Matrix compliance test suite, against the FERRETCANNON Matrix homeserver.
Big shoutout to the FERRETCANNON massive for spec compliance! 🎆
Complement is a black-box integration testing framework for Matrix homeservers. It validates that homeserver implementations comply with the Matrix Specification by running comprehensive tests covering:
- Client-Server API endpoints
- Server-Server (Federation) API
- Authentication and authorisation
- Room operations and state resolution
- End-to-end encryption
- Media repository
- And much more!
Complement is the industry standard for Matrix homeserver compliance testing, used by Synapse, Dendrite, Conduit, and other implementations.
- Docker (or Podman with Docker compatibility)
- Go 1.21 or higher
- Git
git clone https://github.com/matrix-org/complement.git
cd complementFrom the FERRETCANNON repository root:
docker build -t complement-ferretcannon -f Complement.Dockerfile .COMPLEMENT_BASE_IMAGE=complement-ferretcannon:latest go test -v ./tests/...This will run the full Complement test suite against FERRETCANNON.
Run a specific test:
COMPLEMENT_BASE_IMAGE=complement-ferretcannon:latest go test -v -run TestRegistration ./tests/...Run tests with a timeout:
COMPLEMENT_BASE_IMAGE=complement-ferretcannon:latest go test -timeout 30s -v -run TestLogin ./tests/...Complement supports passing environment variables to the homeserver container. Use the COMPLEMENT_SHARE_ENV_PREFIX to specify which variables to pass:
export COMPLEMENT_SHARE_ENV_PREFIX=PASS_
export PASS_ENABLE_DEBUG=true
COMPLEMENT_BASE_IMAGE=complement-ferretcannon:latest go test -v ./tests/...The Complement.Dockerfile configures FERRETCANNON with appropriate settings for testing:
- Server Name: Dynamically set via
SERVER_NAMEenvironment variable - Port: 8008 (Complement standard)
- Database: SQLite in
/data/ferretcannon.db - Media Storage:
/data/media - Debug Logging: Disabled by default (can be enabled via env var)
Complement provides detailed test output including:
- PASS: Test succeeded
- FAIL: Test failed with error details
- SKIP: Test was skipped (e.g., feature not applicable)
Example output:
=== RUN TestRegistration
TestRegistration: registration_test.go:25: Registering user...
TestRegistration: registration_test.go:30: ✅ Registration successful
--- PASS: TestRegistration (2.34s)
-
Client-Server API Tests (
tests/csapi/)- Registration and login
- Room operations
- Messages and events
- User profiles
- Device management
-
Federation Tests (
tests/federation/)- make_join/send_join flows
- Event signing and verification
- Server key exchange
- Backfill and state resolution
-
Room Version Tests (
tests/room_versions/)- Different room version behaviours
- State resolution algorithms
- Event format validation
-
End-to-End Encryption Tests (
tests/e2e/)- Device key upload
- One-time keys
- Key claiming
- Encrypted message flow
If federation tests fail, you may need to configure your firewall to allow Docker bridge network traffic:
# For ufw (Ubuntu/Debian)
sudo ufw allow in on br-+
# For firewalld (RHEL/CentOS/Fedora)
sudo firewall-cmd --zone=docker --add-masquerade --permanent
sudo firewall-cmd --reloadIf port 8008 is already in use:
# Check what's using port 8008
sudo lsof -i :8008
# Stop conflicting services if neededIf Docker builds fail:
# Clean Docker cache
docker system prune -af
# Rebuild without cache
docker build --no-cache -t complement-ferretcannon -f Complement.Dockerfile .If using Podman instead of Docker:
# Enable Docker compatibility
systemctl --user start podman.socket
# Set environment variable
export DOCKER_HOST=unix://$XDG_RUNTIME_DIR/podman/podman.sock
# Run tests
COMPLEMENT_BASE_IMAGE=complement-ferretcannon:latest go test -v ./tests/...Create .github/workflows/complement.yml:
name: Complement Tests
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
jobs:
complement:
name: Run Complement Tests
runs-on: ubuntu-latest
steps:
- name: Checkout FERRETCANNON
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Complement Image
run: |
docker build -t complement-ferretcannon -f Complement.Dockerfile .
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
- name: Checkout Complement
uses: actions/checkout@v4
with:
repository: matrix-org/complement
path: complement
- name: Run Complement Tests
working-directory: complement
env:
COMPLEMENT_BASE_IMAGE: complement-ferretcannon:latest
run: |
go test -v -timeout 30m ./tests/...
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: complement-results
path: complement/test-results/Track which Matrix specification features are tested:
| Feature | Test Coverage | Notes |
|---|---|---|
| Client-Server API | ✅ Full | All endpoints tested |
| Federation API | ✅ Full | Including state resolution |
| Room Versions | ✅ v1-v12 | All supported versions |
| E2EE | 🔄 Partial | Basic key exchange working |
| Push Notifications | 🔄 Partial | HTTP push tested |
| Application Services | Basic registration only |
If Complement tests reveal issues:
- Reproduce locally: Run the failing test locally to confirm the issue
- Debug: Use debug logging and test output to identify the problem
- Fix: Implement the fix in FERRETCANNON source code
- Verify: Rebuild and re-run the test to confirm the fix
- Submit: Create a PR with the fix and test results
- Complement GitHub Repository
- Matrix Specification v1.16
- Complement Documentation
- FERRETCANNON README
For issues with:
- Complement itself: File issues on matrix-org/complement
- FERRETCANNON integration: File issues on EdGeraghty/FERRETCANNON
- Matrix Specification: Discuss on #matrix-spec:matrix.org
Last Updated: October 2025
Status: ✅ Complement integration ready for testing
Next Steps: Run full test suite and document results
Big shoutout to the Matrix.org team for creating Complement and to the FERRETCANNON massive for making this integration happen! 🎆