Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
0666267d
Unverified
Commit
0666267d
authored
Sep 09, 2020
by
杨博东
Committed by
GitHub
Sep 09, 2020
Browse files
Tests: Add aclfile load and save tests (#7765)
improves test coverage
parent
042189fd
Changes
2
Hide whitespace changes
Inline
Side-by-side
tests/assets/user.acl
0 → 100644
View file @
0666267d
user alice on allcommands allkeys >alice
user bob on -@all +@set +acl ~set* >bob
\ No newline at end of file
tests/unit/acl.tcl
View file @
0666267d
...
...
@@ -261,3 +261,42 @@ start_server {tags {"acl"}} {
assert_match
"*Unknown subcommand or wrong number of arguments*"
$e
}
}
set server_path
[
tmpdir
"server.acl"
]
exec cp -f tests/assets/user.acl $server_path
start_server
[
list overrides
[
list
"dir"
$server_path
"aclfile"
"user.acl"
]]
{
# user alice on allcommands allkeys >alice
# user bob on -@all +@set +acl ~set* >bob
test
"Alice: can excute all command"
{
r AUTH alice alice
assert_equal
"alice"
[
r acl whoami
]
r SET key value
}
test
"Bob: just excute @set and acl command"
{
r AUTH bob bob
assert_equal
"bob"
[
r acl whoami
]
assert_equal
"3"
[
r sadd set 1 2 3
]
catch
{
r SET key value
}
e
set e
}
{
*NOPERM*
}
test
"ACL load and save"
{
r ACL setuser eve +get allkeys >eve on
r ACL save
# ACL load will free user and kill clients
r ACL load
catch
{
r ACL LIST
}
e
assert_match
{
*I/O error*
}
$e
reconnect
r AUTH alice alice
r SET key value
r AUTH eve eve
r GET key
catch
{
r SET key value
}
e
set e
}
{
*NOPERM*
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment