Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OpenSearchContainer ¶
OpenSearchContainer represents the OpenSearch container type used in the module
func RunContainer ¶
func RunContainer(ctx context.Context, opts ...testcontainers.ContainerCustomizer) (*OpenSearchContainer, error)
RunContainer creates an instance of the OpenSearch container type
Example ¶
// runOpenSearchContainer { ctx := context.Background() opensearchContainer, err := opensearch.RunContainer( ctx, testcontainers.WithImage("opensearchproject/opensearch:2.11.1"), opensearch.WithUsername("new-username"), opensearch.WithPassword("new-password"), ) if err != nil { log.Fatalf("failed to start container: %s", err) } // Clean up the container defer func() { if err := opensearchContainer.Terminate(ctx); err != nil { log.Fatalf("failed to terminate container: %s", err) // nolint:gocritic } }() // } state, err := opensearchContainer.State(ctx) if err != nil { log.Fatalf("failed to get container state: %s", err) // nolint:gocritic } fmt.Println(state.Running) fmt.Printf("%s : %s\n", opensearchContainer.User, opensearchContainer.Password)
Output: true new-username : new-password
type Option ¶
type Option func(*Options)
Option is an option for the OpenSearch container.
func WithPassword ¶
WithPassword sets the password for the OpenSearch container.
func WithUsername ¶
WithUsername sets the username for the OpenSearch container.
Click to show internal directories.
Click to hide internal directories.