summaryrefslogtreecommitdiff
path: root/tests/integration
diff options
context:
space:
mode:
authormeir@redislabs.com <meir@redislabs.com>2021-10-07 14:41:26 +0300
committermeir <meir@redis.com>2021-12-02 19:35:52 +0200
commitcbd463175f8b52d594fd4e6b953fa58a5db053c3 (patch)
tree2b2e4080b6b4d399eaa3053928f0193f5ddbb360 /tests/integration
parentf21dc38a6ed3851a5e6501199e803ff0b93795cf (diff)
downloadredis-cbd463175f8b52d594fd4e6b953fa58a5db053c3.tar.gz
Redis Functions - Added redis function unit and Lua engine
Redis function unit is located inside functions.c and contains Redis Function implementation: 1. FUNCTION commands: * FUNCTION CREATE * FCALL * FCALL_RO * FUNCTION DELETE * FUNCTION KILL * FUNCTION INFO 2. Register engine In addition, this commit introduce the first engine that uses the Redis Function capabilities, the Lua engine.
Diffstat (limited to 'tests/integration')
-rw-r--r--tests/integration/replication.tcl19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/integration/replication.tcl b/tests/integration/replication.tcl
index fe4adbe93..1332c8380 100644
--- a/tests/integration/replication.tcl
+++ b/tests/integration/replication.tcl
@@ -521,6 +521,12 @@ foreach testType {Successful Aborted} {
# Set a key value on replica to check status during loading, on failure and after swapping db
$replica set mykey myvalue
+ # Set a function value on replica to check status during loading, on failure and after swapping db
+ $replica function create LUA test {return 'hello1'}
+
+ # Set a function value on master to check it reaches the replica when replication ends
+ $master function create LUA test {return 'hello2'}
+
# Force the replica to try another full sync (this time it will have matching master replid)
$master multi
$master client kill type replica
@@ -552,6 +558,9 @@ foreach testType {Successful Aborted} {
# Ensure we still see old values while async_loading is in progress and also not LOADING status
assert_equal [$replica get mykey] "myvalue"
+ # Ensure we still can call old function while async_loading is in progress
+ assert_equal [$replica fcall test 0] "hello1"
+
# Make sure we're still async_loading to validate previous assertion
assert_equal [s -1 async_loading] 1
@@ -576,6 +585,9 @@ foreach testType {Successful Aborted} {
# Ensure we see old values from replica
assert_equal [$replica get mykey] "myvalue"
+ # Ensure we still can call old function
+ assert_equal [$replica fcall test 0] "hello1"
+
# Make sure amount of replica keys didn't change
assert_equal [$replica dbsize] 2001
}
@@ -595,6 +607,9 @@ foreach testType {Successful Aborted} {
# Ensure we don't see anymore the key that was stored only to replica and also that we don't get LOADING status
assert_equal [$replica GET mykey] ""
+ # Ensure we got the new function
+ assert_equal [$replica fcall test 0] "hello2"
+
# Make sure amount of keys matches master
assert_equal [$replica dbsize] 1010
}
@@ -624,6 +639,10 @@ test {diskless loading short read} {
$replica config set dynamic-hz no
# Try to fill the master with all types of data types / encodings
set start [clock clicks -milliseconds]
+
+ # Set a function value to check short read handling on functions
+ r function create LUA test {return 'hello1'}
+
for {set k 0} {$k < 3} {incr k} {
for {set i 0} {$i < 10} {incr i} {
r set "$k int_$i" [expr {int(rand()*10000)}]