Test suite: Add new test for server-server logins
authorAlexander Barton <alex@barton.de>
Wed, 30 Dec 2015 16:10:26 +0000 (17:10 +0100)
committerAlexander Barton <alex@barton.de>
Wed, 30 Dec 2015 16:10:26 +0000 (17:10 +0100)
This test detects the recent NJOIN breakage, for example ...

.gitignore
src/testsuite/Makefile.ng
src/testsuite/ngircd-test1.conf
src/testsuite/server-login-test.e [new file with mode: 0644]

index e8b9f31..e9b186a 100644 (file)
@@ -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
index d929592..96d37f1 100644 (file)
@@ -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
index 4dec533..5cb7db7 100644 (file)
        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
new file mode 100644 (file)
index 0000000..b5226a7
--- /dev/null
@@ -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"
+}