diff --git a/modules/surrealdb/surrealdb.go b/modules/surrealdb/surrealdb.go index f5fc94176d..7be329986d 100644 --- a/modules/surrealdb/surrealdb.go +++ b/modules/surrealdb/surrealdb.go @@ -58,7 +58,7 @@ func WithStrictMode() testcontainers.CustomizeRequestOption { // WithAllowAllCaps enables all caps for the SurrealDB instance func WithAllowAllCaps() testcontainers.CustomizeRequestOption { return func(req *testcontainers.GenericContainerRequest) error { - return testcontainers.WithEnv(map[string]string{"SURREAL_CAPS_ALLOW_ALL": "false"})(req) + return testcontainers.WithEnv(map[string]string{"SURREAL_CAPS_ALLOW_ALL": "true"})(req) } } diff --git a/modules/surrealdb/surrealdb_test.go b/modules/surrealdb/surrealdb_test.go index 4bc12a6f60..5fea379ed0 100644 --- a/modules/surrealdb/surrealdb_test.go +++ b/modules/surrealdb/surrealdb_test.go @@ -2,6 +2,7 @@ package surrealdb import ( "context" + "strings" "testing" "github.com/stretchr/testify/require" @@ -88,3 +89,21 @@ func TestSurrealDBWithAuth(t *testing.T) { require.Equal(t, "Morgan Hitchcock", resultData["name"].(map[string]any)["last"]) require.Equal(t, true, resultData["marketing"]) } + +func TestSurrealDBWithAllowAllCaps(t *testing.T) { + ctx := context.Background() + + ctr, err := Run(ctx, "surrealdb/surrealdb:v1.1.1", WithAllowAllCaps()) + testcontainers.CleanupContainer(t, ctr) + require.NoError(t, err) + + inspect, err := ctr.Inspect(ctx) + require.NoError(t, err) + + for _, env := range inspect.Config.Env { + if v, ok := strings.CutPrefix(env, "SURREAL_CAPS_ALLOW_ALL="); ok { + require.Equal(t, "true", v) + break + } + } +}