Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithMasterKey ¶
func WithMasterKey(masterKey string) testcontainers.CustomizeRequestOption
WithMasterKey sets the master key for the Meilisearch container it satisfies the testcontainers.ContainerCustomizer interface
Types ¶
type MeilisearchContainer ¶
type MeilisearchContainer struct {
testcontainers.Container
// contains filtered or unexported fields
}
MeilisearchContainer represents the Meilisearch container type used in the module
func Run ¶
func Run(ctx context.Context, img string, opts ...testcontainers.ContainerCustomizer) (*MeilisearchContainer, error)
Run creates an instance of the Meilisearch container type
Example ¶
// runMeilisearchContainer {
ctx := context.Background()
meiliContainer, err := meilisearch.Run(
ctx,
"getmeili/meilisearch:v1.10.3",
meilisearch.WithMasterKey("my-master-key"),
meilisearch.WithDumpImport("testdata/movies.dump"),
)
defer func() {
if err := testcontainers.TerminateContainer(meiliContainer); err != nil {
log.Printf("failed to terminate container: %s", err)
}
}()
if err != nil {
log.Printf("failed to start container: %s", err)
return
}
// }
state, err := meiliContainer.State(ctx)
if err != nil {
log.Printf("failed to get container state: %s", err)
return
}
fmt.Println(state.Running)
fmt.Printf("%s\n", meiliContainer.MasterKey())
Output: true my-master-key
func (*MeilisearchContainer) Address ¶
func (c *MeilisearchContainer) Address(ctx context.Context) (string, error)
Address retrieves the address of the Meilisearch container. It will use http as protocol, as TLS is not supported at the moment.
func (*MeilisearchContainer) MasterKey ¶
func (c *MeilisearchContainer) MasterKey() string
MasterKey retrieves the master key of the Meilisearch container
type Option ¶
type Option func(*Options)
Option is an option for the Meilisearch container.
func WithDumpImport ¶
WithDumpImport sets the data dump file path for the Meilisearch container. dumpFilePath either relative to where you call meilisearch run or absolute path
func (Option) Customize ¶
func (o Option) Customize(*testcontainers.GenericContainerRequest) error
Customize is a NOOP. It's defined to satisfy the testcontainers.ContainerCustomizer interface.