Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithPassword ¶
func WithPassword(password string) testcontainers.CustomizeRequestOption
WithPassword sets the initial password of the user to be created when the container starts It is required for you to use the Minio image. It must not be empty or undefined. This environment variable sets the root user password for Minio.
func WithUsername ¶
func WithUsername(username string) testcontainers.CustomizeRequestOption
WithUsername sets the initial username to be created when the container starts It is used in conjunction with WithPassword to set a user and its password. It will create the specified user. It must not be empty or undefined.
Types ¶
type MinioContainer ¶
MinioContainer represents the Minio container type used in the module
func RunContainer ¶
func RunContainer(ctx context.Context, opts ...testcontainers.ContainerCustomizer) (*MinioContainer, error)
RunContainer creates an instance of the Minio container type
Example ¶
// runMinioContainer { ctx := context.Background() minioContainer, err := minio.RunContainer(ctx, testcontainers.WithImage("minio/minio:RELEASE.2024-01-16T16-07-38Z")) if err != nil { log.Fatalf("failed to start container: %s", err) } // Clean up the container defer func() { if err := minioContainer.Terminate(ctx); err != nil { log.Fatalf("failed to terminate container: %s", err) } }() // } state, err := minioContainer.State(ctx) if err != nil { log.Fatalf("failed to get container state: %s", err) // nolint:gocritic } fmt.Println(state.Running)
Output: true
func (*MinioContainer) ConnectionString ¶
func (c *MinioContainer) ConnectionString(ctx context.Context) (string, error)
ConnectionString returns the connection string for the minio container, using the default 9000 port, and obtaining the host and exposed port from the container.