Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
picodata
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
core
picodata
Commits
fabde272
Commit
fabde272
authored
1 year ago
by
Egor Ivkov
Committed by
Егор Ивков
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
test: submit sql after revoke login
parent
e958fdcd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!851
fix: panic after revoke login
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/int/test_acl.py
+33
-0
33 additions, 0 deletions
test/int/test_acl.py
with
33 additions
and
0 deletions
test/int/test_acl.py
+
33
−
0
View file @
fabde272
...
...
@@ -1067,5 +1067,38 @@ def test_alter_system_user(cluster: Cluster):
i1
.
sql
(
'
drop role
"
public
"'
)
def
test_submit_sql_after_revoke_login
(
cluster
:
Cluster
):
i1
,
*
_
=
cluster
.
deploy
(
instance_count
=
1
)
acl
=
i1
.
sudo_sql
(
"
create user
\"
alice
\"
with password
'
12345678
'"
)
assert
acl
[
"
row_count
"
]
==
1
acl
=
i1
.
sudo_sql
(
'
grant create table to
"
alice
"'
)
assert
acl
[
"
row_count
"
]
==
1
with
i1
.
connect
(
timeout
=
2
,
user
=
"
alice
"
,
password
=
"
12345678
"
)
as
conn
:
ddl
=
conn
.
sql
(
"""
create table t (a int not null, primary key (a)) distributed by (a)
"""
,
)
assert
ddl
[
"
row_count
"
]
==
1
# alice is the owner thus has all privileges on t
dml
=
conn
.
sql
(
"
insert into t values(1);
"
)
assert
dml
[
"
row_count
"
]
==
1
# admin revokes login privilege
acl
=
i1
.
sudo_sql
(
'
alter user
"
alice
"
with nologin
'
)
assert
acl
[
"
row_count
"
]
==
1
# alice on the same connection should receive error that access is denied
with
pytest
.
raises
(
Exception
,
match
=
"
Create access to space
'
T
'
is denied for user
'
Dave
'"
,
):
conn
.
sql
(
"
insert into t values(2);
"
)
# TODO: test acl get denied when there's an unfinished ddl
# TODO: check various retryable cas outcomes when doing schema change requests
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment