Skip to content

Commit

Permalink
Add test for Neo4j with Enterprise License
Browse files Browse the repository at this point in the history
  • Loading branch information
danielorbach committed Dec 21, 2023
1 parent cad09a5 commit e05b2ab
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions modules/neo4j/neo4j_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

neo "github.com/neo4j/neo4j-go-driver/v5/neo4j"

"github.com/testcontainers/testcontainers-go"
"github.com/testcontainers/testcontainers-go/modules/neo4j"
)

Expand Down Expand Up @@ -59,6 +60,44 @@ func TestNeo4j(outer *testing.T) {
})
}

func TestNeo4jWithEnterpriseLicense(t *testing.T) {
t.Parallel()

ctx := context.Background()

images := map[string]string{
"StandardEdition": "docker.io/neo4j:4.4",
"EnterpriseEdition": "docker.io/neo4j:4.4-enterprise",
}

for edition, image := range images {
edition, image := edition, image
t.Run(edition, func(t *testing.T) {
t.Parallel()
container, err := neo4j.RunContainer(ctx,
testcontainers.WithImage(image),
neo4j.WithAdminPassword(testPassword),
neo4j.WithAcceptCommercialLicenseAgreement(),
)
if err != nil {
t.Fatalf("expected container to successfully initialize but did not: %s", err)
}

t.Cleanup(func() {
if err := container.Terminate(ctx); err != nil {
t.Fatalf("failed to terminate container: %s", err)
}
})

env := getContainerEnv(t, ctx, container)

if !strings.Contains(env, "NEO4J_ACCEPT_LICENSE_AGREEMENT=yes") {
t.Fatal("expected to accept license agreement but did not")
}
})
}
}

func TestNeo4jWithWrongSettings(outer *testing.T) {
outer.Parallel()

Expand Down

0 comments on commit e05b2ab

Please sign in to comment.