Skip to content

Commit 62a65a4

Browse files
authored
fix(surrealdb): use true as value for WithAllowAllCaps option (testcontainers#3436)
1 parent daabf50 commit 62a65a4

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

modules/surrealdb/surrealdb.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func WithStrictMode() testcontainers.CustomizeRequestOption {
5858
// WithAllowAllCaps enables all caps for the SurrealDB instance
5959
func WithAllowAllCaps() testcontainers.CustomizeRequestOption {
6060
return func(req *testcontainers.GenericContainerRequest) error {
61-
return testcontainers.WithEnv(map[string]string{"SURREAL_CAPS_ALLOW_ALL": "false"})(req)
61+
return testcontainers.WithEnv(map[string]string{"SURREAL_CAPS_ALLOW_ALL": "true"})(req)
6262
}
6363
}
6464

modules/surrealdb/surrealdb_test.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package surrealdb
22

33
import (
44
"context"
5+
"strings"
56
"testing"
67

78
"github.com/stretchr/testify/require"
@@ -88,3 +89,21 @@ func TestSurrealDBWithAuth(t *testing.T) {
8889
require.Equal(t, "Morgan Hitchcock", resultData["name"].(map[string]any)["last"])
8990
require.Equal(t, true, resultData["marketing"])
9091
}
92+
93+
func TestSurrealDBWithAllowAllCaps(t *testing.T) {
94+
ctx := context.Background()
95+
96+
ctr, err := Run(ctx, "surrealdb/surrealdb:v1.1.1", WithAllowAllCaps())
97+
testcontainers.CleanupContainer(t, ctr)
98+
require.NoError(t, err)
99+
100+
inspect, err := ctr.Inspect(ctx)
101+
require.NoError(t, err)
102+
103+
for _, env := range inspect.Config.Env {
104+
if v, ok := strings.CutPrefix(env, "SURREAL_CAPS_ALLOW_ALL="); ok {
105+
require.Equal(t, "true", v)
106+
break
107+
}
108+
}
109+
}

0 commit comments

Comments
 (0)