Start oragono instead of charybdis
This commit is contained in:
@@ -183,7 +183,7 @@ class BiboumiRunner(ProcessRunner):
|
|||||||
class IrcServerRunner(ProcessRunner):
|
class IrcServerRunner(ProcessRunner):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.create = asyncio.create_subprocess_exec("charybdis", "-foreground", "-configfile", os.getcwd() + "/../tests/end_to_end/ircd.conf",
|
self.create = asyncio.create_subprocess_exec("oragono", "run", "--conf", os.getcwd() + "/../tests/end_to_end/ircd.yaml",
|
||||||
stderr=asyncio.subprocess.PIPE)
|
stderr=asyncio.subprocess.PIPE)
|
||||||
|
|
||||||
class BiboumiTest:
|
class BiboumiTest:
|
||||||
@@ -324,7 +324,7 @@ if __name__ == '__main__':
|
|||||||
if not res:
|
if not res:
|
||||||
print("IRC server failed to start, see irc_output.txt for more details. Exiting…")
|
print("IRC server failed to start, see irc_output.txt for more details. Exiting…")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
if b"now running in foreground mode" in res:
|
if b"Server running" in res:
|
||||||
break
|
break
|
||||||
print("irc server started.")
|
print("irc server started.")
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
from scenarios import *
|
|
||||||
|
|
||||||
scenario = (
|
|
||||||
scenarios.simple_channel_join.scenario,
|
|
||||||
send_stanza("<message from='{jid_one}/{resource_one}' to='#foo%{irc_server_one}'><x xmlns='http://jabber.org/protocol/muc#user'><invite to='{nick_one}'/></x></message>"),
|
|
||||||
expect_stanza("/message/body[text()='{nick_one} is already on channel #foo']")
|
|
||||||
)
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
from functions import expect_stanza, send_stanza, common_replacements
|
from functions import expect_stanza, send_stanza, common_replacements, expect_unordered
|
||||||
|
|
||||||
def handshake():
|
def handshake():
|
||||||
return (
|
return (
|
||||||
@@ -10,10 +10,8 @@ def connection_begin(irc_host, jid, expected_irc_presence=False, fixed_irc_serve
|
|||||||
jid = jid.format_map(common_replacements)
|
jid = jid.format_map(common_replacements)
|
||||||
if fixed_irc_server:
|
if fixed_irc_server:
|
||||||
xpath = "/message[@to='" + jid + "'][@from='biboumi.localhost']/body[text()='%s']"
|
xpath = "/message[@to='" + jid + "'][@from='biboumi.localhost']/body[text()='%s']"
|
||||||
xpath_re = "/message[@to='" + jid + "'][@from='biboumi.localhost']/body[re:test(text(), '%s')]"
|
|
||||||
else:
|
else:
|
||||||
xpath = "/message[@to='" + jid + "'][@from='" + irc_host + "@biboumi.localhost']/body[text()='%s']"
|
xpath = "/message[@to='" + jid + "'][@from='" + irc_host + "@biboumi.localhost']/body[text()='%s']"
|
||||||
xpath_re = "/message[@to='" + jid + "'][@from='" + irc_host + "@biboumi.localhost']/body[re:test(text(), '%s')]"
|
|
||||||
result = (
|
result = (
|
||||||
expect_stanza(xpath % ('Connecting to %s:6697 (encrypted)' % irc_host),
|
expect_stanza(xpath % ('Connecting to %s:6697 (encrypted)' % irc_host),
|
||||||
"/message/hints:no-copy",
|
"/message/hints:no-copy",
|
||||||
@@ -28,14 +26,11 @@ def connection_begin(irc_host, jid, expected_irc_presence=False, fixed_irc_serve
|
|||||||
if expected_irc_presence:
|
if expected_irc_presence:
|
||||||
result += (expect_stanza("/presence[@from='" + irc_host + "@biboumi.localhost']"),)
|
result += (expect_stanza("/presence[@from='" + irc_host + "@biboumi.localhost']"),)
|
||||||
|
|
||||||
# These five messages can be receive in any order
|
|
||||||
result += (
|
result += (
|
||||||
expect_stanza(xpath_re % (r'^%s: (\*\*\* Checking Ident|\*\*\* Looking up your hostname\.\.\.|\*\*\* Found your hostname: .*|ACK multi-prefix|\*\*\* Got Ident response)$' % 'irc.localhost')),
|
expect_stanza("/message/body[text()='irc.localhost: ACK multi-prefix']"),
|
||||||
expect_stanza(xpath_re % (r'^%s: (\*\*\* Checking Ident|\*\*\* Looking up your hostname\.\.\.|\*\*\* Found your hostname: .*|ACK multi-prefix|\*\*\* Got Ident response)$' % 'irc.localhost')),
|
expect_stanza("/message/body[text()='irc.localhost: *** Looking up your hostname...']"),
|
||||||
expect_stanza(xpath_re % (r'^%s: (\*\*\* Checking Ident|\*\*\* Looking up your hostname\.\.\.|\*\*\* Found your hostname: .*|ACK multi-prefix|\*\*\* Got Ident response)$' % 'irc.localhost')),
|
expect_stanza("/message/body[text()='irc.localhost: *** Found your hostname']"),
|
||||||
expect_stanza(xpath_re % (r'^%s: (\*\*\* Checking Ident|\*\*\* Looking up your hostname\.\.\.|\*\*\* Found your hostname: .*|ACK multi-prefix|\*\*\* Got Ident response)$' % 'irc.localhost')),
|
),
|
||||||
expect_stanza(xpath_re % (r'^%s: (\*\*\* Checking Ident|\*\*\* Looking up your hostname\.\.\.|\*\*\* Found your hostname: .*|ACK multi-prefix|\*\*\* Got Ident response)$' % 'irc.localhost')),
|
|
||||||
)
|
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
@@ -43,10 +38,8 @@ def connection_tls_begin(irc_host, jid, fixed_irc_server):
|
|||||||
jid = jid.format_map(common_replacements)
|
jid = jid.format_map(common_replacements)
|
||||||
if fixed_irc_server:
|
if fixed_irc_server:
|
||||||
xpath = "/message[@to='" + jid + "'][@from='biboumi.localhost']/body[text()='%s']"
|
xpath = "/message[@to='" + jid + "'][@from='biboumi.localhost']/body[text()='%s']"
|
||||||
xpath_re = "/message[@to='" + jid + "'][@from='biboumi.localhost']/body[re:test(text(), '%s')]"
|
|
||||||
else:
|
else:
|
||||||
xpath = "/message[@to='" + jid + "'][@from='" + irc_host + "@biboumi.localhost']/body[text()='%s']"
|
xpath = "/message[@to='" + jid + "'][@from='" + irc_host + "@biboumi.localhost']/body[text()='%s']"
|
||||||
xpath_re = "/message[@to='" + jid + "'][@from='" + irc_host + "@biboumi.localhost']/body[re:test(text(), '%s')]"
|
|
||||||
irc_host = 'irc.localhost'
|
irc_host = 'irc.localhost'
|
||||||
return (
|
return (
|
||||||
expect_stanza(xpath % ('Connecting to %s:7778 (encrypted)' % irc_host),
|
expect_stanza(xpath % ('Connecting to %s:7778 (encrypted)' % irc_host),
|
||||||
@@ -54,12 +47,9 @@ def connection_tls_begin(irc_host, jid, fixed_irc_server):
|
|||||||
"/message/carbon:private",
|
"/message/carbon:private",
|
||||||
),
|
),
|
||||||
expect_stanza(xpath % 'Connected to IRC server (encrypted).'),
|
expect_stanza(xpath % 'Connected to IRC server (encrypted).'),
|
||||||
# These five messages can be receive in any order
|
expect_stanza("/message/body[text()='irc.localhost: ACK multi-prefix']"),
|
||||||
expect_stanza(xpath_re % (r'^%s: (\*\*\* Checking Ident|\*\*\* Looking up your hostname\.\.\.|\*\*\* Found your hostname: .*|ACK multi-prefix|\*\*\* Got Ident response)$' % irc_host)),
|
expect_stanza("/message/body[text()='irc.localhost: *** Looking up your hostname...']"),
|
||||||
expect_stanza(xpath_re % (r'^%s: (\*\*\* Checking Ident|\*\*\* Looking up your hostname\.\.\.|\*\*\* Found your hostname: .*|ACK multi-prefix|\*\*\* Got Ident response)$' % irc_host)),
|
expect_stanza("/message/body[text()='irc.localhost: *** Found your hostname']"),
|
||||||
expect_stanza(xpath_re % (r'^%s: (\*\*\* Checking Ident|\*\*\* Looking up your hostname\.\.\.|\*\*\* Found your hostname: .*|ACK multi-prefix|\*\*\* Got Ident response)$' % irc_host)),
|
|
||||||
expect_stanza(xpath_re % (r'^%s: (\*\*\* Checking Ident|\*\*\* Looking up your hostname\.\.\.|\*\*\* Found your hostname: .*|ACK multi-prefix|\*\*\* Got Ident response)$' % irc_host)),
|
|
||||||
expect_stanza(xpath_re % (r'^%s: (\*\*\* Checking Ident|\*\*\* Looking up your hostname\.\.\.|\*\*\* Found your hostname: .*|ACK multi-prefix|\*\*\* Got Ident response)$' % irc_host)),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def connection_end(irc_host, jid, fixed_irc_server=False):
|
def connection_end(irc_host, jid, fixed_irc_server=False):
|
||||||
@@ -72,37 +62,24 @@ def connection_end(irc_host, jid, fixed_irc_server=False):
|
|||||||
xpath_re = "/message[@to='" + jid + "'][@from='" + irc_host + "@biboumi.localhost']/body[re:test(text(), '%s')]"
|
xpath_re = "/message[@to='" + jid + "'][@from='" + irc_host + "@biboumi.localhost']/body[re:test(text(), '%s')]"
|
||||||
irc_host = 'irc.localhost'
|
irc_host = 'irc.localhost'
|
||||||
return (
|
return (
|
||||||
expect_stanza(xpath_re % (r'^%s: Your host is .*$' % irc_host)),
|
expect_stanza("/message/body[text()='%s: Your host is %s, running version oragono-2.0.0-8fd326fd33f29f19c8c9aa121b9b4e9ebf931879 ']" % (irc_host, irc_host)),
|
||||||
expect_stanza(xpath_re % (r'^%s: This server was created .*$' % irc_host)),
|
expect_stanza(xpath_re % (r'^%s: This server was created .*$' % irc_host)),
|
||||||
expect_stanza(xpath_re % (r'^%s: There are \d+ users and \d+ invisible on \d+ servers$' % irc_host)),
|
expect_stanza(xpath_re % (r'^%s: There are \d+ users and \d+ invisible on \d+ server\(s\)$' % irc_host)),
|
||||||
expect_stanza(xpath_re % (r'^%s: \d+ unknown connection\(s\)$' % irc_host), optional=True),
|
expect_stanza(xpath_re % ("%s: \d+ IRC Operators online" % irc_host,)),
|
||||||
expect_stanza(xpath_re % (r'^%s: \d+ channels formed$' % irc_host), optional=True),
|
expect_stanza(xpath_re % ("%s: \d+ unregistered connections" % irc_host,)),
|
||||||
|
expect_stanza(xpath_re % ("%s: \d+ channels formed" % irc_host,)),
|
||||||
expect_stanza(xpath_re % (r'^%s: I have \d+ clients and \d+ servers$' % irc_host)),
|
expect_stanza(xpath_re % (r'^%s: I have \d+ clients and \d+ servers$' % irc_host)),
|
||||||
expect_stanza(xpath_re % (r'^%s: \d+ \d+ Current local users \d+, max \d+$' % irc_host)),
|
expect_stanza(xpath_re % (r'^%s: \d+ \d+ Current local users \d+, max \d+$' % irc_host)),
|
||||||
expect_stanza(xpath_re % (r'^%s: \d+ \d+ Current global users \d+, max \d+$' % irc_host)),
|
expect_stanza(xpath_re % (r'^%s: \d+ \d+ Current global users \d+, max \d+$' % irc_host)),
|
||||||
expect_stanza(xpath_re % (r'^%s: Highest connection count: \d+ \(\d+ clients\) \(\d+ connections received\)$' % irc_host)),
|
expect_stanza(xpath % "%s: MOTD File is missing: Unspecified error" % irc_host),
|
||||||
expect_stanza(xpath % "- This is charybdis MOTD you might replace it, but if not your friends will\n- laugh at you.\n"),
|
expect_stanza(xpath_re % (r'.+? \+Z',)),
|
||||||
expect_stanza(xpath_re % r'^User mode for \w+ is \[\+Z?i\]$'),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def connection_middle(irc_host, jid, fixed_irc_server=False):
|
|
||||||
if fixed_irc_server:
|
|
||||||
xpath_re = "/message[@to='" + jid + "'][@from='biboumi.localhost']/body[re:test(text(), '%s')]"
|
|
||||||
else:
|
|
||||||
xpath_re = "/message[@to='" + jid + "'][@from='" + irc_host + "@biboumi.localhost']/body[re:test(text(), '%s')]"
|
|
||||||
irc_host = 'irc.localhost'
|
|
||||||
return (
|
|
||||||
expect_stanza(xpath_re % (r'^%s: \*\*\* You are exempt from flood limits$' % irc_host)),
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def connection(irc_host="irc.localhost", jid="{jid_one}/{resource_one}", expected_irc_presence=False, fixed_irc_server=False):
|
def connection(irc_host="irc.localhost", jid="{jid_one}/{resource_one}", expected_irc_presence=False, fixed_irc_server=False):
|
||||||
return connection_begin(irc_host, jid, expected_irc_presence, fixed_irc_server=fixed_irc_server) + \
|
return connection_begin(irc_host, jid, expected_irc_presence, fixed_irc_server=fixed_irc_server) + \
|
||||||
connection_middle(irc_host, jid, fixed_irc_server=fixed_irc_server) + \
|
|
||||||
connection_end(irc_host, jid, fixed_irc_server=fixed_irc_server)
|
connection_end(irc_host, jid, fixed_irc_server=fixed_irc_server)
|
||||||
|
|
||||||
def connection_tls(irc_host="irc.localhost", jid="{jid_one}/{resource_one}", fixed_irc_server=False):
|
def connection_tls(irc_host="irc.localhost", jid="{jid_one}/{resource_one}", fixed_irc_server=False):
|
||||||
return connection_tls_begin(irc_host, jid, fixed_irc_server) + \
|
return connection_tls_begin(irc_host, jid, fixed_irc_server) + \
|
||||||
connection_middle(irc_host, jid, fixed_irc_server) +\
|
|
||||||
connection_end(irc_host, jid, fixed_irc_server)
|
connection_end(irc_host, jid, fixed_irc_server)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user