influxdb

package module
v0.30.0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithConfigFile

func WithConfigFile(configFile string) testcontainers.CustomizeRequestOption

func WithDatabase

func WithDatabase(database string) testcontainers.CustomizeRequestOption

func WithInitDb

func WithInitDb(srcPath string) testcontainers.CustomizeRequestOption

WithInitDb will copy a 'docker-entrypoint-initdb.d' directory to the container. The secPath is the path to the directory on the host machine. The directory will be copied to the root of the container.

func WithPassword

func WithPassword(password string) testcontainers.CustomizeRequestOption

func WithUsername

func WithUsername(username string) testcontainers.CustomizeRequestOption

Types

type InfluxDbContainer

type InfluxDbContainer struct {
	testcontainers.Container
}

InfluxDbContainer represents the MySQL container type used in the module

func RunContainer

func RunContainer(ctx context.Context, opts ...testcontainers.ContainerCustomizer) (*InfluxDbContainer, error)

RunContainer creates an instance of the InfluxDB container type

Example
// runInfluxContainer {
ctx := context.Background()

influxdbContainer, err := influxdb.RunContainer(
	ctx, testcontainers.WithImage("influxdb:1.8.10"),
	influxdb.WithDatabase("influx"),
	influxdb.WithUsername("root"),
	influxdb.WithPassword("password"),
)
if err != nil {
	log.Fatalf("failed to start container: %s", err)
}

// Clean up the container
defer func() {
	if err := influxdbContainer.Terminate(ctx); err != nil {
		log.Fatalf("failed to terminate container: %s", err)
	}
}()
// }

state, err := influxdbContainer.State(ctx)
if err != nil {
	log.Fatalf("failed to get container state: %s", err) // nolint:gocritic
}

fmt.Println(state.Running)
Output:

true

func (*InfluxDbContainer) ConnectionUrl

func (c *InfluxDbContainer) ConnectionUrl(ctx context.Context) (string, error)

func (*InfluxDbContainer) MustConnectionUrl

func (c *InfluxDbContainer) MustConnectionUrl(ctx context.Context) string

Jump to

Keyboard shortcuts

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