Local Test Server
This module can automatically install and run a local FoundationDB server for JVM tests.
- Install script:
scripts/install-foundationdb.sh(macOS/Linux) andscripts/install-foundationdb.ps1(Windows). - Run script:
scripts/run-fdb-for-tests.shstartsfdbserveron127.0.0.1:4500, writes logs tobuild/testdatastore/logs, and PID tobuild/testdatastore/fdbserver.pid. - Stop script:
scripts/stop-fdb-for-tests.shstops the server and removes the test database directory. - Install location: Binaries are placed under
store/foundationdb/binand native libs understore/foundationdb/bin/lib. The Gradle JVM test task setsjava.library.pathandDYLD_LIBRARY_PATH/LD_LIBRARY_PATHto this location.
Gradle Integration
Section titled “Gradle Integration”- Auto start/stop:
jvmTestdepends on starting FDB and finalizes by stopping it. - Tasks:
installFoundationDB: installs or links FDB locally.startFoundationDBForTests: starts the local server.stopFoundationDBForTests: stops the server and cleans data.
Configuration
Section titled “Configuration”FDB_VERSION: FDB version to install (default from scripts is7.3.69; code selects FDB Java API 730). Example:FDB_VERSION=7.3.69 ./gradlew :store:foundationdb:jvmTest.FDB_CLEAN_MODE: Post‑test cleanup (defaultdata). Options:data: deletebuild/testdatastore/data(database wiped).all: deletebuild/testdatastore/dataandbuild/testdatastore/logs.none: keep both.
- Cluster file: Tests use
store/foundationdb/fdb.cluster(exported asFDB_CLUSTER_FILEfor JVM tests). The run script will create it if missing. - Ports/paths: Default listen/public address
127.0.0.1:4500, databuild/testdatastore/data, logsbuild/testdatastore/logs.
Manual Usage
Section titled “Manual Usage”- Install (macOS/Linux):
bash scripts/install-foundationdb.sh. - Install (Windows):
powershell -ExecutionPolicy Bypass -File scripts/install-foundationdb.ps1 -Version 7.3.69. - Start:
bash scripts/run-fdb-for-tests.sh. - Stop and clean:
bash scripts/stop-fdb-for-tests.sh(respectsFDB_CLEAN_MODE).
Notes:
- On macOS, the installer downloads and extracts the FoundationDB
.pkgfrom GitHub releases iffdbserveris not on thePATH, and copieslibfdb_c.*intobin/lib. - On Linux, if no package manager is detected, the installer downloads and extracts
.debartifacts locally. - On Windows, the installer uses Chocolatey or Winget if available; starting/stopping the Windows service can also be used instead of the scripts.