ngircd

Free, portable and lightweight Internet Relay Chat server http://ngircd.barton.de/
Log | Files | Refs | README | LICENSE

commit afb59ab8e5ccf5d48c78dab53e8ec64d21829a8d
parent d90f0323e5c2574f10b0445901f731c4c892b6ac
Author: Alexander Barton <alex@barton.de>
Date:   Wed, 30 Dec 2015 17:10:26 +0100

Test suite: Add new test for server-server logins

This test detects the recent NJOIN breakage, for example ...

Diffstat:
M.gitignore | 1+
Msrc/testsuite/Makefile.ng | 6++++++
Msrc/testsuite/ngircd-test1.conf | 5+++++
Asrc/testsuite/server-login-test.e | 94+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 106 insertions(+), 0 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -56,6 +56,7 @@ src/testsuite/ngircd-test2.log src/testsuite/ngircd-test2.motd src/testsuite/opless-channel-test src/testsuite/server-link-test +src/testsuite/server-login-test src/testsuite/T-ngircd1 src/testsuite/T-ngircd1.exe src/testsuite/T-ngircd2 diff --git a/src/testsuite/Makefile.ng b/src/testsuite/Makefile.ng @@ -21,6 +21,7 @@ EXTRA_DIST = \ join-test.e kick-test.e message-test.e misc-test.e mode-test.e \ opless-channel-test.e server-link-test.e who-test.e whois-test.e \ stress-A.e stress-B.e \ + server-login-test.e \ start-server1 stop-server1 ngircd-test1.conf \ start-server2 stop-server2 ngircd-test2.conf @@ -81,6 +82,10 @@ server-link-test: tests.sh rm -f server-link-test ln -s $(srcdir)/tests.sh server-link-test +server-login-test: tests.sh + rm -f server-login-test + ln -s $(srcdir)/tests.sh server-login-test + who-test: tests.sh rm -f who-test ln -s $(srcdir)/tests.sh who-test @@ -103,6 +108,7 @@ TESTS = start-server1 \ who-test \ whois-test \ server-link-test \ + server-login-test \ stop-server2 \ stress-server.sh \ stop-server1 diff --git a/src/testsuite/ngircd-test1.conf b/src/testsuite/ngircd-test1.conf @@ -29,6 +29,11 @@ MyPassword = pwd1 PeerPassword = pwd2 +[Server] + Name = ngircd.test.server3 + MyPassword = pwd1 + PeerPassword = pwd3 + [Channel] Name = InviteChannel Modes = i diff --git a/src/testsuite/server-login-test.e b/src/testsuite/server-login-test.e @@ -0,0 +1,94 @@ +# ngIRCd test suite +# server-server login test + +spawn telnet 127.0.0.1 6789 +expect { + timeout { exit 1 } + "Connected" +} + +# Register server +send "PASS pwd1 0210-IRC+ ngIRCd|testsuite0:CHLMSX P\r" +send "SERVER ngircd.test.server3 :Testsuite Server Emulation\r" +expect { + timeout { exit 1 } + ":ngircd.test.server PASS pwd3 0210-IRC+ ngIRCd|" +} +expect { + timeout { exit 1 } + ":ngircd.test.server SERVER ngircd.test.server 1 :" +} +expect { + timeout { exit 1 } + ":ngircd.test.server 005 " +} +expect { + timeout { exit 1 } + ":ngircd.test.server 376 " +} + +# End of handshake +send ":ngircd.test.server3 376 ngircd.test.server :End of MOTD command\r" + +# Receive existing channels +expect { + timeout { exit 1 } + ":ngircd.test.server CHANINFO +ModelessChannel +P :A modeless Channel" +} +expect { + timeout { exit 1 } + ":ngircd.test.server CHANINFO #SecretChannel +Ps :A secret Channel" +} +expect { + timeout { exit 1 } + ":ngircd.test.server CHANINFO #TopicChannel +Pt :the topic" +} +expect { + timeout { exit 1 } + ":ngircd.test.server CHANINFO #FullKeyed +Plk Secret 0 :" +} +expect { + timeout { exit 1 } + ":ngircd.test.server CHANINFO #InviteChannel +Pi" +} +expect { + timeout { exit 1 } + ":ngircd.test.server PING :ngircd.test.server" +} + +# Emulate network burst +send ":ngircd.test.server3 NICK NickName 1 ~User localhost 1 + :Real Name\r" +send ":ngircd.test.server3 NJOIN #Channel :@NickName\r" + +# End of burst +send ":ngircd.test.server3 PONG :ngircd.test.server\r" + +# Test server-server link ... +send ":ngircd.test.server3 VERSION\r" +expect { + timeout { exit 1 } + ":ngircd.test.server 351 ngircd.test.server3 " +} + +# Make sure our test client is still known in the network +send ":ngircd.test.server3 WHOIS NickName\r" +expect { + timeout { exit 1 } + ":ngircd.test.server 311 ngircd.test.server3 NickName ~User localhost * :Real Name" +} +expect { + timeout { exit 1 } + ":ngircd.test.server 319 ngircd.test.server3 NickName :@#Channel" +} + +expect { + timeout { exit 1 } + ":ngircd.test.server 318 ngircd.test.server3 NickName :" +} + +# Logout +send ":ngircd.test.server3 QUIT\r" +expect { + timeout { exit 1 } + "ERROR :Closing connection" +}