From 81872b99bf1f9d4ce45cfe42ea8cb6acd8075c33 Mon Sep 17 00:00:00 2001 From: Viktor Tsapovskiy Date: Sun, 21 Dec 2025 11:39:14 +0300 Subject: [PATCH] tests: fix tests Grant and Revoke NoSu Fixed box/testdata/config.lua. Now, tests follow new Tarantool behavior (revoke 'grant' and 'revoke' privileges from 'super'). Closes #511 --- box/tarantool_test.go | 20 +++++++++++++------- box/testdata/config.lua | 3 +++ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/box/tarantool_test.go b/box/tarantool_test.go index ae47932d8..bb04e5382 100644 --- a/box/tarantool_test.go +++ b/box/tarantool_test.go @@ -529,14 +529,20 @@ func TestSchemaUser_Revoke_WithoutSu(t *testing.T) { err = b.Schema().User().Create(ctx, username, box.UserCreateOptions{Password: password}) require.NoError(t, err) + startPrivileges, err := b.Schema().User().Info(ctx, username) + require.NoError(t, err) + + require.NotEmpty(t, startPrivileges) + // Let's choose random first privilege. + examplePriv := startPrivileges[0] + // Can`t revoke without su permissions. - err = b.Schema().User().Grant(ctx, username, box.Privilege{ - Permissions: []box.Permission{ - box.PermissionRead, - }, - Type: box.PrivilegeSpace, - Name: "space1", - }, box.UserGrantOptions{IfNotExists: false}) + err = b.Schema().User().Revoke(ctx, + username, + examplePriv, + box.UserRevokeOptions{ + IfExists: false, + }) require.Error(t, err) // Require that error code is ER_ACCESS_DENIED. diff --git a/box/testdata/config.lua b/box/testdata/config.lua index 3d0db6acb..9301ca0ee 100644 --- a/box/testdata/config.lua +++ b/box/testdata/config.lua @@ -9,6 +9,9 @@ box.schema.space.create('space1') box.schema.user.create('test', { password = 'test' , if_not_exists = true }) box.schema.user.grant('test', 'super', nil, nil, { if_not_exists = true }) +-- revoke grant privileges to keep backward compatibility. +box.schema.user.revoke('test', 'grant,metagrant', nil, nil, { if_not_exists = true }) + -- Set listen only when every other thing is configured. box.cfg{ listen = os.getenv("TEST_TNT_LISTEN"),