Documentation
¶
Index ¶
Examples ¶
Constants ¶
View Source
const ( // DefaultUser is the default username for the ArangoDB container. // This is the username to be used when connecting to the ArangoDB instance. DefaultUser = "root" )
Variables ¶
This section is empty.
Functions ¶
func WithRootPassword ¶
func WithRootPassword(password string) testcontainers.CustomizeRequestOption
WithRootPassword sets the password for the ArangoDB root user
Types ¶
type Container ¶
type Container struct {
testcontainers.Container
// contains filtered or unexported fields
}
Container represents the ArangoDB container type used in the module
func Run ¶
func Run(ctx context.Context, img string, opts ...testcontainers.ContainerCustomizer) (*Container, error)
Run creates an instance of the ArangoDB container type
Example ¶
package main
import (
"context"
"fmt"
"log"
"github.com/testcontainers/testcontainers-go"
tcarangodb "github.com/testcontainers/testcontainers-go/modules/arangodb"
)
func main() {
// runArangoDBContainer {
ctx := context.Background()
const password = "t3stc0ntain3rs!"
arangodbContainer, err := tcarangodb.Run(ctx, "arangodb:3.11.5", tcarangodb.WithRootPassword(password))
defer func() {
if err := testcontainers.TerminateContainer(arangodbContainer); err != nil {
log.Printf("failed to terminate container: %s", err)
}
}()
if err != nil {
log.Printf("failed to start container: %s", err)
return
}
// }
state, err := arangodbContainer.State(ctx)
if err != nil {
log.Printf("failed to get container state: %s", err)
return
}
fmt.Println(state.Running)
}
Output: true
func (*Container) Credentials ¶
Credentials returns the credentials for the ArangoDB container: first return value is the username, second is the password.
Click to show internal directories.
Click to hide internal directories.