added test for message acking.

This commit is contained in:
gardners 2013-05-10 12:11:38 +09:30
parent fad28fbe55
commit dfcd35143e

View File

@ -111,4 +111,40 @@ test_twoPly() {
assertStdoutGrep --stdout --stderr --matches=1 '^1:.*:unacknowledged:meshms:Message-2b'
}
doc_ack="Acking messages works"
setup_ack() {
setup
}
test_ack() {
executeOk_servald meshms add message 12345 67890 $SIDA1 $SIDA2 "Message-1a"
executeOk_servald rhizome list
assert_rhizome_list --fromhere=1 --author=$SIDA1 ''
executeOk_servald meshms add message 12345 67890 $SIDA2 $SIDA1 "Message-2b"
executeOk_servald meshms list messages $SIDA1 $SIDA1
assertStdoutLineCount '==' 2
executeOk_servald meshms list messages $SIDA2 $SIDA2
assertStdoutLineCount '==' 2
executeOk_servald meshms list messages $SIDA1 $SIDA2
assertStdoutLineCount '==' 4
assertStdoutGrep --stdout --stderr --matches=1 '^0:.*:received:meshms:Message-2b'
assertStdoutGrep --stdout --stderr --matches=1 '^1:.*:unacknowledged:meshms:Message-1a'
executeOk_servald meshms list messages $SIDA2 $SIDA1
assertStdoutLineCount '==' 4
assertStdoutGrep --stdout --stderr --matches=1 '^0:.*:received:meshms:Message-1a'
assertStdoutGrep --stdout --stderr --matches=1 '^1:.*:unacknowledged:meshms:Message-2b'
executeOk_servald meshms ack messages $SIDA1 $SIDA2 1
assertStdoutGrep --stdout --stderr --matches=1 'filesize:35'
executeOk_servald meshms ack messages $SIDA1 $SIDA2 1
assertStdoutGrep --stdout --stderr --matches=0 'filesize:'
executeOk_servald meshms ack messages $SIDA1 $SIDA2 0
assertStdoutGrep --stdout --stderr --matches=0 'filesize:'
executeOk_servald meshms ack messages $SIDA1 $SIDA2 28
assertStdoutGrep --stdout --stderr --matches=1 'filesize:42'
executeOk_servald meshms list messages $SIDA2 $SIDA1
assertStdoutLineCount '==' 4
assertStdoutGrep --stdout --stderr --matches=1 '^0:.*:received:meshms:Message-1a'
assertStdoutGrep --stdout --stderr --matches=1 '^1:.*:delivered:meshms:Message-2b'
}
runTests "$@"