containers

package
v0.11.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 2, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package containers provides utilities for setting up testing containers. Currently, it includes functionality for - Postgres containers - Grafana LGTM containers

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LGTM

func LGTM(t *testing.T, ctx context.Context) (ctr *grafanalgtm.GrafanaLGTMContainer, fault error)

LGTM starts a Grafana LGTM container for testing purposes.

Types

type DatabaseContainer

type DatabaseContainer struct {
	Postgres *postgres.PostgresContainer
	Database string
	Username string
	Password string
	Host     string
	Port     string
}

DatabaseContainer wraps the PostgresContainer with additional metadata.

func Postgres

func Postgres(t *testing.T, ctx context.Context, version string) (container DatabaseContainer, fault error)

Postgres starts a Postgres container for testing purposes.

func (DatabaseContainer) Cleanup

func (c DatabaseContainer) Cleanup(t testing.TB)

Cleanup terminates the Postgres container.

func (DatabaseContainer) DatabaseURL

func (c DatabaseContainer) DatabaseURL() string

DatabaseURL returns the connection URL for the Postgres database.

func (DatabaseContainer) Hostname

func (c DatabaseContainer) Hostname(t testing.TB, ctx context.Context) string

Hostname returns the hostname of the Postgres container.

func (DatabaseContainer) MappedPort

func (c DatabaseContainer) MappedPort(t testing.TB, ctx context.Context, port string) string

MappedPort returns the mapped port for the given container port.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL