diff --git a/internal/check/engine_test.go b/internal/check/engine_test.go index 4abd81ce9..c79a999a8 100644 --- a/internal/check/engine_test.go +++ b/internal/check/engine_test.go @@ -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 { @@ -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", @@ -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) + }) }) } })