Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithInsecure ¶
func WithInsecure() testcontainers.CustomizeRequestOption
WithInsecure sets the container to run in insecure mode (no TLS). This is the default behaviour; the option exists for explicitness.
Types ¶
type Container ¶
type Container struct {
testcontainers.Container
// contains filtered or unexported fields
}
Container represents the KurrentDB container type used in the module.
func Run ¶
func Run(ctx context.Context, img string, opts ...testcontainers.ContainerCustomizer) (*Container, error)
Run creates an instance of the KurrentDB container type.
Example ¶
package main
import (
"context"
"fmt"
"log"
"github.com/testcontainers/testcontainers-go"
"github.com/testcontainers/testcontainers-go/modules/kurrentdb"
)
func main() {
// runKurrentDBContainer {
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
}
// }
state, err := kurrentdbContainer.State(ctx)
if err != nil {
log.Printf("failed to get container state: %s", err)
return
}
fmt.Println(state.Running)
}
Output: true
Example (WithInsecure) ¶
package main
import (
"context"
"fmt"
"log"
"github.com/testcontainers/testcontainers-go"
"github.com/testcontainers/testcontainers-go/modules/kurrentdb"
)
func main() {
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
func (*Container) ConnectionString ¶
ConnectionString returns the connection string for the KurrentDB container. When the container is running in insecure mode (no TLS), the returned URL includes "?tls=false"; otherwise only the base URL is returned.
Click to show internal directories.
Click to hide internal directories.