integration/vespa-testcontainers/README.md
Testcontainers integration for Vespa.
To successfully pass the unit tests, Docker or Podman is required.
[!NOTE] When using Podman instead of Docker, set
bashexport DOCKER_HOST="unix://"$(podman machine inspect --format {{.ConnectionInfo.PodmanSocket.Path}}) export TESTCONTAINERS_RYUK_DISABLED=truebefore running unit tests.
Gradle:
testImplementation 'ai.vespa:vespa-testcontainers:1.0.0'
Maven:
<dependency>
<groupId>ai.vespa</groupId>
<artifactId>vespa-testcontainers</artifactId>
<version>8-SNAPSHOT</version>
<scope>test</scope>
</dependency>
import ai.vespa.testcontainers.VespaContainer;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
class MySearchTest {
static VespaContainer vespa;
// Other containers etc.
@BeforeAll
static void setUp() {
vespa = new VespaContainer().withApplicationPackage("app");
vespa.start();
// feed documents, set up clients, etc.
}
@Test
void testOne() { ... }
@Test
void testTwo() { ... }
@AfterAll
static void tearDown() {
vespa.close();
// Close other containers, clients, etc.
}
}
A specific Vespa version can be requested:
new VespaContainer("vespaengine/vespa:8.640.27")
| Method | Description |
|---|---|
withApplicationPackage(String) | Classpath resource path to app package, deployed on startup |
withApplicationPackage(Path) | Host path to app package, deployed on startup |
withDeployWaitTime(Duration) | Override default 1-minute deploy timeout |
deployApplicationPackage(String) | Copy and deploy an app package on a running container |
getEndpoint() | Base URL of the query/document API (http://host:8080) |
getConfigEndpoint() | Base URL of the config server (http://host:19071) |