Morphium ships with a repository-local test runner script ./runtests.sh that makes it easier to:
- run the suite with different drivers (
pooled,single,inmem) - run against a real MongoDB via
--uri - run in parallel (
--parallel N) with per-slot database isolation - rerun only failing tests (
--rerunfailed)
Run the full suite against an external replica set:
./runtests.sh --driver pooled --uri mongodb://mongo1.example,mongo2.example/morphium_tests --exclude-tags server,inmemory --parallel 2 --restartNotes:
- Use
--restartto wipetest.log/and start fresh. - Use
--exclude-tags serverto skip PoppyDB-specific tests when you only want MongoDB. - Use
--exclude-tags inmemoryif you want to avoid in-memory-only suites.
./runtests.sh --driver inmem --parallel 4 --restart./runtests.sh --rerunfailed --parallel 2If you have a replica set running locally on localhost:27017,localhost:27018,localhost:27019 (MongoDB or PoppyDB), use:
./runtests.sh --poppydb --parallel 2 --restartThis mode sets:
--driver pooled--uri mongodb://localhost:27017,localhost:27018,localhost:27019/morphium_tests
The runner performs a quick connectivity preflight. If the cluster is not reachable, either start it manually or let the runner auto-start PoppyDB:
./runtests.sh --poppydb --start-poppydb-local --parallel 2 --restartTo keep the locally started cluster running after the test run:
./runtests.sh --poppydb --start-poppydb-local --keep-poppydb-local --parallel 2 --restartNote: The old flags --morphiumserver-local, --start-morphiumserver-local, and --keep-morphiumserver-local are deprecated aliases and still work for backward compatibility.
When auto-start is used, PoppyDB logs are written to .poppydb-local/logs/.
Note: --start-poppydb-local is idempotent. If something is already listening (MongoDB or another PoppyDB), the runner will just use it.
--allow-existing-localhost-rs is deprecated and has no effect.
If you want to skip specific categories (e.g. if you’re testing “MongoDB compatibility” only), add excludes explicitly:
./runtests.sh --poppydb --exclude-tags server --parallel 2 --restart- Aggregated logs are written to
test.log/<fully.qualified.Test>.log. - Slot logs are written to
test.log/slot_<N>/during parallel runs. - Use
./runtests.sh --statsfor a live overview (slots running, failures, progress).
With --parallel N, the runner assigns each slot its own database prefix via -Dmorphium.database=morphium_test_<slot>.
This prevents different JVMs from dropping or overwriting each other’s data during heavy parallel suites.
If you run tests manually with Maven, it’s recommended to set an explicit DB as well:
mvn -Pexternal -Dmorphium.driver=pooled -Dmorphium.uri=mongodb://... -Dmorphium.database=morphium_test_manual test!!! note "Maintainer infrastructure — not required for contributing"
Everything from here on describes the maintainers' own self-hosted test runner.
The hostnames, containers and API keys below refer to a private setup and are not
reachable from outside it.
You do **not** need any of this to contribute. `./runtests.sh` on your own machine
covers the same ground — see the sections above, and use `--poppydb` /
`--poppydb-replicaset` for server-backed phases without installing MongoDB.
For running the full test matrix on a dedicated VM (e.g., Proxmox):
- Create Ubuntu 24.04 VM (4 CPU, 8 GB RAM minimum)
- Run provisioning:
sudo bash ci/setup-testvm.sh - Set API key: edit
/home/morphium-test/.claude_env - Update git remote if needed
./ci/deploy-to-vm.sh testrunner.fritz.boxssh morphium-test@testrunner.fritz.box "~/run-morphium-tests.sh"Open http://testrunner.fritz.box:8080/ in your browser.
The test orchestration runs five phases in parallel (each against its own server):
- InMemDriver (in-process, no external deps)
- MongoDB Replica Set
- MongoDB Single Node
- PoppyDB Replica Set
- PoppyDB Single Node
Failed tests are retried individually in a second pass: a test that passes on retry is reported as flaky, one that fails again as broken. Stale test databases are dropped automatically before each run.
Claude Code analyzes failures and generates a detailed HTML report.