From db6136946fb3e513a779d98eb6c2e924c18a6ab7 Mon Sep 17 00:00:00 2001 From: Daniel Orbach <49489492+danielorbach@users.noreply.github.com> Date: Wed, 3 Apr 2024 12:07:06 +0300 Subject: [PATCH] Upgrade neo4j module to use features from v0.29.1 of testcontainers-go (#2463) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Configure enterprise license using the new WithEnv option Release v0.29.1 introduces a new option - WithEnv. This commit uses this new option to configure the enterprise license instead of the manual approach taken prior. * Fix typo in WithEnv documentation I've noticed a typo while reading about this new option. --------- Co-authored-by: Manuel de la Peña --- docs/features/common_functional_options.md | 2 +- modules/neo4j/config.go | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/features/common_functional_options.md b/docs/features/common_functional_options.md index 288093941c..1572bb461b 100644 --- a/docs/features/common_functional_options.md +++ b/docs/features/common_functional_options.md @@ -22,7 +22,7 @@ Using the `WithImageSubstitutors` options, you could define your own substitutio If you need to either pass additional environment variables to a container or override them, you can use `testcontainers.WithEnv` for example: ```golang -postgres, err = postgresModule.RunContainer(ctx, testcontainers.WithEnv(map[string]string{"POSTGRES_INITDB_ARGS", "--no-sync"})) +postgres, err = postgresModule.RunContainer(ctx, testcontainers.WithEnv(map[string]string{"POSTGRES_INITDB_ARGS": "--no-sync"})) ``` #### WithLogConsumers diff --git a/modules/neo4j/config.go b/modules/neo4j/config.go index 9d0bc70816..1b62363cb9 100644 --- a/modules/neo4j/config.go +++ b/modules/neo4j/config.go @@ -123,9 +123,9 @@ func formatNeo4jConfig(name string) string { // the commercial licence agreement of Neo4j Enterprise Edition. The license // agreement is available at https://neo4j.com/terms/licensing/. func WithAcceptCommercialLicenseAgreement() testcontainers.CustomizeRequestOption { - return func(req *testcontainers.GenericContainerRequest) { - req.Env["NEO4J_ACCEPT_LICENSE_AGREEMENT"] = "yes" - } + return testcontainers.WithEnv(map[string]string{ + "NEO4J_ACCEPT_LICENSE_AGREEMENT": "yes", + }) } // WithAcceptEvaluationLicenseAgreement sets the environment variable @@ -134,7 +134,7 @@ func WithAcceptCommercialLicenseAgreement() testcontainers.CustomizeRequestOptio // agreement is available at https://neo4j.com/terms/enterprise_us/. Please // read the terms of the evaluation agreement before you accept. func WithAcceptEvaluationLicenseAgreement() testcontainers.CustomizeRequestOption { - return func(req *testcontainers.GenericContainerRequest) { - req.Env["NEO4J_ACCEPT_LICENSE_AGREEMENT"] = "eval" - } + return testcontainers.WithEnv(map[string]string{ + "NEO4J_ACCEPT_LICENSE_AGREEMENT": "eval", + }) }