Skip to content

Commit

Permalink
fix: test
Browse files Browse the repository at this point in the history
  • Loading branch information
hperl committed Jun 27, 2024
1 parent 35c00e1 commit 7f07468
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions internal/check/engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ func TestEngine(t *testing.T) {
}
})

t.Run("case=bug repro rewrite_and_traversal", func(t *testing.T) {
t.Run("case=rewrite_and_traversal with depth", func(t *testing.T) {
t.Parallel()

for _, tc := range []struct {
Expand All @@ -590,7 +590,9 @@ func TestEngine(t *testing.T) {
t.Run("opl="+tc.name, func(t *testing.T) {
t.Parallel()

reg := driver.NewSqliteTestRegistry(t, false, driver.WithOPL(RewriteAndTraversalConfig))
reg := driver.NewSqliteTestRegistry(t, false,
driver.WithConfig(config.KeyLimitMaxReadDepth, 10),
driver.WithOPL(RewriteAndTraversalConfig))

insertFixtures(t, reg.RelationTupleManager(), []string{
"Group:g#supers@SuperUsers:super",
Expand All @@ -601,13 +603,17 @@ func TestEngine(t *testing.T) {

e := check.NewEngine(reg)

res, err := e.CheckIsMember(ctx, tupleFromString(t, "Comment:c#delete@User:u"), 10)
require.NoError(t, err)
assert.True(t, res)
t.Run("case=enough depth", func(t *testing.T) {
res, err := e.CheckIsMember(ctx, tupleFromString(t, "Comment:c#update@User:u"), 6)
require.NoError(t, err)
assert.True(t, res)
})

res, err = e.CheckIsMember(ctx, tupleFromString(t, "Comment:c#update@User:u"), 10)
require.NoError(t, err)
assert.True(t, res)
t.Run("case=not enough depth", func(t *testing.T) {
res, err := e.CheckIsMember(ctx, tupleFromString(t, "Comment:c#update@User:u"), 5)
require.NoError(t, err)
assert.False(t, res)
})
})
}
})
Expand Down

0 comments on commit 7f07468

Please sign in to comment.