-
Notifications
You must be signed in to change notification settings - Fork 638
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
REDIS::ADDED:: Implement tests for imhiredis module
- changed diag.sh to be able to start/stop/clean a redis server - added helper functions in diag.sh to be able to query a redis server instance - added new tests for imhiredis module to check - that the queue mode works, with both lpop and rpop - that the module is capable of handling a redis server going down - that the module is capable of handling a redis server that appears afterwards - that the subscribe mode works
- Loading branch information
Showing
14 changed files
with
502 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env bash | ||
# added 2023-04-20 by Théo Bertin, released under ASL 2.0 | ||
## Uncomment for debugging | ||
#export RS_REDIR=-d | ||
|
||
export USE_VALGRIND="YES" | ||
source ${srcdir:=.}/imhiredis-queue-lpop.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/usr/bin/env bash | ||
# added 2023-04-20 by Théo Bertin, released under ASL 2.0 | ||
## Uncomment for debugging | ||
#export RS_REDIR=-d | ||
|
||
. ${srcdir:=.}/diag.sh init | ||
|
||
start_redis | ||
|
||
redis_command "RPUSH mykey message1" | ||
redis_command "RPUSH mykey message2" | ||
redis_command "RPUSH mykey message3" | ||
|
||
generate_conf | ||
add_conf ' | ||
global(localhostname="server") | ||
module(load="../contrib/imhiredis/.libs/imhiredis") | ||
template(name="outfmt" type="string" string="%$/num% %msg%\n") | ||
input(type="imhiredis" | ||
server="127.0.0.1" | ||
port="'$REDIS_RANDOM_PORT'" | ||
key="mykey" | ||
mode="queue" | ||
uselpop="on" | ||
ruleset="redis") | ||
ruleset(name="redis") { | ||
set $/num = cnum($/num + 1); | ||
action(type="omfile" | ||
file="'$RSYSLOG_OUT_LOG'" | ||
template="outfmt") | ||
} | ||
action(type="omfile" file="'$RSYSLOG_OUT_LOG'" template="outfmt") | ||
' | ||
startup | ||
shutdown_when_empty | ||
wait_shutdown | ||
|
||
stop_redis | ||
|
||
# Same order | ||
content_check '1 message1' | ||
content_check '2 message2' | ||
content_check '3 message3' | ||
|
||
# Removes generated configuration file, log and pid files | ||
cleanup_redis | ||
|
||
exit_test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env bash | ||
# added 2023-04-20 by Théo Bertin, released under ASL 2.0 | ||
## Uncomment for debugging | ||
#export RS_REDIR=-d | ||
|
||
export USE_VALGRIND="YES" | ||
source ${srcdir:=.}/imhiredis-queue.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/usr/bin/env bash | ||
# added 2023-04-20 by Théo Bertin, released under ASL 2.0 | ||
## Uncomment for debugging | ||
#export RS_REDIR=-d | ||
|
||
. ${srcdir:=.}/diag.sh init | ||
|
||
start_redis | ||
|
||
redis_command "RPUSH mykey message1" | ||
redis_command "RPUSH mykey message2" | ||
redis_command "RPUSH mykey message3" | ||
|
||
generate_conf | ||
add_conf ' | ||
global(localhostname="server") | ||
module(load="../contrib/imhiredis/.libs/imhiredis") | ||
template(name="outfmt" type="string" string="%$/num% %msg%\n") | ||
input(type="imhiredis" | ||
server="127.0.0.1" | ||
port="'$REDIS_RANDOM_PORT'" | ||
key="mykey" | ||
mode="queue" | ||
ruleset="redis") | ||
ruleset(name="redis") { | ||
set $/num = cnum($/num + 1); | ||
action(type="omfile" | ||
file="'$RSYSLOG_OUT_LOG'" | ||
template="outfmt") | ||
} | ||
action(type="omfile" file="'$RSYSLOG_OUT_LOG'" template="outfmt") | ||
' | ||
startup | ||
shutdown_when_empty | ||
wait_shutdown | ||
|
||
stop_redis | ||
|
||
# Opposite order | ||
content_check '1 message3' | ||
content_check '2 message2' | ||
content_check '3 message1' | ||
|
||
# Removes generated configuration file, log and pid files | ||
cleanup_redis | ||
|
||
exit_test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env bash | ||
# added 2023-04-20 by Théo Bertin, released under ASL 2.0 | ||
## Uncomment for debugging | ||
#export RS_REDIR=-d | ||
|
||
export USE_VALGRIND="YES" | ||
source ${srcdir:=.}/imhiredis-redis-restart.sh |
Oops, something went wrong.