Skip to content

Commit

Permalink
Additional tests
Browse files Browse the repository at this point in the history
- Move packet merging test from 05-areafix... to 03-crashmail....
- Added routing test.
  • Loading branch information
Lars Kellogg-Stedman committed Feb 11, 2013
1 parent fde598f commit 927631d
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 11 deletions.
36 changes: 36 additions & 0 deletions tests/03-crashmail-test.sh
Expand Up @@ -14,12 +14,15 @@ after () {
clean_tmpfile
}

# Verify that crashmail runs without error.
it_runs_successfully () {
$__crashmail__ | tee $tmpfile
grep '^CrashMail II .* started successfully' $tmpfile
grep '^CrashMail end' $tmpfile
}

# Verify that inbound mail is tossed into the
# netmail area.
it_tosses_netmail_successfully () {
echo This is a test netmail message. |
$__tools__/crashwrite dir spool/inbound \
Expand All @@ -33,6 +36,8 @@ it_tosses_netmail_successfully () {
test -f areas/netmail/2.msg
}

# Verify that inbound echomail is tossed into
# the appropriate area.
it_tosses_echos_successfully () {
echo This is a test netmail message. |
$__tools__/crashwrite dir spool/inbound \
Expand All @@ -47,6 +52,8 @@ it_tosses_echos_successfully () {
test -f areas/testarea/2.msg
}

# Verify that echomail from unlinked nodes is
# tossed into the BAD area.
it_handles_bad_packets_successfully () {
echo This is a test netmail message. |
$__tools__/crashwrite dir spool/inbound \
Expand All @@ -61,6 +68,8 @@ it_handles_bad_packets_successfully () {
test -f areas/bad/2.msg
}

# Verify that crashmail detects and filters
# out duplicate messages.
it_detects_dupes_successfully () {
mkdir spool/temp/newpacket

Expand All @@ -81,3 +90,30 @@ it_detects_dupes_successfully () {
grep 'Duplicate message in testarea' $tmpfile
}


# This catches a problem in which appending new messages to a packet
# resulted in an invalid packet size.
it_merges_packets () {
$__crashmail__ sendinfo 99:99/99
$__crashmail__ sendlist 99:99/99

size=$(wc -c < spool/outbound/00630063.out)
[ "$size" -eq 971 ]
}

# This checks that crashmail can HUB route packets correctly.
# The node 88:99/99 matches the following ROUTE line in the
# test configuration:
#
# ROUTE "88:*/*" HUB 99:99/1
#
# Mail to 88:99/1 should go to the network HOST (88:99/0)
# but mail to 88:99/99 should go to the HUB, 88:99/2.
it_routes_packets () {
$__crashmail__ sendinfo 88:99/1
test -f spool/outbound.058/00630000.out

$__crashmail__ sendinfo 88:99/99
test -f spool/outbound.058/00630002.out
}

10 changes: 0 additions & 10 deletions tests/05-areafix-test.sh
Expand Up @@ -46,13 +46,3 @@ it_subscribes_node () {
grep '^EXPORT .* 99:99/88.0' crashmail.prefs
}

# This catches a problem in which appending new messages to a packet
# resulted in an invalid packet size.
it_builds_packets () {
$__crashmail__ sendinfo 99:99/99
$__crashmail__ sendlist 99:99/99

size=$(wc -c < spool/outbound/00630063.out)
[ "$size" -le 1024 ]
}

11 changes: 10 additions & 1 deletion tests/crashmail.prefs
Expand Up @@ -35,6 +35,15 @@ NODE 99:99/999 "ZIP" ""
DEFAULTGROUP A
AREAFIXINFO "TESTPASS" "A" "" ""

NODE 88:99/1 "ZIP" ""
DEFAULTGROUP A
AREAFIXINFO "TESTPASS" "A" "" ""

NODE 88:99/99 "ZIP" ""
DEFAULTGROUP A
AREAFIXINFO "TESTPASS" "A" "" ""

ROUTE "88:*/*" HUB 99:99/1
ROUTE "*:*/*" NODE 99:99/1
BOUNCE "1:*/*.*" "2:*/*.*" "3:*/*.*" "4:*/*.*" "5:*/*.*" "6:*/*.*"

Expand All @@ -46,5 +55,5 @@ JAM_QUICKLINK
NETMAIL "NETMAIL" 99:99/1 MSG "areas/netmail"
AREA "BAD" 99:99/1 MSG "areas/bad"
AREA "TESTAREA" 99:99/1.0 MSG "areas/testarea"
EXPORT 99:99/99.0 99:99/999.0
EXPORT 99:99/99.0 99:99/999.0 88:99/99
GROUP A

0 comments on commit 927631d

Please sign in to comment.