Documentation
¶
Index ¶
- func WithAdminPassword(password string) testcontainers.ContainerCustomizer
- func WithAdminUsername(username string) testcontainers.ContainerCustomizer
- func WithInitialLdif(ldif string) testcontainers.CustomizeRequestOption
- func WithRoot(root string) testcontainers.ContainerCustomizer
- type OpenLDAPContainer
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithAdminPassword ¶
func WithAdminPassword(password string) testcontainers.ContainerCustomizer
WithAdminPassword sets the initial admin password of the user to be created when the container starts It is used in conjunction with WithAdminUsername to set a username and its password. It will set the admin password for OpenLDAP.
func WithAdminUsername ¶
func WithAdminUsername(username string) testcontainers.ContainerCustomizer
WithAdminUsername sets the initial admin username to be created when the container starts It is used in conjunction with WithAdminPassword to set a username and its password. It will create the specified user with admin power.
func WithInitialLdif ¶
func WithInitialLdif(ldif string) testcontainers.CustomizeRequestOption
WithInitialLdif sets the initial ldif file to be loaded into the OpenLDAP container
func WithRoot ¶
func WithRoot(root string) testcontainers.ContainerCustomizer
WithRoot sets the root of the OpenLDAP instance
Types ¶
type OpenLDAPContainer ¶
type OpenLDAPContainer struct {
testcontainers.Container
// contains filtered or unexported fields
}
OpenLDAPContainer represents the OpenLDAP container type used in the module
func Run ¶ added in v0.32.0
func Run(ctx context.Context, img string, opts ...testcontainers.ContainerCustomizer) (*OpenLDAPContainer, error)
Run creates an instance of the OpenLDAP container type
Example ¶
package main
import (
"context"
"fmt"
"log"
"github.com/testcontainers/testcontainers-go"
"github.com/testcontainers/testcontainers-go/modules/openldap"
)
func main() {
// runOpenLDAPContainer {
ctx := context.Background()
openldapContainer, err := openldap.Run(ctx, "bitnamilegacy/openldap:2.6.6")
defer func() {
if err := testcontainers.TerminateContainer(openldapContainer); err != nil {
log.Printf("failed to terminate container: %s", err)
}
}()
if err != nil {
log.Printf("failed to start container: %s", err)
return
}
// }
state, err := openldapContainer.State(ctx)
if err != nil {
log.Printf("failed to get container state: %s", err)
return
}
fmt.Println(state.Running)
}
Output: true
func RunContainer
deprecated
func RunContainer(ctx context.Context, opts ...testcontainers.ContainerCustomizer) (*OpenLDAPContainer, error)
Deprecated: use Run instead RunContainer creates an instance of the OpenLDAP container type
func (*OpenLDAPContainer) ConnectionString ¶
ConnectionString returns the connection string for the OpenLDAP container