mirror of
https://github.com/icewind1991/notify-redis.git
synced 2026-06-03 18:24:12 +02:00
adjust test to new output format
This commit is contained in:
parent
e8d0383762
commit
80e8483eb4
1 changed files with 6 additions and 6 deletions
12
test.sh
12
test.sh
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
function assert_notify {
|
||||
actual="$(redis-cli rpop notify)"
|
||||
actual="$(echo $(redis-cli rpop notify) | sed -e 's/,\"time\":[^Z]*Z\"//g')" # strip time
|
||||
if [ "$actual" != "$1" ]
|
||||
then
|
||||
echo "'$actual' not equal to expected '$1'"
|
||||
|
|
@ -26,13 +26,13 @@ sleep 1
|
|||
echo foo > test/foo.txt
|
||||
sleep 2
|
||||
|
||||
assert_notify "write|$(pwd)/test/foo.txt"
|
||||
assert_notify "{\"event\":\"modify\",\"path\":\"$(pwd)/test/foo.txt\"}"
|
||||
assert_notify ''
|
||||
|
||||
mv test/foo.txt test/bar.txt
|
||||
sleep 2
|
||||
|
||||
assert_notify "rename|$(pwd)/test/foo.txt|$(pwd)/test/bar.txt"
|
||||
assert_notify "{\"event\":\"move\",\"from\":\"$(pwd)/test/foo.txt\",\"to\":\"$(pwd)/test/bar.txt\"}"
|
||||
assert_notify ""
|
||||
|
||||
rm test/bar.txt
|
||||
|
|
@ -40,7 +40,7 @@ echo asd > test/bar.txt
|
|||
|
||||
sleep 2
|
||||
|
||||
assert_notify "write|$(pwd)/test/bar.txt"
|
||||
assert_notify "{\"event\":\"modify\",\"path\":\"$(pwd)/test/bar.txt\"}"
|
||||
assert_notify ""
|
||||
|
||||
rm test/bar.txt
|
||||
|
|
@ -49,8 +49,8 @@ echo asd > test/bar.txt
|
|||
|
||||
sleep 2
|
||||
|
||||
assert_notify "remove|$(pwd)/test/bar.txt"
|
||||
assert_notify "write|$(pwd)/test/bar.txt"
|
||||
assert_notify "{\"event\":\"delete\",\"path\":\"$(pwd)/test/bar.txt\"}"
|
||||
assert_notify "{\"event\":\"modify\",\"path\":\"$(pwd)/test/bar.txt\"}"
|
||||
assert_notify ""
|
||||
|
||||
killall $(basename $bin)
|
||||
Loading…
Add table
Add a link
Reference in a new issue