https://github.com/aleris/testcontainers-foundationdb
Testcontainers module for running FoundationDB
https://github.com/aleris/testcontainers-foundationdb
foundationdb testcontainers
Last synced: 2 months ago
JSON representation
Testcontainers module for running FoundationDB
- Host: GitHub
- URL: https://github.com/aleris/testcontainers-foundationdb
- Owner: aleris
- License: mit
- Created: 2022-07-31T12:44:14.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-05-19T04:24:21.000Z (about 2 years ago)
- Last Synced: 2024-05-19T09:43:20.485Z (about 2 years ago)
- Topics: foundationdb, testcontainers
- Language: Java
- Homepage:
- Size: 87.9 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Testcontainers FoundationDB Module
[](https://github.com/aleris/testcontainers-foundationdb/actions/workflows/build-on-push.yml)
Helps running [FoundationDB](https://www.foundationdb.org/) using [Testcontainers](https://www.testcontainers.org/).
It's based on the [docker images](https://hub.docker.com/r/foundationdb/foundationdb) provided by FoundationDB
Community.
## Adding this module to your project dependencies
1. Add Foundation DB java client dependency, for example:
```groovy
implementation("org.foundationdb:fdb-java:7.1.61")
```
```xml
org.foundationdb
fdb-java
7.1.61
```
Note that the FDB client requires the native client libraries to be installed:
- https://apple.github.io/foundationdb/downloads.html
- https://github.com/apple/foundationdb/releases
2. Add [Testcontainers](https://www.testcontainers.org/quickstart/junit_5_quickstart/) dependency, for example:
```groovy
testImplementation "org.testcontainers:testcontainers:1.19.8"
```
```xml
org.testcontainers
testcontainers
1.19.8
test
```
3. Finally add the module dependency to your `build.gradle` / `pom.xml` file:
```groovy
testImplementation "earth.adi:testcontainers-foundationdb:1.1.0"
```
```xml
earth.adi
testcontainers-foundationdb
1.1.0
test
```
## Usage example
You can start a FoundationDB container instance from a Java application by using:
```java
try (final FoundationDBContainer foundationDBContainer = new FoundationDBContainer()) {
foundationDBContainer.start();
final FDB fdb = FDB.selectAPIVersion(710);
try (final Database db = fdb.open(foundationDBContainer.getClusterFilePath())) {
db.run(tr -> {
tr.set(Tuple.from("hello").pack(), Tuple.from("world").pack());
return null;
});
}
}
```
To start with a specific version use:
```java
final FoundationDBContainer foundationDBContainer = new FoundationDBContainer(
DockerImageName.parse("foundationdb/foundationdb:7.1.61")
)
```
See also the tests for other examples.
## Caveats
- FDB requires the native client libraries be installed separately for the java dependency to work. Install the
libraries before using the java FDB client.
- On MacOS, try setting `export DYLD_LIBRARY_PATH=/usr/local/lib` in environment variables
after installing FDB clients locally if you encounter issues.
## Releasing
Details
```console
~$ cd testcontainers-foundationdb
# Update version in build.gradle.kts
~/testcontainers-foundationdb ./gradlew updateReadmeVersion # updates the version in README.md from build.gradle.kts
~/testcontainers-foundationdb ./gradlew jreleaserConfig # just to double check the configuration
~/testcontainers-foundationdb ./gradlew clean
~/testcontainers-foundationdb ./gradlew publish
~/testcontainers-foundationdb ./gradlew jreleaserFullRelease
```