container

package
v0.4.6 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MongoDBContainer

type MongoDBContainer struct {
	Container        *mongodb.MongoDBContainer
	Client           *mongo.Client
	ConnectionString string
}

MongoDBContainer wraps the testcontainers MongoDB container with a client.

func StartMongoDBContainer

func StartMongoDBContainer(ctx context.Context, opts ...MongoDBContainerOption) (*MongoDBContainer, error)

StartMongoDBContainer starts a MongoDB container and returns a wrapper with a connected client.

func (*MongoDBContainer) Database

func (m *MongoDBContainer) Database(name string) *mongo.Database

Database returns a database handle for the given name.

func (*MongoDBContainer) Terminate

func (m *MongoDBContainer) Terminate(ctx context.Context) error

Terminate disconnects the client and terminates the container.

type MongoDBContainerOption

type MongoDBContainerOption func(*mongoDBContainerOptions)

MongoDBContainerOption configures the MongoDB container.

func WithImage

func WithImage(image string) MongoDBContainerOption

WithImage sets the MongoDB image to use.

func WithReplicaSet

func WithReplicaSet(name string) MongoDBContainerOption

WithReplicaSet enables replica set with the given name.

type SchemaRegistryContainer

type SchemaRegistryContainer struct {
	Container testcontainers.Container
	URL       string
}

SchemaRegistryContainer wraps the testcontainers Schema Registry container.

func StartSchemaRegistryContainer

func StartSchemaRegistryContainer(ctx context.Context, opts ...SchemaRegistryOption) (*SchemaRegistryContainer, error)

StartSchemaRegistryContainer starts a Schema Registry container with an embedded Kafka. This uses Redpanda which includes both Kafka and Schema Registry in one container.

func (*SchemaRegistryContainer) KafkaBroker

func (s *SchemaRegistryContainer) KafkaBroker(ctx context.Context) (string, error)

KafkaBroker returns the Kafka broker address (useful if you need real Kafka too).

func (*SchemaRegistryContainer) Terminate

func (s *SchemaRegistryContainer) Terminate(ctx context.Context) error

Terminate terminates the container.

type SchemaRegistryOption

type SchemaRegistryOption func(*schemaRegistryOptions)

SchemaRegistryOption configures the Schema Registry container.

func WithSchemaRegistryImage

func WithSchemaRegistryImage(image string) SchemaRegistryOption

WithSchemaRegistryImage sets the Schema Registry image to use.

Jump to

Keyboard shortcuts

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