Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add tcl test 2 #2497

Merged
merged 6 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion tests/assets/default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ thread-num : 1
# are dedicated to handling user requests.
thread-pool-size : 12

# Size of the low level thread pool, The threads within this pool
# are dedicated to handling slow user requests.
slow-cmd-thread-pool-size : 4

# Slow cmd list e.g. hgetall, mset
# slow-cmd-list :

# The number of sync-thread for data replication from master, those are the threads work on slave nodes
# and are used to execute commands sent from master node when replicating.
sync-thread-num : 6
Expand Down Expand Up @@ -221,6 +228,9 @@ slave-priority : 100
# [NOTICE]: compact-interval is prior than compact-cron.
#compact-interval :

# The disable_auto_compactions option is [true | false]
disable_auto_compactions : false

# The minimum disk usage ratio for checking resume.
# If the disk usage ratio is lower than min-check-resume-ratio, it will not check resume, only higher will check resume.
# Its default value is 0.7.
Expand Down Expand Up @@ -271,6 +281,7 @@ max-cache-statistic-keys : 0
# a small compact is triggered automatically if the small compaction feature is enabled.
# small-compaction-threshold default value is 5000 and the value range is [1, 100000].
small-compaction-threshold : 5000
small-compaction-duration-threshold : 10000

# The maximum total size of all live memtables of the RocksDB instance that owned by Pika.
# Flushing from memtable to disk will be triggered if the actual memory usage of RocksDB
Expand Down Expand Up @@ -434,7 +445,7 @@ cache-num : 16
# cache-model 0:cache_none 1:cache_read
cache-model : 1
# cache-type: string, set, zset, list, hash, bit
cache-type: string, set, zset, list, hash
cache-type: string, set, zset, list, hash, bit

# Maximum number of keys in the zset redis cache
# On the disk DB, a zset field may have many fields. In the memory cache, we limit the maximum
Expand Down Expand Up @@ -500,3 +511,18 @@ cache-lfu-decay-time: 1
#
# aclfile : ../conf/users.acl

# It is possible to change the name of dangerous commands in a shared environment.
# For instance the CONFIG command may be renamed into something Warning: To prevent
# data inconsistency caused by different configuration files, do not use the rename
# command to modify write commands on the primary and secondary servers. If necessary,
# ensure that the configuration files of the primary and secondary servers are consistent
# In addition, when using the command rename, you must not use "" to modify the command,
# for example, rename-command: FLUSHALL "360flushall" is incorrect; instead, use
# rename-command: FLUSHALL 360flushall is correct. After the rename command is executed,
# it is most appropriate to use a numeric string with uppercase or lowercase letters
# for example: rename-command : FLUSHALL joYAPNXRPmcarcR4ZDgC81TbdkSmLAzRPmcarcR
#
# Example:
#
# rename-command : FLUSHALL 360flushall
# rename-command : FLUSHDB 360flushdb
48 changes: 24 additions & 24 deletions tests/test_helper.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -13,45 +13,45 @@ source tests/support/util.tcl

set ::all_tests {
unit/printver
# unit/auth
# unit/protocol
# unit/basic
# unit/scan
# unit/type/list
unit/basic
unit/scan
unit/multi
unit/quit
unit/type/list
unit/pubsub
unit/slowlog
unit/maxmemory
unit/bitops
unit/hyperloglog
unit/type
unit/acl
unit/type/list-2
unit/type/list-3
unit/type/set
unit/type/zset
unit/type/string
# unit/type/hash
# unit/sort
unit/type/hash
# unit/expire
# unit/protocol
# unit/other
# unit/multi
# unit/quit
# unit/auth
# unit/sort
# unit/aofrw
# integration/replication
# integration/replication-2
# integration/replication-3
# integration/replication-4
# integration/replication-psync
# integration/aof
# integration/rdb
# integration/convert-zipmap-hash-on-load
# unit/pubsub
# unit/slowlog
# unit/scripting
unit/maxmemory
# unit/introspection
# unit/limits
# unit/obuf-limits
# unit/dump
# unit/bitops
# unit/memefficiency
# unit/hyperloglog
# unit/command
unit/type
unit/acl
# unit/tcl/replication
# unit/tcl/replication-2
# unit/tcl/replication-3
# unit/tcl/replication-4
# unit/tcl/replication-psync
# unit/tcl/aof
# unit/tcl/rdb
# unit/tcl/convert-zipmap-hash-on-load
}

# because the comment not works in tcl list, use regsub to ignore the item starting with '#'
Expand Down
58 changes: 29 additions & 29 deletions tests/unit/auth.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,38 @@ start_server {tags {"auth"}} {
}

start_server {tags {"auth"} overrides {requirepass foobar}} {
test {AUTH fails when a wrong password is given} {
catch {r auth wrong!} err
set _ $err
} {ERR*invalid password}

test {AUTH succeeds when the right password is given} {
r auth foobar
} {OK}
# test {AUTH fails when a wrong password is given} {
# catch {r auth wrong!} err
# set _ $err
# } {ERR*invalid password}

test {Once AUTH succeeded we can actually send commands to the server} {
r set foo 100
r incr foo
} {101}
# test {AUTH succeeds when the right password is given} {
# r auth foobar
# } {OK}
#
# test {Once AUTH succeeded we can actually send commands to the server} {
# r set foo 100
# r incr foo
# } {101}
}

start_server {tags {"auth"} overrides {userpass foobar}} {
test {AUTH fails when a wrong password is given} {
catch {r auth wrong!} err
set _ $err
} {ERR*invalid password}

test {Arbitrary command gives an error when AUTH is required} {
catch {r set foo bar} err
set _ $err
} {ERR*NOAUTH*}

test {AUTH succeeds when the right password is given} {
r auth foobar
} {OK}
# test {AUTH fails when a wrong password is given} {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

注释的这些用例,pika不兼容是吗

# catch {r auth wrong!} err
# set _ $err
# } {ERR*invalid password}
#
# test {Arbitrary command gives an error when AUTH is required} {
# catch {r set foo bar} err
# set _ $err
# } {ERR*NOAUTH*}

test {Once AUTH succeeded we can actually send commands to the server} {
r set foo 100
r incr foo
} {101}
# test {AUTH succeeds when the right password is given} {
# r auth foobar
# } {OK}
#
# test {Once AUTH succeeded we can actually send commands to the server} {
# r set foo 100
# r incr foo
# } {101}
}
Loading
Loading