Documentation
¶
Index ¶
- Variables
- func WithAcceptCommercialLicenseAgreement() testcontainers.CustomizeRequestOption
- func WithAcceptEvaluationLicenseAgreement() testcontainers.CustomizeRequestOption
- func WithAdminPassword(adminPassword string) testcontainers.CustomizeRequestOption
- func WithLabsPlugin(plugins ...LabsPlugin) testcontainers.CustomizeRequestOption
- func WithNeo4jSetting(key, value string) testcontainers.CustomizeRequestOption
- func WithNeo4jSettings(settings map[string]string) testcontainers.CustomizeRequestOption
- func WithoutAuthentication() testcontainers.CustomizeRequestOption
- type LabsPlugin
- type Neo4jContainer
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var (
WithLogger = testcontainers.WithLogger
)
Deprecated: use testcontainers.WithLogger instead
WithLogger sets a custom logger to be used by the container Consider calling this before other "With functions" as these may generate logs
Functions ¶
func WithAcceptCommercialLicenseAgreement ¶ added in v0.27.0
func WithAcceptCommercialLicenseAgreement() testcontainers.CustomizeRequestOption
WithAcceptCommercialLicenseAgreement sets the environment variable NEO4J_ACCEPT_LICENSE_AGREEMENT to "yes", indicating that the user accepts the commercial licence agreement of Neo4j Enterprise Edition. The license agreement is available at https://neo4j.com/terms/licensing/.
func WithAcceptEvaluationLicenseAgreement ¶ added in v0.27.0
func WithAcceptEvaluationLicenseAgreement() testcontainers.CustomizeRequestOption
WithAcceptEvaluationLicenseAgreement sets the environment variable NEO4J_ACCEPT_LICENSE_AGREEMENT to "eval", indicating that the user accepts the evaluation agreement of Neo4j Enterprise Edition. The evaluation agreement is available at https://neo4j.com/terms/enterprise_us/. Please read the terms of the evaluation agreement before you accept.
func WithAdminPassword ¶
func WithAdminPassword(adminPassword string) testcontainers.CustomizeRequestOption
WithAdminPassword sets the admin password for the default account An empty string disables authentication. The default password is "password".
func WithLabsPlugin ¶
func WithLabsPlugin(plugins ...LabsPlugin) testcontainers.CustomizeRequestOption
WithLabsPlugin registers one or more Neo4jLabsPlugin for download and server startup. There might be plugins not supported by your selected version of Neo4j.
func WithNeo4jSetting ¶
func WithNeo4jSetting(key, value string) testcontainers.CustomizeRequestOption
WithNeo4jSetting adds Neo4j a single configuration setting to the container. The setting can be added as in the official Neo4j configuration, the function automatically translates the setting name (e.g. dbms.tx_log.rotation.size) into the format required by the Neo4j container. This function can be called multiple times. A warning is emitted if a key is overwritten. See WithNeo4jSettings to add multiple settings at once Note: credentials must be configured with WithAdminPassword
func WithNeo4jSettings ¶
func WithNeo4jSettings(settings map[string]string) testcontainers.CustomizeRequestOption
WithNeo4jSettings adds multiple Neo4j configuration settings to the container. The settings can be added as in the official Neo4j configuration, the function automatically translates each setting name (e.g. dbms.tx_log.rotation.size) into the format required by the Neo4j container. This function can be called multiple times. A warning is emitted if a key is overwritten. See WithNeo4jSetting to add a single setting Note: credentials must be configured with WithAdminPassword
func WithoutAuthentication ¶
func WithoutAuthentication() testcontainers.CustomizeRequestOption
WithoutAuthentication disables authentication.
Types ¶
type LabsPlugin ¶
type LabsPlugin string
const ( Apoc LabsPlugin = "apoc" ApocCore LabsPlugin = "apoc-core" Bloom LabsPlugin = "bloom" GraphDataScience LabsPlugin = "graph-data-science" NeoSemantics LabsPlugin = "n10s" Streams LabsPlugin = "streams" )
type Neo4jContainer ¶
type Neo4jContainer struct {
testcontainers.Container
}
Neo4jContainer represents the Neo4j container type used in the module
func Run ¶ added in v0.32.0
func Run(ctx context.Context, img string, opts ...testcontainers.ContainerCustomizer) (*Neo4jContainer, error)
Run creates an instance of the Neo4j container type
Example ¶
package main
import (
"context"
"fmt"
"log"
"github.com/testcontainers/testcontainers-go"
"github.com/testcontainers/testcontainers-go/modules/neo4j"
)
func main() {
// runNeo4jContainer {
ctx := context.Background()
testPassword := "letmein!"
neo4jContainer, err := neo4j.Run(ctx,
"neo4j:4.4",
neo4j.WithAdminPassword(testPassword),
neo4j.WithLabsPlugin(neo4j.Apoc),
neo4j.WithNeo4jSetting("dbms.tx_log.rotation.size", "42M"),
)
defer func() {
if err := testcontainers.TerminateContainer(neo4jContainer); err != nil {
log.Printf("failed to terminate container: %s", err)
}
}()
if err != nil {
log.Printf("failed to start container: %s", err)
return
}
// }
state, err := neo4jContainer.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) (*Neo4jContainer, error)
Deprecated: use Run instead RunContainer creates an instance of the Neo4j container type