>From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: "F. Jason Park" Date: Thu, 30 Sep 2021 03:28:54 -0700 Subject: [PATCH 23/34] SQUASH-ME: Add ERC test scenarios for identity-aware autojoin XXX this commit should not stand alone. It should be squashed or fixup'd into "Favor network IDs and networks in erc-join.el" --- .../join/legacy/foonet.eld | 38 +++ .../join/network-id/barnet.eld | 43 ++++ .../join/network-id/foonet-again.eld | 46 ++++ .../join/network-id/foonet.eld | 39 +++ .../join/reconnect/foonet-again.eld | 45 ++++ .../join/reconnect/foonet.eld | 45 ++++ test/lisp/erc/erc-scenarios.el | 238 +++++++++++++++++- 7 files changed, 493 insertions(+), 1 deletion(-) create mode 100644 test/lisp/erc/erc-scenarios-resources/join/legacy/foonet.eld create mode 100644 test/lisp/erc/erc-scenarios-resources/join/network-id/barnet.eld create mode 100644 test/lisp/erc/erc-scenarios-resources/join/network-id/foonet-again.eld create mode 100644 test/lisp/erc/erc-scenarios-resources/join/network-id/foonet.eld create mode 100644 test/lisp/erc/erc-scenarios-resources/join/reconnect/foonet-again.eld create mode 100644 test/lisp/erc/erc-scenarios-resources/join/reconnect/foonet.eld diff --git a/test/lisp/erc/erc-scenarios-resources/join/legacy/foonet.eld b/test/lisp/erc/erc-scenarios-resources/join/legacy/foonet.eld new file mode 100644 index 0000000000..344ba7c1da --- /dev/null +++ b/test/lisp/erc/erc-scenarios-resources/join/legacy/foonet.eld @@ -0,0 +1,38 @@ +;; -*- mode: lisp-data; -*- +((pass 1 "PASS :changeme")) +((nick 1 "NICK tester")) +((user 1 "USER user 0 * :tester") + (0 ":irc.foonet.org 001 tester :Welcome to the foonet IRC Network tester") + (0 ":irc.foonet.org 002 tester :Your host is irc.foonet.org, running version oragono-2.6.0-7481bf0385b95b16") + (0 ":irc.foonet.org 003 tester :This server was created Tue, 04 May 2021 05:06:18 UTC") + (0 ":irc.foonet.org 004 tester irc.foonet.org oragono-2.6.0-7481bf0385b95b16 BERTZios CEIMRUabefhiklmnoqstuv Iabefhkloqv") + (0 ":irc.foonet.org 005 tester AWAYLEN=390 BOT=B CASEMAPPING=ascii CHANLIMIT=#:100 CHANMODES=Ibe,k,fl,CEMRUimnstu CHANNELLEN=64 CHANTYPES=# ELIST=U EXCEPTS EXTBAN=,m FORWARD=f INVEX KICKLEN=390 :are supported by this server") + (0 ":irc.foonet.org 005 tester MAXLIST=beI:60 MAXTARGETS=4 MODES MONITOR=100 NETWORK=FooNet NICKLEN=32 PREFIX=(qaohv)~&@%+ STATUSMSG=~&@%+ TARGMAX=NAMES:1,LIST:1,KICK:1,WHOIS:1,USERHOST:10,PRIVMSG:4,TAGMSG:4,NOTICE:4,MONITOR:100 TOPICLEN=390 UTF8MAPPING=rfc8265 UTF8ONLY WHOX :are supported by this server") + (0 ":irc.foonet.org 005 tester draft/CHATHISTORY=100 :are supported by this server") + (0 ":irc.foonet.org 251 tester :There are 0 users and 3 invisible on 1 server(s)") + (0 ":irc.foonet.org 252 tester 0 :IRC Operators online") + (0 ":irc.foonet.org 253 tester 0 :unregistered connections") + (0 ":irc.foonet.org 254 tester 1 :channels formed") + (0 ":irc.foonet.org 255 tester :I have 3 clients and 0 servers") + (0 ":irc.foonet.org 265 tester 3 3 :Current local users 3, max 3") + (0 ":irc.foonet.org 266 tester 3 3 :Current global users 3, max 3") + (0 ":irc.foonet.org 422 tester :MOTD File is missing")) + +((mode-user 3.2 "MODE tester +i") + (0 ":irc.foonet.org 221 tester +i") + (0 ":irc.foonet.org NOTICE tester :This server is in debug mode and is logging all user I/O. If you do not wish for everything you send to be readable by the server owner(s), please disconnect.")) + +((join 6 "JOIN #chan") + (0 ":tester!~u@9g6b728983yd2.irc JOIN #chan") + (0 ":irc.foonet.org 353 tester = #chan :alice tester @bob") + (0 ":irc.foonet.org 366 tester #chan :End of NAMES list")) + +((mode 5 "MODE #chan") + (0 ":irc.foonet.org 324 tester #chan +nt") + (0 ":irc.foonet.org 329 tester #chan 1620104779") + (0.1 ":bob!~u@rz2v467q4rwhy.irc PRIVMSG #chan :tester, welcome!") + (0.1 ":alice!~u@rz2v467q4rwhy.irc PRIVMSG #chan :tester, welcome!") + (0.1 ":bob!~u@rz2v467q4rwhy.irc PRIVMSG #chan :alice: But, as it seems, did violence on herself.") + (0.1 ":alice!~u@rz2v467q4rwhy.irc PRIVMSG #chan :bob: Well, this is the forest of Arden.") + (0.1 ":alice!~u@rz2v467q4rwhy.irc PRIVMSG #chan :bob: And will you, being a man of your breeding, be married under a bush, like a beggar ? Get you to church, and have a good priest that can tell you what marriage is: this fellow will but join you together as they join wainscot; then one of you will prove a shrunk panel, and like green timber, warp, warp.") + (0.1 ":bob!~u@rz2v467q4rwhy.irc PRIVMSG #chan :alice: Live, and be prosperous; and farewell, good fellow.")) diff --git a/test/lisp/erc/erc-scenarios-resources/join/network-id/barnet.eld b/test/lisp/erc/erc-scenarios-resources/join/network-id/barnet.eld new file mode 100644 index 0000000000..1a13259383 --- /dev/null +++ b/test/lisp/erc/erc-scenarios-resources/join/network-id/barnet.eld @@ -0,0 +1,43 @@ +;; -*- mode: lisp-data; -*- +((pass 2 "PASS :barnet:changeme")) +((nick 2 "NICK tester")) +((user 1 "USER user 0 * :tester") + (0 ":irc.barnet.org 001 tester :Welcome to the barnet IRC Network tester") + (0 ":irc.barnet.org 002 tester :Your host is irc.barnet.org, running version oragono-2.6.0-7481bf0385b95b16") + (0 ":irc.barnet.org 003 tester :This server was created Mon, 10 May 2021 00:58:22 UTC") + (0 ":irc.barnet.org 004 tester irc.barnet.org oragono-2.6.0-7481bf0385b95b16 BERTZios CEIMRUabefhiklmnoqstuv Iabefhkloqv") + (0 ":irc.barnet.org 005 tester AWAYLEN=390 BOT=B CASEMAPPING=ascii CHANLIMIT=#:100 CHANMODES=Ibe,k,fl,CEMRUimnstu CHANNELLEN=64 CHANTYPES=# ELIST=U EXCEPTS EXTBAN=,m FORWARD=f INVEX KICKLEN=390 :are supported by this server") + (0 ":irc.barnet.org 005 tester MAXLIST=beI:60 MAXTARGETS=4 MODES MONITOR=100 NETWORK=barnet NICKLEN=32 PREFIX=(qaohv)~&@%+ STATUSMSG=~&@%+ TARGMAX=NAMES:1,LIST:1,KICK:1,WHOIS:1,USERHOST:10,PRIVMSG:4,TAGMSG:4,NOTICE:4,MONITOR:100 TOPICLEN=390 UTF8MAPPING=rfc8265 UTF8ONLY WHOX :are supported by this server") + (0 ":irc.barnet.org 005 tester draft/CHATHISTORY=100 :are supported by this server") + (0 ":irc.barnet.org 251 tester :There are 0 users and 3 invisible on 1 server(s)") + (0 ":irc.barnet.org 252 tester 0 :IRC Operators online") + (0 ":irc.barnet.org 254 tester 1 :channels formed") + (0 ":irc.barnet.org 255 tester :I have 3 clients and 0 servers") + (0 ":irc.barnet.org 265 tester 3 3 :Current local users 3, max 3") + (0 ":irc.barnet.org 266 tester 3 3 :Current global users 3, max 3") + (0 ":irc.barnet.org 422 tester :MOTD File is missing")) + +((mode-user 1.2 "MODE tester +i")) +;; No mode answer + +((join 2 "JOIN #chan") + (0 ":tester!~u@6yximxrnkg65a.irc JOIN #chan") + (0 ":irc.barnet.org 353 tester = #chan :@joe mike tester") + (0 ":irc.barnet.org 366 tester #chan :End of NAMES list") + (0.1 ":joe!~u@6yximxrnkg65a.irc PRIVMSG #chan :tester, welcome!") + (0 ":mike!~u@6yximxrnkg65a.irc PRIVMSG #chan :tester, welcome!")) + +((mode 1 "MODE #chan") + (0 ":irc.barnet.org 324 tester #chan +nt") + (0 ":irc.barnet.org 329 tester #chan 1620608304") + ;; Wait for foonet's buffer playback + (0.1 ":mike!~u@6yximxrnkg65a.irc PRIVMSG #chan :joe: Go take her hence, and marry her instantly.") + (0.1 ":joe!~u@6yximxrnkg65a.irc PRIVMSG #chan :mike: Of all the four, or the three, or the two, or one of the four.") + (0.1 ":mike!~u@6yximxrnkg65a.irc PRIVMSG #chan :joe: And gives the crutch the cradle's infancy.") + (0.1 ":joe!~u@6yximxrnkg65a.irc PRIVMSG #chan :mike: Such is the simplicity of man to hearken after the flesh.") + (0.05 ":mike!~u@6yximxrnkg65a.irc PRIVMSG #chan :joe: The leaf to read them. Let us toward the king.") + (0.05 ":joe!~u@6yximxrnkg65a.irc PRIVMSG #chan :mike: Many can brook the weather that love not the wind.") + (0.05 ":mike!~u@6yximxrnkg65a.irc PRIVMSG #chan :joe: And now, dear maid, be you as free to us.") + (0.00 ":joe!~u@6yximxrnkg65a.irc PRIVMSG #chan :mike: He hath an uncle here in Messina will be very much glad of it.")) + +((linger 3.5 LINGER)) diff --git a/test/lisp/erc/erc-scenarios-resources/join/network-id/foonet-again.eld b/test/lisp/erc/erc-scenarios-resources/join/network-id/foonet-again.eld new file mode 100644 index 0000000000..08e50dc62b --- /dev/null +++ b/test/lisp/erc/erc-scenarios-resources/join/network-id/foonet-again.eld @@ -0,0 +1,46 @@ +;; -*- mode: lisp-data; -*- +((pass-redux 10 "PASS :foonet:changeme")) +((nick-redux 1 "NICK tester")) + +((user-redux 1 "USER user 0 * :tester") + (0 ":irc.foonet.org 001 tester :Welcome to the foonet IRC Network tester") + (0 ":irc.foonet.org 002 tester :Your host is irc.foonet.org, running version oragono-2.6.0-7481bf0385b95b16") + (0 ":irc.foonet.org 003 tester :This server was created Mon, 10 May 2021 00:58:22 UTC") + (0 ":irc.foonet.org 004 tester irc.foonet.org oragono-2.6.0-7481bf0385b95b16 BERTZios CEIMRUabefhiklmnoqstuv Iabefhkloqv") + (0 ":irc.foonet.org 005 tester AWAYLEN=390 BOT=B CASEMAPPING=ascii CHANLIMIT=#:100 CHANMODES=Ibe,k,fl,CEMRUimnstu CHANNELLEN=64 CHANTYPES=# ELIST=U EXCEPTS EXTBAN=,m FORWARD=f INVEX KICKLEN=390 :are supported by this server") + (0 ":irc.foonet.org 005 tester MAXLIST=beI:60 MAXTARGETS=4 MODES MONITOR=100 NETWORK=foonet NICKLEN=32 PREFIX=(qaohv)~&@%+ STATUSMSG=~&@%+ TARGMAX=NAMES:1,LIST:1,KICK:1,WHOIS:1,USERHOST:10,PRIVMSG:4,TAGMSG:4,NOTICE:4,MONITOR:100 TOPICLEN=390 UTF8MAPPING=rfc8265 UTF8ONLY WHOX :are supported by this server") + (0 ":irc.foonet.org 005 tester draft/CHATHISTORY=100 :are supported by this server") + (0 ":irc.foonet.org 251 tester :There are 0 users and 3 invisible on 1 server(s)") + (0 ":irc.foonet.org 252 tester 0 :IRC Operators online") + (0 ":irc.foonet.org 254 tester 1 :channels formed") + (0 ":irc.foonet.org 255 tester :I have 3 clients and 0 servers") + (0 ":irc.foonet.org 265 tester 3 3 :Current local users 3, max 3") + (0 ":irc.foonet.org 266 tester 3 3 :Current global users 3, max 3") + (0 ":irc.foonet.org 422 tester :MOTD File is missing")) + +((mode-user 1.2 "MODE tester +i") + ;; No mode answer ^ + + ;; History + (0 ":tester!~u@q6ddatxcq6txy.irc JOIN #chan") + (0 ":irc.foonet.org 353 tester = #chan :@alice bob tester") + (0 ":irc.foonet.org 366 tester #chan :End of /NAMES list.") + (0 ":***!znc@znc.in PRIVMSG #chan :Buffer Playback...") + (0 ":bob!~u@q6ddatxcq6txy.irc PRIVMSG #chan :[02:43:23] alice: And soar with them above a common bound.") + (0 ":alice!~u@q6ddatxcq6txy.irc PRIVMSG #chan :[02:43:27] bob: And be aveng'd on cursed Tamora.") + (0 ":bob!~u@q6ddatxcq6txy.irc PRIVMSG #chan :[02:43:29] alice: He did love her, sir, as a gentleman loves a woman.") + (0 ":***!znc@znc.in PRIVMSG #chan :Playback Complete.")) + +;; As a server, we ignore useless join sent by autojoin module +((~join 10 "JOIN #chan")) + +((mode-redux 1 "MODE #chan") + (0 ":irc.foonet.org 324 tester #chan +nt") + (0 ":irc.foonet.org 329 tester #chan 1620608304") + (0.1 ":alice!~u@q6ddatxcq6txy.irc PRIVMSG #chan :bob: Ay, madam, with the swiftest wing of speed.") + (0.1 ":bob!~u@q6ddatxcq6txy.irc PRIVMSG #chan :alice: Five times in that ere once in our five wits.") + (0.1 ":alice!~u@q6ddatxcq6txy.irc PRIVMSG #chan :bob: And bid him come to take his last farewell.") + (0.1 ":bob!~u@q6ddatxcq6txy.irc PRIVMSG #chan :alice: But we are spirits of another sort.") + (0.1 ":alice!~u@q6ddatxcq6txy.irc PRIVMSG #chan :bob: It was not given me, nor I did not buy it.")) + +((linger 6 LINGER)) diff --git a/test/lisp/erc/erc-scenarios-resources/join/network-id/foonet.eld b/test/lisp/erc/erc-scenarios-resources/join/network-id/foonet.eld new file mode 100644 index 0000000000..1162cc3f24 --- /dev/null +++ b/test/lisp/erc/erc-scenarios-resources/join/network-id/foonet.eld @@ -0,0 +1,39 @@ +;; -*- mode: lisp-data; -*- +((pass 1 "PASS :foonet:changeme")) +((nick 1 "NICK tester")) + +((user 1 "USER user 0 * :tester") + (0 ":irc.foonet.org 001 tester :Welcome to the foonet IRC Network tester") + (0 ":irc.foonet.org 002 tester :Your host is irc.foonet.org, running version oragono-2.6.0-7481bf0385b95b16") + (0 ":irc.foonet.org 003 tester :This server was created Mon, 10 May 2021 00:58:22 UTC") + (0 ":irc.foonet.org 004 tester irc.foonet.org oragono-2.6.0-7481bf0385b95b16 BERTZios CEIMRUabefhiklmnoqstuv Iabefhkloqv") + (0 ":irc.foonet.org 005 tester AWAYLEN=390 BOT=B CASEMAPPING=ascii CHANLIMIT=#:100 CHANMODES=Ibe,k,fl,CEMRUimnstu CHANNELLEN=64 CHANTYPES=# ELIST=U EXCEPTS EXTBAN=,m FORWARD=f INVEX KICKLEN=390 :are supported by this server") + (0 ":irc.foonet.org 005 tester MAXLIST=beI:60 MAXTARGETS=4 MODES MONITOR=100 NETWORK=foonet NICKLEN=32 PREFIX=(qaohv)~&@%+ STATUSMSG=~&@%+ TARGMAX=NAMES:1,LIST:1,KICK:1,WHOIS:1,USERHOST:10,PRIVMSG:4,TAGMSG:4,NOTICE:4,MONITOR:100 TOPICLEN=390 UTF8MAPPING=rfc8265 UTF8ONLY WHOX :are supported by this server") + (0 ":irc.foonet.org 005 tester draft/CHATHISTORY=100 :are supported by this server") + (0 ":irc.foonet.org 251 tester :There are 0 users and 3 invisible on 1 server(s)") + (0 ":irc.foonet.org 252 tester 0 :IRC Operators online") + (0 ":irc.foonet.org 254 tester 1 :channels formed") + (0 ":irc.foonet.org 255 tester :I have 3 clients and 0 servers") + (0 ":irc.foonet.org 265 tester 3 3 :Current local users 3, max 3") + (0 ":irc.foonet.org 266 tester 3 3 :Current global users 3, max 3") + (0 ":irc.foonet.org 422 tester :MOTD File is missing")) + +((mode-user 1.2 "MODE tester +i")) +;; No mode answer ^ + +((join 1 "JOIN #chan") + (0 ":tester!~u@q6ddatxcq6txy.irc JOIN #chan") + (0 ":irc.foonet.org 353 tester = #chan :@alice bob tester") + (0 ":irc.foonet.org 366 tester #chan :End of NAMES list") + (0.1 ":bob!~u@q6ddatxcq6txy.irc PRIVMSG #chan :tester, welcome!") + (0 ":alice!~u@q6ddatxcq6txy.irc PRIVMSG #chan :tester, welcome!")) + +((mode 1 "MODE #chan") + (0 ":irc.foonet.org 324 tester #chan +nt") + (0 ":irc.foonet.org 329 tester #chan 1620608304") + (0.1 ":bob!~u@q6ddatxcq6txy.irc PRIVMSG #chan :alice: Pray you, sir, deliver me this paper.") + (0.1 ":alice!~u@q6ddatxcq6txy.irc PRIVMSG #chan :bob: Wake when some vile thing is near.")) + +((quit 1 "QUIT :\2ERC\2")) + +((drop 0 DROP)) diff --git a/test/lisp/erc/erc-scenarios-resources/join/reconnect/foonet-again.eld b/test/lisp/erc/erc-scenarios-resources/join/reconnect/foonet-again.eld new file mode 100644 index 0000000000..f1fcc439cc --- /dev/null +++ b/test/lisp/erc/erc-scenarios-resources/join/reconnect/foonet-again.eld @@ -0,0 +1,45 @@ +;; -*- mode: lisp-data; -*- +((pass 1 "PASS :changeme")) +((nick 1 "NICK tester")) +((user 1 "USER user 0 * :tester") + (0 ":irc.foonet.org 001 tester :Welcome to the foonet IRC Network tester") + (0 ":irc.foonet.org 002 tester :Your host is irc.foonet.org, running version oragono-2.6.0-7481bf0385b95b16") + (0 ":irc.foonet.org 003 tester :This server was created Tue, 04 May 2021 05:06:18 UTC") + (0 ":irc.foonet.org 004 tester irc.foonet.org oragono-2.6.0-7481bf0385b95b16 BERTZios CEIMRUabefhiklmnoqstuv Iabefhkloqv") + (0 ":irc.foonet.org 005 tester AWAYLEN=390 BOT=B CASEMAPPING=ascii CHANLIMIT=#:100 CHANMODES=Ibe,k,fl,CEMRUimnstu CHANNELLEN=64 CHANTYPES=# ELIST=U EXCEPTS EXTBAN=,m FORWARD=f INVEX KICKLEN=390 :are supported by this server") + (0 ":irc.foonet.org 005 tester MAXLIST=beI:60 MAXTARGETS=4 MODES MONITOR=100 NETWORK=FooNet NICKLEN=32 PREFIX=(qaohv)~&@%+ STATUSMSG=~&@%+ TARGMAX=NAMES:1,LIST:1,KICK:1,WHOIS:1,USERHOST:10,PRIVMSG:4,TAGMSG:4,NOTICE:4,MONITOR:100 TOPICLEN=390 UTF8MAPPING=rfc8265 UTF8ONLY WHOX :are supported by this server") + (0 ":irc.foonet.org 005 tester draft/CHATHISTORY=100 :are supported by this server") + (0 ":irc.foonet.org 251 tester :There are 0 users and 3 invisible on 1 server(s)") + (0 ":irc.foonet.org 252 tester 0 :IRC Operators online") + (0 ":irc.foonet.org 253 tester 0 :unregistered connections") + (0 ":irc.foonet.org 254 tester 1 :channels formed") + (0 ":irc.foonet.org 255 tester :I have 3 clients and 0 servers") + (0 ":irc.foonet.org 265 tester 3 3 :Current local users 3, max 3") + (0 ":irc.foonet.org 266 tester 3 3 :Current global users 3, max 3") + (0 ":irc.foonet.org 422 tester :MOTD File is missing")) + +((mode-user 3.2 "MODE tester +i") + (0 ":irc.foonet.org 221 tester +i") + (0 ":irc.foonet.org NOTICE tester :This server is still in debug mode.")) + +((~join-chan 12 "JOIN #chan") + (0 ":tester!~u@9g6b728983yd2.irc JOIN #chan") + (0 ":irc.foonet.org 353 tester = #chan :alice tester @bob") + (0 ":irc.foonet.org 366 tester #chan :End of NAMES list")) + +((~join-spam 12 "JOIN #spam") + (0 ":tester!~u@9g6b728983yd2.irc JOIN #spam") + (0 ":irc.foonet.org 353 tester = #spam :alice tester @bob") + (0 ":irc.foonet.org 366 tester #spam :End of NAMES list")) + +((~mode-chan 4 "MODE #chan") + (0 ":irc.foonet.org 324 tester #chan +nt") + (0 ":irc.foonet.org 329 tester #chan 1620104779") + (0.1 ":bob!~u@rz2v467q4rwhy.irc PRIVMSG #chan :alice: But, as it seems, did violence on herself.") + (0.1 ":alice!~u@rz2v467q4rwhy.irc PRIVMSG #chan :bob: Well, this is the forest of Arden.")) + +((mode-spam 4 "MODE #spam") + (0 ":irc.foonet.org 324 tester #spam +nt") + (0 ":irc.foonet.org 329 tester #spam 1620104779") + (0.1 ":bob!~u@rz2v467q4rwhy.irc PRIVMSG #spam :alice: Signior Iachimo will not from it. Pray, let us follow 'em.") + (0.1 ":alice!~u@rz2v467q4rwhy.irc PRIVMSG #spam :bob: Our queen and all her elves come here anon.")) diff --git a/test/lisp/erc/erc-scenarios-resources/join/reconnect/foonet.eld b/test/lisp/erc/erc-scenarios-resources/join/reconnect/foonet.eld new file mode 100644 index 0000000000..efb269f5ae --- /dev/null +++ b/test/lisp/erc/erc-scenarios-resources/join/reconnect/foonet.eld @@ -0,0 +1,45 @@ +;; -*- mode: lisp-data; -*- +((pass 1 "PASS :changeme")) +((nick 1 "NICK tester")) +((user 1 "USER user 0 * :tester") + (0 ":irc.foonet.org 001 tester :Welcome to the foonet IRC Network tester") + (0 ":irc.foonet.org 002 tester :Your host is irc.foonet.org, running version oragono-2.6.0-7481bf0385b95b16") + (0 ":irc.foonet.org 003 tester :This server was created Tue, 04 May 2021 05:06:18 UTC") + (0 ":irc.foonet.org 004 tester irc.foonet.org oragono-2.6.0-7481bf0385b95b16 BERTZios CEIMRUabefhiklmnoqstuv Iabefhkloqv") + (0 ":irc.foonet.org 005 tester AWAYLEN=390 BOT=B CASEMAPPING=ascii CHANLIMIT=#:100 CHANMODES=Ibe,k,fl,CEMRUimnstu CHANNELLEN=64 CHANTYPES=# ELIST=U EXCEPTS EXTBAN=,m FORWARD=f INVEX KICKLEN=390 :are supported by this server") + (0 ":irc.foonet.org 005 tester MAXLIST=beI:60 MAXTARGETS=4 MODES MONITOR=100 NETWORK=FooNet NICKLEN=32 PREFIX=(qaohv)~&@%+ STATUSMSG=~&@%+ TARGMAX=NAMES:1,LIST:1,KICK:1,WHOIS:1,USERHOST:10,PRIVMSG:4,TAGMSG:4,NOTICE:4,MONITOR:100 TOPICLEN=390 UTF8MAPPING=rfc8265 UTF8ONLY WHOX :are supported by this server") + (0 ":irc.foonet.org 005 tester draft/CHATHISTORY=100 :are supported by this server") + (0 ":irc.foonet.org 251 tester :There are 0 users and 3 invisible on 1 server(s)") + (0 ":irc.foonet.org 252 tester 0 :IRC Operators online") + (0 ":irc.foonet.org 253 tester 0 :unregistered connections") + (0 ":irc.foonet.org 254 tester 1 :channels formed") + (0 ":irc.foonet.org 255 tester :I have 3 clients and 0 servers") + (0 ":irc.foonet.org 265 tester 3 3 :Current local users 3, max 3") + (0 ":irc.foonet.org 266 tester 3 3 :Current global users 3, max 3") + (0 ":irc.foonet.org 422 tester :MOTD File is missing")) + +((mode-user 3.2 "MODE tester +i") + (0 ":irc.foonet.org 221 tester +i") + (0 ":irc.foonet.org NOTICE tester :This server is in debug mode.") + + (0 ":tester!~u@9g6b728983yd2.irc JOIN #chan") + (0 ":irc.foonet.org 353 tester = #chan :alice tester @bob") + (0 ":irc.foonet.org 366 tester #chan :End of NAMES list") + + (0 ":tester!~u@9g6b728983yd2.irc JOIN #spam") + (0 ":irc.foonet.org 353 tester = #spam :alice tester @bob") + (0 ":irc.foonet.org 366 tester #spam :End of NAMES list")) + +((mode-chan 4 "MODE #chan") + (0 ":irc.foonet.org 324 tester #chan +nt") + (0 ":irc.foonet.org 329 tester #chan 1620104779") + (0.1 ":bob!~u@rz2v467q4rwhy.irc PRIVMSG #chan :tester, welcome!") + (0.1 ":alice!~u@rz2v467q4rwhy.irc PRIVMSG #chan :tester, welcome!")) + +((mode-spam 4 "MODE #spam") + (0 ":irc.foonet.org 324 tester #spam +nt") + (0 ":irc.foonet.org 329 tester #spam 1620104779") + (0.1 ":bob!~u@rz2v467q4rwhy.irc PRIVMSG #spam :tester, welcome!") + (0.1 ":alice!~u@rz2v467q4rwhy.irc PRIVMSG #spam :tester, welcome!")) + +((drop 0 DROP)) diff --git a/test/lisp/erc/erc-scenarios.el b/test/lisp/erc/erc-scenarios.el index ba2abe732d..37b58227e7 100644 --- a/test/lisp/erc/erc-scenarios.el +++ b/test/lisp/erc/erc-scenarios.el @@ -272,6 +272,242 @@ erc-scenarios-base-association-same-network--new-buffer (funcall expect 5 "welcome again") (erc-cmd-QUIT ""))))) +;; XXX this is okay, but we also need to check that target buffers are +;; already associated with a new process *before* a JOIN is sent by a +;; server's playback burst. This doesn't do that. +;; +;; This *does* check that superfluous JOINs sent by the autojoin +;; module are harmless when they're not acked (superfluous because the +;; bouncer/server intitates the JOIN). + +(defun erc-scenarios-common--join-network-id (foo-reconnector foo-id bar-id) + "Ensure channels rejoined by erc-join.el DTRT. +Originally from scenario clash-of-chans/autojoin as described in +Bug#48598: 28.0.50; buffer-naming collisions involving bouncers in ERC." + (erc-scenarios-common-with-cleanup + ((chan-buf-foo (format "#chan@%s" (or foo-id "foonet"))) + (chan-buf-bar (format "#chan@%s" (or bar-id "barnet"))) + (erc-scenarios-common-dialog "join/network-id") + (erc-d-t-cleanup-sleep-secs 1) + (erc-server-flood-penalty 0.5) + (dumb-server (erc-d-run "localhost" t 'foonet 'barnet 'foonet-again)) + (port (process-contact dumb-server :service)) + (expect (erc-d-t-make-expecter)) + erc-server-buffer-foo erc-server-process-foo + erc-server-buffer-bar erc-server-process-bar) + + (should (memq 'autojoin erc-modules)) + + (ert-info ("Connect to foonet") + (with-current-buffer + (setq erc-server-buffer-foo (erc :server "127.0.0.1" + :port port + :nick "tester" + :password "foonet:changeme" + :full-name "tester" + :id foo-id)) + (setq erc-server-process-foo erc-server-process) + (erc-scenarios-common-assert-initial-buf-name foo-id port) + (erc-d-t-wait-for 1 (eq (erc-network) 'foonet)) + (funcall expect 5 "foonet"))) + + (ert-info ("Join #chan, find sentinel, quit") + (with-current-buffer erc-server-buffer-foo (erc-cmd-JOIN "#chan")) + (with-current-buffer (erc-d-t-wait-for 5 (get-buffer "#chan")) + (funcall expect 5 "vile thing") + (erc-cmd-QUIT ""))) + + (erc-d-t-wait-for 2 "Foonet connection deceased" + (not (erc-server-process-alive erc-server-buffer-foo))) + + (should (equal erc-autojoin-channels-alist + (if foo-id '((oofnet "#chan")) '((foonet "#chan"))))) + + (ert-info ("Connect to barnet") + (with-current-buffer + (setq erc-server-buffer-bar (erc :server "127.0.0.1" + :port port + :nick "tester" + :password "barnet:changeme" + :full-name "tester" + :id bar-id)) + (setq erc-server-process-bar erc-server-process) + (erc-d-t-wait-for 5 (eq erc-network 'barnet)) + (should (string= (buffer-name) (if bar-id "rabnet" "barnet"))))) + + (ert-info ("Server buffers are unique, no stray IP-based names") + (should-not (eq erc-server-buffer-foo erc-server-buffer-bar)) + (should-not (erc-scenarios-common-buflist "127.0.0.1"))) + + (ert-info ("Only one #chan buffer exists") + (should (equal (list (get-buffer "#chan")) + (erc-scenarios-common-buflist "#chan")))) + + (ert-info ("#chan is not auto-joined") + (with-current-buffer "#chan" + (erc-d-t-absent-for 0.1 "") + (should-not (process-live-p erc-server-process)) + (erc-d-t-ensure-for 0.1 "server buffer remains foonet" + (eq erc-server-process erc-server-process-foo)))) + + (with-current-buffer erc-server-buffer-bar + (erc-cmd-JOIN "#chan") + (erc-d-t-wait-for 3 (get-buffer chan-buf-foo)) + (erc-d-t-wait-for 3 (get-buffer chan-buf-bar)) + (with-current-buffer chan-buf-bar + (erc-d-t-wait-for 3 (eq erc-server-process erc-server-process-bar)) + (funcall expect 5 "marry her instantly"))) + + (ert-info ("Reconnect to foonet") + (with-current-buffer (setq erc-server-buffer-foo + (funcall foo-reconnector)) + (should (member (if foo-id '(oofnet "#chan") '(foonet "#chan")) + erc-autojoin-channels-alist)) + (erc-d-t-wait-for 3 (erc-server-process-alive)) + (setq erc-server-process-foo erc-server-process) + (erc-d-t-wait-for 2 (eq erc-network 'foonet)) + (should (string= (buffer-name) (if foo-id "oofnet" "foonet"))) + (funcall expect 5 "foonet"))) + + (ert-info ("#chan@foonet is clean, no cross-contamination") + (with-current-buffer chan-buf-foo + (erc-d-t-wait-for 3 (eq erc-server-process erc-server-process-foo)) + (funcall expect 3 "") + (erc-d-t-absent-for 0.1 "") + (while (accept-process-output erc-server-process-foo)) + (funcall expect 3 "not given me"))) + + (ert-info ("All #chan@barnet output received") + (with-current-buffer chan-buf-bar + (while (accept-process-output erc-server-process-bar)) + (funcall expect 3 "hath an uncle here"))))) + +(ert-deftest erc-scenarios-join-network-id--cmd-reconnect () + (let ((connect (lambda () + (with-current-buffer "foonet" + (erc-cmd-RECONNECT) + (should (eq (current-buffer) + (process-buffer erc-server-process))) + (current-buffer))))) + (erc-scenarios-common--join-network-id connect nil nil))) + +(ert-deftest erc-scenarios-join-network-id--cmd-reconnect-id () + (let ((connect (lambda () + (with-current-buffer "oofnet" + (erc-cmd-RECONNECT) + (should (eq (current-buffer) + (process-buffer erc-server-process))) + (current-buffer))))) + (erc-scenarios-common--join-network-id connect 'oofnet nil))) + +(ert-deftest erc-scenarios-join-network-id--cmd-reconnect-ids () + (let ((connect (lambda () + (with-current-buffer "oofnet" + (erc-cmd-RECONNECT) + (should (eq (current-buffer) + (process-buffer erc-server-process))) + (current-buffer))))) + (erc-scenarios-common--join-network-id connect 'oofnet 'rabnet))) + +(ert-deftest erc-scenarios-join-network-id--new-invocation () + (let ((connect (lambda () + (erc :server "127.0.0.1" + :port (with-current-buffer "foonet" + (process-contact erc-server-process :service)) + :nick "tester" + :password "foonet:changeme" + :full-name "tester")))) + (erc-scenarios-common--join-network-id connect nil nil))) + +(ert-deftest erc-scenarios-join-network-id--new-invocation-id () + (let ((connect (lambda () + (erc :server "127.0.0.1" + :port (with-current-buffer "oofnet" + (process-contact erc-server-process :service)) + :nick "tester" + :password "foonet:changeme" + :full-name "tester" + :id 'oofnet)))) + (erc-scenarios-common--join-network-id connect 'oofnet nil))) + +(ert-deftest erc-scenarios-join-network-id--new-invocation-ids () + (let ((connect (lambda () + (erc :server "127.0.0.1" + :port (with-current-buffer "oofnet" + (process-contact erc-server-process :service)) + :nick "tester" + :password "foonet:changeme" + :full-name "tester" + :id 'oofnet)))) + (erc-scenarios-common--join-network-id connect 'oofnet 'rabnet))) + +;; Ensure the old way of specifying a partial domain name still works. + +(ert-deftest erc-scenarios-base-legacy-autojoin--announced () + (erc-scenarios-common-with-cleanup + ((erc-scenarios-common-dialog "join/legacy") + (erc-d-linger-secs 1) + (erc-server-flood-penalty 0.1) + (dumb-server (erc-d-run "localhost" t 'foonet)) + (port (process-contact dumb-server :service)) + (erc-autojoin-channels-alist '(("libera\\.chat" "#erc") + ("foonet\\.org" "#chan")))) + + (ert-info ("Connect") + (with-current-buffer (erc :server "127.0.0.1" + :port port + :nick "tester" + :password "changeme" + :full-name "tester") + (should (string= (buffer-name) (format "127.0.0.1:%d" port))))) + + (erc-d-t-wait-for 1 (get-buffer "FooNet")) + + (ert-info ("Channel buffer #chan autojoined") + (with-current-buffer (erc-d-t-wait-for 6 (get-buffer "#chan")) + (erc-d-t-search-for 10 "Live, and be prosperous"))))) + +(ert-deftest erc-scenarios-join-reconnect () + (erc-scenarios-common-with-cleanup + ((erc-scenarios-common-dialog "join/reconnect") + (dumb-server (erc-d-run "localhost" t 'foonet 'foonet-again)) + (port (process-contact dumb-server :service)) + (expect (erc-d-t-make-expecter)) + (erc-server-flood-penalty 0.1) + (erc-server-auto-reconnect t) + erc-autojoin-channels-alist + erc-server-buffer) + + (should (memq 'autojoin erc-modules)) + + (ert-info ("Connect to foonet") + (setq erc-server-buffer (erc :server "127.0.0.1" + :port port + :nick "tester" + :password "changeme" + :full-name "tester")) + (with-current-buffer erc-server-buffer + (should (string= (buffer-name) (format "127.0.0.1:%d" port))) + (funcall expect 1 "debug mode"))) + + (ert-info ("Wait for some output in channels") + (with-current-buffer (erc-d-t-wait-for 10 (get-buffer "#chan")) + (funcall expect 10 "welcome")) + (with-current-buffer (erc-d-t-wait-for 10 (get-buffer "#spam")) + (funcall expect 10 "welcome"))) + + (should (equal erc-autojoin-channels-alist '((FooNet "#spam" "#chan")))) + + (ert-info ("Wait for auto reconnect") + (with-current-buffer erc-server-buffer + (funcall expect 10 "still in debug mode"))) + + (ert-info ("Wait for activity to recommence in channels") + (with-current-buffer (erc-d-t-wait-for 10 (get-buffer "#chan")) + (funcall expect 10 "forest of Arden")) + (with-current-buffer (erc-d-t-wait-for 10 (get-buffer "#spam")) + (funcall expect 10 "her elves come here anon"))))) + ;; Playback for same channel on two networks routed correctly. ;; Originally from Bug#48598: 28.0.50; buffer-naming collisions ;; involving bouncers in ERC. @@ -1286,7 +1522,7 @@ erc-scenarios-common--base-reconnect-options (with-current-buffer erc-server-buffer (funcall expect 10 "Connection failed! Re-establishing"))) - (should (equal erc-autojoin-channels-alist '(("foonet.org" "#chan")))) + (should (equal erc-autojoin-channels-alist '((FooNet "#chan")))) (funcall test) -- 2.35.1