From abb239118617c6b0f1c42dcaa534f3cdc03843ce Mon Sep 17 00:00:00 2001
From: Egor Ivkov <e.o.ivkov@gmail.com>
Date: Thu, 12 Dec 2024 23:10:08 +0300
Subject: [PATCH] test: role and user limits

---
 test/int/test_limits.py | 52 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)
 create mode 100644 test/int/test_limits.py

diff --git a/test/int/test_limits.py b/test/int/test_limits.py
new file mode 100644
index 0000000000..e52f5f5f94
--- /dev/null
+++ b/test/int/test_limits.py
@@ -0,0 +1,52 @@
+import pytest
+from conftest import Cluster, TarantoolError
+
+max_picodata_users = 26
+
+def test_user_limit(cluster: Cluster):
+    cluster.deploy(instance_count=2)
+    i1, i2 = cluster.instances
+
+    password = "Passw0rd"
+
+    for i in range(max_picodata_users):
+        username = f"USER{i}"
+
+        acl = i1.sql(
+            f"""
+            create user {username} with password '{password}'
+            using md5 option (timeout = 3)
+            """
+        )
+        assert acl["row_count"] == 1
+
+    # FIXME: should not panic, should be an error instead
+    with pytest.raises(
+        TarantoolError,
+        match="a limit on the total number of users has been reached: 32",
+    ):
+        username = f"USER{max_picodata_users}"
+        i1.sql(
+            f"""
+            create user {username} with password '{password}'
+            using md5
+            """
+        )
+
+def test_role_limit(cluster: Cluster):
+    cluster.deploy(instance_count=2)
+    i1, i2 = cluster.instances
+
+    for i in range(max_picodata_users):
+        role = f"ROLE{i}"
+
+        acl = i1.sql(f"create role {role}")
+        assert acl["row_count"] == 1
+
+    # FIXME: should not panic, should be an error instead
+    with pytest.raises(
+        TarantoolError,
+        match="a limit on the total number of users has been reached: 32",
+    ):
+        role = f"ROLE{max_picodata_users}"
+        i1.sql(f"create role {role}")
-- 
GitLab