Skip to content

KurrentDB

Not available until the next release main

Introduction

The Testcontainers module for KurrentDB, an event-native database for storing application state changes as immutable events. KurrentDB is the rebrand of EventStoreDB and uses the kurrent:// connection string scheme.

Adding this module to your project dependencies

Please run the following command to add the KurrentDB module to your Go dependencies:

go get github.com/testcontainers/testcontainers-go/modules/kurrentdb

Usage example

ctx := context.Background()

kurrentdbContainer, err := kurrentdb.Run(ctx, "kurrentplatform/kurrentdb:26.1.1")
defer func() {
    if err := testcontainers.TerminateContainer(kurrentdbContainer); err != nil {
        log.Printf("failed to terminate container: %s", err)
    }
}()
if err != nil {
    log.Printf("failed to start container: %s", err)
    return
}

Module Reference

Run function

  • Not available until the next release main

The KurrentDB module exposes one entrypoint function to create the KurrentDB container, and this function receives three parameters:

func Run(ctx context.Context, img string, opts ...testcontainers.ContainerCustomizer) (*Container, error)
  • context.Context, the Go context.
  • string, the Docker image to use.
  • testcontainers.ContainerCustomizer, a variadic argument for passing options.

Image

Use the second argument in the Run function to set a valid Docker image. In example: Run(context.Background(), "kurrentplatform/kurrentdb:latest").

Container Options

When starting the KurrentDB container, you can pass options in a variadic way to configure it.

WithInsecure

  • Not available until the next release main

By default, KurrentDB runs in insecure mode (no TLS), which is suitable for local development and testing. The WithInsecure option makes this explicit:

ctx := context.Background()

// withInsecure {
kurrentdbContainer, err := kurrentdb.Run(ctx,
    "kurrentplatform/kurrentdb:26.1.1",
    kurrentdb.WithInsecure(),
)
// }
defer func() {
    if err := testcontainers.TerminateContainer(kurrentdbContainer); err != nil {
        log.Printf("failed to terminate container: %s", err)
    }
}()
if err != nil {
    log.Printf("failed to start container: %s", err)
    return
}

// connectionString {
connStr, err := kurrentdbContainer.ConnectionString(ctx)
// }
if err != nil {
    log.Printf("failed to get connection string: %s", err)
    return
}

fmt.Println(connStr != "")

// Output:
// true

The following options are exposed by the testcontainers package.

Basic Options

Lifecycle Options

Files & Mounts Options

Build Options

Logging Options

Image Options

Networking Options

Advanced Options

Experimental Options

Container Methods

The KurrentDB container exposes the following methods:

ConnectionString

  • Not available until the next release main

The ConnectionString(ctx) method returns the connection string to connect to the KurrentDB container using the kurrent:// scheme. When the container runs in insecure mode, ?tls=false is appended.

connStr, err := kurrentdbContainer.ConnectionString(ctx)