commit afb59ab8e5ccf5d48c78dab53e8ec64d21829a8d from: Alexander Barton date: Wed Dec 30 16:10:26 2015 UTC Test suite: Add new test for server-server logins This test detects the recent NJOIN breakage, for example ... commit - d90f0323e5c2574f10b0445901f731c4c892b6ac commit + afb59ab8e5ccf5d48c78dab53e8ec64d21829a8d blob - e8b9f315acef97233d356234785969dc25e4ebdf blob + e9b186ab9295319a7d8602a7efcc6adfe8805f4d --- .gitignore +++ .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 blob - d929592fca334f340bd59fe35708ea69417a33fa blob + 96d37f19a526885f20e1a29922a37c1a4f83b50b --- src/testsuite/Makefile.ng +++ 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 blob - 4dec5330ecc680ecae6c44f9008a2c5546417724 blob + 5cb7db7c7ad45dab1c4fc28e80e8527eb1872e8b --- src/testsuite/ngircd-test1.conf +++ 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 blob - /dev/null blob + b5226a7d530ad272aceb8efc7943f2b5e95d9fc3 (mode 644) --- /dev/null +++ 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" +}