Skip to content

Commit

Permalink
test: add redis test (OpenAtomFoundation#1357)
Browse files Browse the repository at this point in the history
Co-authored-by: liuzhen3 <[email protected]>
  • Loading branch information
kernelai and liuzhen3 authored May 6, 2023
1 parent d6d395e commit 4d07244
Show file tree
Hide file tree
Showing 64 changed files with 11,877 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
### Pika test

* 在Pika目录下执行 `./pikatests.sh geo` 测试Pika GEO命令
* 如果是`unit/type`接口, 例如 SET, 执行 `./pikatests.sh type/set` 测试Pika SET命令
79 changes: 79 additions & 0 deletions tests/assets/default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Pika port
port : 9221
# Thread Number
thread-num : 1
# Sync Thread Number
sync-thread-num : 6
# Item count of sync thread queue
sync-buffer-size : 10
# Pika log path
log-path : ./log/
# Pika glog level: only INFO and ERROR
loglevel : info
# Pika db path
db-path : ./db/
# Pika write-buffer-size
write-buffer-size : 268435456
# Pika timeout
timeout : 60
# Requirepass
requirepass :
# Masterauth
masterauth :
# Userpass
userpass :
# User Blacklist
userblacklist :
# Dump Prefix
dump-prefix :
# daemonize [yes | no]
#daemonize : yes
# slotmigrate [yes | no]
#slotmigrate : no
# Dump Path
dump-path : ./dump/
# Expire-dump-days
dump-expire : 0
# pidfile Path
pidfile : ./pika.pid
# Max Connection
maxclients : 20000
# the per file size of sst to compact, defalut is 2M
target-file-size-base : 20971520
# Expire-logs-days
expire-logs-days : 7
# Expire-logs-nums
expire-logs-nums : 10
# Root-connection-num
root-connection-num : 2
# Slowlog-log-slower-than
slowlog-log-slower-than : 10000
# slave-read-only(yes/no, 1/0)
slave-read-only : 0
# Pika db sync path
db-sync-path : ./dbsync/
# db sync speed(MB) max is set to 125MB, min is set to 0, and if below 0 or above 125, the value will be adjust to 125
db-sync-speed : -1
# network interface
# network-interface : eth1
# replication
# slaveof : master-ip:master-port
# CronTask, format: start:end-ratio, like 02-04/60, pika will check to schedule compaction between 2 to 4 o'clock everyday
# if the freesize/disksize > 60%
# compact-cron :

###################
## Critical Settings
###################
# binlog file size: default is 100M, limited in [1K, 2G]
binlog-file-size : 104857600
# Compression
compression : snappy
# max-background-flushes: default is 1, limited in [1, 4]
max-background-flushes : 1
# max-background-compactions: default is 1, limited in [1, 4]
max-background-compactions : 2
# max-cache-files default is 5000
max-cache-files : 5000
# max_bytes_for_level_multiplier: default is 10, you can change it to 5
max-bytes-for-level-multiplier : 10
Binary file added tests/assets/encodings.rdb
Binary file not shown.
Binary file added tests/assets/hash-zipmap.rdb
Binary file not shown.
10 changes: 10 additions & 0 deletions tests/helpers/bg_complex_data.tcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
source tests/support/redis.tcl
source tests/support/util.tcl

proc bg_complex_data {host port db ops} {
set r [redis $host $port]
$r select $db
createComplexDataset $r $ops
}

bg_complex_data [lindex $argv 0] [lindex $argv 1] [lindex $argv 2] [lindex $argv 3]
15 changes: 15 additions & 0 deletions tests/helpers/gen_write_load.tcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
source tests/support/redis.tcl

proc gen_write_load {host port seconds} {
set start_time [clock seconds]
set r [redis $host $port 1]
$r select 9
while 1 {
$r set [expr rand()] [expr rand()]
if {[clock seconds]-$start_time > $seconds} {
exit 0
}
}
}

gen_write_load [lindex $argv 0] [lindex $argv 1] [lindex $argv 2]
Loading

0 comments on commit 4d07244

Please sign in to comment.