Skip to content

Timeplus

Not available until the next release main

Introduction

The Testcontainers module for Timeplus.

Timeplus is a simple, powerful, and cost-efficient stream processing platform. It is compatible with the ClickHouse wire protocol, so any ClickHouse client library can connect to a Timeplus instance.

Adding this module to your project dependencies

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

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

Usage example

ctx := context.Background()

timeplusContainer, err := timeplus.Run(ctx, "timeplus/timeplusd:2.3.37")
defer func() {
    if err := testcontainers.TerminateContainer(timeplusContainer); 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 Timeplus module exposes one entrypoint function to create the Timeplus 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(), "timeplus/timeplusd:2.3").

Container Ports

Here you can find the list with the default ports used by the Timeplus container.

httpPort   = "8123/tcp"
nativePort = "8463/tcp"

Container Options

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

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 Timeplus container exposes the following methods:

HTTPEndpoint

  • Not available until the next release main

This method returns the HTTP endpoint of the Timeplus container for the ClickHouse-compatible HTTP API (port 8123), in the form http://host:port.

ctx := context.Background()

timeplusContainer, err := timeplus.Run(ctx, "timeplus/timeplusd:2.3.37")
defer func() {
    if err := testcontainers.TerminateContainer(timeplusContainer); err != nil {
        log.Printf("failed to terminate container: %s", err)
    }
}()
if err != nil {
    log.Printf("failed to start container: %s", err)
    return
}

httpEndpoint, err := timeplusContainer.HTTPEndpoint(ctx)
if err != nil {
    log.Printf("failed to get HTTP endpoint: %s", err)
    return
}

fmt.Println(len(httpEndpoint) > 0)

// Output:
// true

Info

Because Timeplus is wire-protocol compatible with ClickHouse, you can use any ClickHouse client library to connect to a Timeplus container via the HTTP endpoint returned by HTTPEndpoint.