diff --git a/CMakeLists.txt b/CMakeLists.txt index ef037b3..be47ffe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,7 @@ endif() # ## Find optional instrumentation libraries that will be used in debug only # -find_library(LIBASAN NAMES asan libasan.so.4 libasan.so.3 libasan.so.2 libasan.so.1) +find_library(LIBASAN NAMES asan libasan.so.8 libasan.so.4 libasan.so.3 libasan.so.2 libasan.so.1) find_library(LIBUBSAN NAMES ubsan libubsan.so.0) # diff --git a/docker/test/alpine/Dockerfile b/docker/test/alpine/Dockerfile index fda5388..047d134 100644 --- a/docker/test/alpine/Dockerfile +++ b/docker/test/alpine/Dockerfile @@ -1,13 +1,17 @@ # This Dockerfile creates a docker image suitable to run biboumi’s build and # tests. For example, it can be used on with gitlab-ci. -FROM alpine:latest +FROM docker.io/alpine:edge ENV LC_ALL C.UTF-8 +# py3-slixmpp is in testing repo +RUN echo "https://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories + # Needed to build biboumi RUN apk add --no-cache \ git \ +ergo \ make \ cmake \ g++ \ @@ -24,6 +28,7 @@ catch2-3 \ valgrind \ py3-pip \ py3-lxml \ +py3-slixmpp \ python3-dev \ libffi-dev \ go \ @@ -31,8 +36,3 @@ rust \ cargo \ wget -# Install oragono, for e2e tests -RUN wget "https://github.com/ergochat/ergo/archive/v2.0.0.tar.gz" && tar xvf "v2.0.0.tar.gz" && cd "ergo-2.0.0" && make && cp ~/go/bin/oragono /usr/local/bin/oragono - -# Install slixmpp, for e2e tests -RUN pip3 install slixmpp --break-system-packages diff --git a/docker/test/debian/Dockerfile b/docker/test/debian/Dockerfile index b7f393b..8ba8064 100644 --- a/docker/test/debian/Dockerfile +++ b/docker/test/debian/Dockerfile @@ -1,7 +1,7 @@ # This Dockerfile creates a docker image suitable to run biboumi’s build and # tests. For example, it can be used on with gitlab-ci. -FROM debian:bookworm +FROM docker.io/debian:trixie ENV LC_ALL=C.UTF-8 @@ -23,10 +23,10 @@ libgcrypt20-dev \ libpq-dev \ libcatch2-dev \ valgrind \ -libasan6 \ +libasan8 \ libubsan1 \ python3-lxml \ python3-slixmpp \ +ergochat \ wget -RUN wget "https://github.com/ergochat/ergo/releases/download/v2.0.0/oragono-2.0.0-linux-x64.tar.gz" && tar xvf oragono-2.0.0-linux-x64.tar.gz && cp oragono-2.0.0-linux-x64/oragono /usr/local/bin diff --git a/docker/test/fedora/Dockerfile b/docker/test/fedora/Dockerfile index 1ae3c4a..cdab0c4 100644 --- a/docker/test/fedora/Dockerfile +++ b/docker/test/fedora/Dockerfile @@ -1,8 +1,9 @@ # This Dockerfile creates a docker image suitable to run biboumi’s build and # tests. For example, it can be used on with gitlab-ci. -FROM fedora:latest +FROM docker.io/fedora:latest +ARG ERGO_VERSION=2.16.0 ENV LC_ALL=C.UTF-8 # TODO: upgrade to botan3 @@ -39,5 +40,5 @@ rpmdevtools \ # Install slixmpp, for e2e tests RUN pip3 install --break-system-packages slixmpp -# Install oragono, for e2e tests -RUN wget "https://github.com/ergochat/ergo/releases/download/v2.0.0/oragono-2.0.0-linux-x64.tar.gz" && tar xvf oragono-2.0.0-linux-x64.tar.gz && cp oragono-2.0.0-linux-x64/oragono /usr/local/bin +# Install ergo, for e2e tests +RUN wget "https://github.com/ergochat/ergo/releases/download/v${ERGO_VERSION}/ergo-${ERGO_VERSION}-linux-x86_64.tar.gz" && tar xvf ergo-${ERGO_VERSION}-linux-x86_64.tar.gz && cp -r ergo-${ERGO_VERSION}-linux-x86_64 /usr/local/lib/ergo && ln -s /usr/local/lib/ergo/ergo /usr/local/bin/ergo diff --git a/src/bridge/bridge.cpp b/src/bridge/bridge.cpp index c826fe1..ec76ef6 100644 --- a/src/bridge/bridge.cpp +++ b/src/bridge/bridge.cpp @@ -13,6 +13,7 @@ #include #include "result_set_management.hpp" #include +#include using namespace std::string_literals; diff --git a/tests/end_to_end/__main__.py b/tests/end_to_end/__main__.py index 2ca26c0..e1c73bb 100644 --- a/tests/end_to_end/__main__.py +++ b/tests/end_to_end/__main__.py @@ -14,6 +14,7 @@ import signal import atexit import sys import os +import shutil from slixmpp.xmlstream.matcher.base import MatcherBase @@ -180,8 +181,9 @@ class IrcServerRunner(ProcessRunner): os.remove("ircd.db") except FileNotFoundError: pass - subprocess.run(["oragono", "mkcerts", "--conf", os.getcwd() + "/../tests/end_to_end/ircd.yaml"]) - self.create = asyncio.create_subprocess_exec("oragono", "run", "--conf", os.getcwd() + "/../tests/end_to_end/ircd.yaml", + ergo_path = shutil.which("ergo") or shutil.which("ergochat") + subprocess.run([ergo_path, "mkcerts", "--conf", os.getcwd() + "/../tests/end_to_end/ircd.yaml"]) + self.create = asyncio.create_subprocess_exec(ergo_path, "run", "--conf", os.getcwd() + "/../tests/end_to_end/ircd.yaml", stderr=asyncio.subprocess.PIPE) class BiboumiTest: @@ -205,7 +207,8 @@ class BiboumiTest: pass logging.basicConfig(level=logging.DEBUG, format='%(levelname)-8s %(message)s', - filename=output_filename) + filename=output_filename, + force=True) with open("test.conf", "w") as fd: fd.write(confs[self.scenario.conf]) @@ -241,7 +244,7 @@ class BiboumiTest: xmpp.saved_values.clear() - if xmpp.server: + if xmpp.boundjid.host: xmpp.accepting_server.close() return not failed diff --git a/tests/end_to_end/ircd.yaml b/tests/end_to_end/ircd.yaml index 057674c..ec21801 100644 --- a/tests/end_to_end/ircd.yaml +++ b/tests/end_to_end/ircd.yaml @@ -1,4 +1,4 @@ -# oragono IRCd config +# ergo IRCd config # network configuration network: @@ -33,7 +33,7 @@ server: # 'proxy' should typically be false. It's only for Kubernetes-style load # balancing that does not terminate TLS, but sends an initial PROXY line # in plaintext. - proxy: false + proxy: false # Example of a Unix domain socket for proxying: # "/tmp/oragono_sock": @@ -87,14 +87,15 @@ server: # casemapping controls what kinds of strings are permitted as identifiers (nicknames, # channel names, account names, etc.), and how they are normalized for case. - # with the recommended default of 'precis', utf-8 identifiers that are "sane" - # (according to RFC 8265) are allowed, and the server additionally tries to protect - # against confusable characters ("homoglyph attacks"). - # the other options are 'ascii' (traditional ASCII-only identifiers), and 'permissive', - # which allows identifiers to contain unusual characters like emoji, but makes users - # vulnerable to homoglyph attacks. unless you're really confident in your decision, - # we recommend leaving this value at its default (changing it once the network is - # already up and running is problematic). + # the recommended default is 'ascii' (traditional ASCII-only identifiers). + # the other options are 'precis', which allows UTF8 identifiers that are "sane" + # (according to UFC 8265), with additional mitigations for homoglyph attacks, + # 'permissive', which allows identifiers containing unusual characters like + # emoji, at the cost of increased vulnerability to homoglyph attacks and potential + # client compatibility problems, and the legacy mappings 'rfc1459' and + # 'rfc1459-strict'. we recommend leaving this value at its default; + # however, note that changing it once the network is already up and running is + # problematic. casemapping: "precis" # whether to look up user hostnames with reverse DNS @@ -109,12 +110,12 @@ server: check-ident: false # password to login to the server - # generated using "oragono genpasswd" + # generated using "ergo genpasswd" #password: "" # motd filename # if you change the motd, you should move it to ircd.motd - motd: + # motd: # motd formatting codes # if this is true, the motd is escaped using formatting codes like $c, $b, and $i @@ -136,7 +137,7 @@ server: # (comment this out to use passwords only) fingerprint: "abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789" - # password the gateway uses to connect, made with oragono genpasswd + # password the gateway uses to connect, made with ergo genpasswd password: "$2a$04$sLEFDpIOyUp55e6gTMKbOeroT6tMXTjPFvA0eGvwvImVR9pkwv7ee" # addresses/CIDRs that can use this webirc command @@ -209,42 +210,13 @@ server: # IP cloaking hides users' IP addresses from other users and from channel admins # (but not from server admins), while still allowing channel admins to ban # offending IP addresses or networks. In place of hostnames derived from reverse - # DNS, users see fake domain names like pwbs2ui4377257x8.oragono. These names are + # DNS, users see fake domain names like pwbs2ui4377257x8.ergo. These names are # generated deterministically from the underlying IP address, but if the underlying # IP is not already known, it is infeasible to recover it from the cloaked name. ip-cloaking: # whether to enable IP cloaking enabled: false - # fake TLD at the end of the hostname, e.g., pwbs2ui4377257x8.oragono - netname: "oragono" - - # secret key to prevent dictionary attacks against cloaked IPs - # any high-entropy secret is valid for this purpose: - # you MUST generate a new one for your installation. - # suggestion: use the output of `oragono mksecret` - # note that rotating this key will invalidate all existing ban masks. - secret: "siaELnk6Kaeo65K3RCrwJjlWaZ-Bt3WuZ2L8MXLbNb4" - - # name of an environment variable to pull the secret from, for use with - # k8s secret distribution: - # secret-environment-variable: "ORAGONO_CLOAKING_SECRET" - - # the cloaked hostname is derived only from the CIDR (most significant bits - # of the IP address), up to a configurable number of bits. this is the - # granularity at which bans will take effect for IPv4. Note that changing - # this value will invalidate any stored bans. - cidr-len-ipv4: 32 - - # analogous granularity for IPv6 - cidr-len-ipv6: 64 - - # number of bits of hash output to include in the cloaked hostname. - # more bits means less likelihood of distinct IPs colliding, - # at the cost of a longer cloaked hostname. if this value is set to 0, - # all users will receive simply `netname` as their cloaked hostname. - num-bits: 64 - # secure-nets identifies IPs and CIDRs which are secure at layer 3, # for example, because they are on a trusted internal LAN or a VPN. # plaintext connections from these IPs and CIDRs will be considered @@ -272,21 +244,6 @@ accounts: # length of time a user has to verify their account before it can be re-registered verify-timeout: "32h" - # callbacks to allow - enabled-callbacks: - - none # no verification needed, will instantly register successfully - - # example configuration for sending verification emails via a local mail relay - # callbacks: - # mailto: - # server: localhost - # port: 25 - # tls: - # enabled: false - # username: "" - # password: "" - # sender: "admin@my.network" - # throttle account login attempts (to prevent either password guessing, or DoS # attacks on the server aimed at forcing repeated expensive bcrypt computations) login-throttling: @@ -343,10 +300,16 @@ accounts: # rename-timeout - this is how long users have 'til they're renamed rename-timeout: 30s - # rename-prefix - this is the prefix to use when renaming clients (e.g. Guest-AB54U31) - rename-prefix: Guest- + # format for guest nicknames: + # 1. these nicknames cannot be registered or reserved + # 2. if a client is automatically renamed by the server, + # this is the template that will be used (e.g., Guest-nccj6rgmt97cg) + # 3. if force-guest-format (see below) is enabled, clients without + # a registered account will have this template applied to their + # nicknames (e.g., 'katie' will become 'Guest-katie') + guest-nickname-format: Guest-* - # multiclient controls whether oragono allows multiple connections to + # multiclient controls whether ergo allows multiple connections to # attach to the same client/nickname identity; this is part of the # functionality traditionally provided by a bouncer like ZNC multiclient: @@ -379,27 +342,6 @@ accounts: # (make sure any changes you make here are RFC-compliant) valid-regexp: '^[0-9A-Za-z.\-_/]+$' - # options controlling users requesting vhosts: - user-requests: - # can users request vhosts at all? if this is false, operators with the - # 'vhosts' capability can still assign vhosts manually - enabled: false - - # if uncommented, all new vhost requests will be dumped into the given - # channel, so opers can review them as they are sent in. ensure that you - # have registered and restricted the channel appropriately before you - # uncomment this. - #channel: "#vhosts" - - # after a user's vhost has been approved or rejected, they need to wait - # this long (starting from the time of their original request) - # before they can request a new one. - cooldown: 168h - - # vhosts that users can take without approval, using `/HS TAKE` - offer-list: - #- "oragono.test" - # support for deferring password checking to an external LDAP server # you should probably ignore this section! consult the grafana docs for details: # https://grafana.com/docs/grafana/latest/auth/ldap/ @@ -466,9 +408,8 @@ oper-classes: # capability names capabilities: - - "oper:local_kill" - - "oper:local_ban" - - "oper:local_unban" + - "kill" + - "ban" - "nofakelag" # network operator @@ -479,12 +420,6 @@ oper-classes: # oper class this extends from extends: "local-oper" - # capability names - capabilities: - - "oper:remote_kill" - - "oper:remote_ban" - - "oper:remote_unban" - # server admin "server-admin": # title shown in WHOIS @@ -495,8 +430,7 @@ oper-classes: # capability names capabilities: - - "oper:rehash" - - "oper:die" + - "rehash" - "accreg" - "sajoin" - "samode" @@ -522,7 +456,7 @@ opers: # operators can be authenticated either by password (with the /OPER command), # or by certificate fingerprint, or both. if a password hash is set, then a # password is required to oper up (e.g., /OPER dan mypassword). to generate - # the hash, use `oragono genpasswd`. + # the hash, use `ergo genpasswd`. password: "$2a$04$LiytCxaY0lI.guDj2pBN4eLRD5cdM2OLDwqmGAgB6M2OPirbF5Jcu" # if a SHA-256 certificate fingerprint is configured here, then it will be @@ -576,7 +510,7 @@ logging: # debug options debug: - # when enabled, oragono will attempt to recover from certain kinds of + # when enabled, ergo will attempt to recover from certain kinds of # client-triggered runtime errors that would normally crash the server. # this makes the server more resilient to DoS, but could result in incorrect # behavior. deployments that would prefer to "start from scratch", e.g., by @@ -606,7 +540,7 @@ datastore: host: "localhost" # port is unnecessary for connections via unix domain socket: #port: 3306 - user: "oragono" + user: "ergo" password: "hunter2" history-database: "oragono_history" timeout: 3s @@ -720,11 +654,6 @@ history: # (and will eventually be deleted from persistent storage, if that's enabled) #expire-time: 1w - # if this is set, logged-in users cannot retrieve messages older than their - # account registration date, and logged-out users cannot retrieve messages - # older than their sign-on time (modulo grace-period, see below): - enforce-registration-date: false - # but if this is set, you can retrieve messages that are up to `grace-period` # older than the above cutoff time. this is recommended to allow logged-out # users to do session resumption / query history after disconnections. diff --git a/tests/end_to_end/scenarios/channel_custom_topic.py b/tests/end_to_end/scenarios/channel_custom_topic.py index b15ccc8..b5afdd6 100644 --- a/tests/end_to_end/scenarios/channel_custom_topic.py +++ b/tests/end_to_end/scenarios/channel_custom_topic.py @@ -14,13 +14,13 @@ scenario = ( sequences.connection("irc.localhost", '{jid_two}/{resource_one}'), expect_unordered( [ - "/presence[@to='{jid_one}/{resource_one}'][@from='#foo%{irc_server_one}/{nick_two}']/muc_user:x/muc_user:item[@affiliation='none'][@jid='{lower_nick_two}%{irc_server_one}/~{nick_two}@irc.localhost'][@role='participant']" + "/presence[@to='{jid_one}/{resource_one}'][@from='#foo%{irc_server_one}/{nick_two}']/muc_user:x/muc_user:item[@affiliation='none'][@jid='{lower_nick_two}%{irc_server_one}/~{nick_two}@{irc_host_one}'][@role='participant']" ], [ "/presence[@to='{jid_two}/{resource_one}'][@from='#foo%{irc_server_one}/{nick_one}']/muc_user:x/muc_user:item[@affiliation='admin'][@role='moderator']" ], [ - "/presence[@to='{jid_two}/{resource_one}'][@from='#foo%{irc_server_one}/{nick_two}']/muc_user:x/muc_user:item[@affiliation='none'][@jid='{lower_nick_two}%{irc_server_one}/~{nick_two}@irc.localhost'][@role='participant']", + "/presence[@to='{jid_two}/{resource_one}'][@from='#foo%{irc_server_one}/{nick_two}']/muc_user:x/muc_user:item[@affiliation='none'][@jid='{lower_nick_two}%{irc_server_one}/~{nick_two}@{irc_host_one}'][@role='participant']", "/presence/muc_user:x/muc_user:status[@code='110']" ], [ diff --git a/tests/end_to_end/scenarios/channel_force_join.py b/tests/end_to_end/scenarios/channel_force_join.py index c03b9b9..ef62088 100644 --- a/tests/end_to_end/scenarios/channel_force_join.py +++ b/tests/end_to_end/scenarios/channel_force_join.py @@ -11,7 +11,7 @@ scenario = ( send_stanza(""), expect_unordered( [ - "/presence[@to='{jid_one}/{resource_one}'][@from='#foo%{irc_server_one}/{nick_two}']/muc_user:x/muc_user:item[@affiliation='none'][@role='participant'][@jid='{lower_nick_two}%{irc_server_one}/~{nick_two}@irc.localhost']" + "/presence[@to='{jid_one}/{resource_one}'][@from='#foo%{irc_server_one}/{nick_two}']/muc_user:x/muc_user:item[@affiliation='none'][@role='participant'][@jid='{lower_nick_two}%{irc_server_one}/~{nick_two}@{irc_host_one}']" ], [ "/presence[@to='{jid_one}/{resource_one}'][@from='#foo%{irc_server_one}/{nick_one}']/muc_user:x/muc_user:item[@affiliation='admin'][@role='moderator']", diff --git a/tests/end_to_end/scenarios/channel_history.py b/tests/end_to_end/scenarios/channel_history.py index a9f74a1..69da348 100644 --- a/tests/end_to_end/scenarios/channel_history.py +++ b/tests/end_to_end/scenarios/channel_history.py @@ -9,7 +9,7 @@ scenario = ( # Second user joins send_stanza(""), - expect_stanza("/presence[@to='{jid_one}/{resource_two}'][@from='#foo%{irc_server_one}/{nick_one}']/muc_user:x/muc_user:item[@affiliation='admin'][@jid='{lower_nick_one}%{irc_server_one}/~{nick_one}@irc.localhost'][@role='moderator']", + expect_stanza("/presence[@to='{jid_one}/{resource_two}'][@from='#foo%{irc_server_one}/{nick_one}']/muc_user:x/muc_user:item[@affiliation='admin'][@jid='{lower_nick_one}%{irc_server_one}/~{nick_one}@{irc_host_one}'][@role='moderator']", "/presence/muc_user:x/muc_user:status[@code='110']"), # Receive the history message expect_stanza("/message[@from='#foo%{irc_server_one}/{nick_one}']/body[text()='coucou']", diff --git a/tests/end_to_end/scenarios/channel_history_on_fixed_server.py b/tests/end_to_end/scenarios/channel_history_on_fixed_server.py index ad3701b..8a33bb5 100644 --- a/tests/end_to_end/scenarios/channel_history_on_fixed_server.py +++ b/tests/end_to_end/scenarios/channel_history_on_fixed_server.py @@ -11,7 +11,7 @@ scenario = ( # Second user joins send_stanza(""), - expect_stanza("/presence[@to='{jid_one}/{resource_two}'][@from='#foo@{biboumi_host}/{nick_one}']/muc_user:x/muc_user:item[@affiliation='admin'][@jid='{lower_nick_one}@{biboumi_host}/~{nick_one}@irc.localhost'][@role='moderator']", + expect_stanza("/presence[@to='{jid_one}/{resource_two}'][@from='#foo@{biboumi_host}/{nick_one}']/muc_user:x/muc_user:item[@affiliation='admin'][@jid='{lower_nick_one}@{biboumi_host}/~{nick_one}@{irc_host_one}'][@role='moderator']", "/presence/muc_user:x/muc_user:status[@code='110']"), # Receive the history message expect_stanza("/message[@from='#foo@{biboumi_host}/{nick_one}']/body[text()='coucou']", diff --git a/tests/end_to_end/scenarios/channel_join_with_password.py b/tests/end_to_end/scenarios/channel_join_with_password.py index e9873b1..52af7f2 100644 --- a/tests/end_to_end/scenarios/channel_join_with_password.py +++ b/tests/end_to_end/scenarios/channel_join_with_password.py @@ -19,13 +19,13 @@ scenario = ( send_stanza(" SECRET"), expect_unordered( [ - "/presence[@to='{jid_one}/{resource_one}'][@from='#foo%{irc_server_one}/{nick_two}']/muc_user:x/muc_user:item[@affiliation='none'][@role='participant'][@jid='{lower_nick_two}%{irc_server_one}/~{nick_two}@irc.localhost']" + "/presence[@to='{jid_one}/{resource_one}'][@from='#foo%{irc_server_one}/{nick_two}']/muc_user:x/muc_user:item[@affiliation='none'][@role='participant'][@jid='{lower_nick_two}%{irc_server_one}/~{nick_two}@{irc_host_one}']" ], [ "/presence[@to='{jid_two}/{resource_one}'][@from='#foo%{irc_server_one}/{nick_one}']/muc_user:x/muc_user:item[@affiliation='admin'][@role='moderator']" ], [ - "/presence[@to='{jid_two}/{resource_one}'][@from='#foo%{irc_server_one}/{nick_two}']/muc_user:x/muc_user:item[@affiliation='none'][@jid='{lower_nick_two}%{irc_server_one}/~{nick_two}@irc.localhost'][@role='participant']", + "/presence[@to='{jid_two}/{resource_one}'][@from='#foo%{irc_server_one}/{nick_two}']/muc_user:x/muc_user:item[@affiliation='none'][@jid='{lower_nick_two}%{irc_server_one}/~{nick_two}@{irc_host_one}'][@role='participant']", "/presence/muc_user:x/muc_user:status[@code='110']" ], [ diff --git a/tests/end_to_end/scenarios/channel_join_with_two_users.py b/tests/end_to_end/scenarios/channel_join_with_two_users.py index 0e36db2..1ea52e2 100644 --- a/tests/end_to_end/scenarios/channel_join_with_two_users.py +++ b/tests/end_to_end/scenarios/channel_join_with_two_users.py @@ -8,13 +8,13 @@ scenario = ( sequences.connection("irc.localhost", '{jid_two}/{resource_one}'), expect_unordered( [ - "/presence[@to='{jid_one}/{resource_one}'][@from='#foo%{irc_server_one}/{nick_two}']/muc_user:x/muc_user:item[@affiliation='none'][@role='participant'][@jid='{lower_nick_two}%{irc_server_one}/~{nick_two}@irc.localhost']" + "/presence[@to='{jid_one}/{resource_one}'][@from='#foo%{irc_server_one}/{nick_two}']/muc_user:x/muc_user:item[@affiliation='none'][@role='participant'][@jid='{lower_nick_two}%{irc_server_one}/~{nick_two}@{irc_host_one}']" ], [ "/presence[@to='{jid_two}/{resource_one}'][@from='#foo%{irc_server_one}/{nick_one}']/muc_user:x/muc_user:item[@affiliation='admin'][@role='moderator']" ], [ - "/presence[@to='{jid_two}/{resource_one}'][@from='#foo%{irc_server_one}/{nick_two}']/muc_user:x/muc_user:item[@affiliation='none'][@jid='{lower_nick_two}%{irc_server_one}/~{nick_two}@irc.localhost'][@role='participant']", + "/presence[@to='{jid_two}/{resource_one}'][@from='#foo%{irc_server_one}/{nick_two}']/muc_user:x/muc_user:item[@affiliation='none'][@jid='{lower_nick_two}%{irc_server_one}/~{nick_two}@{irc_host_one}'][@role='participant']", "/presence/muc_user:x/muc_user:status[@code='110']" ], [ diff --git a/tests/end_to_end/scenarios/channel_messages.py b/tests/end_to_end/scenarios/channel_messages.py index 8215094..567e6ff 100644 --- a/tests/end_to_end/scenarios/channel_messages.py +++ b/tests/end_to_end/scenarios/channel_messages.py @@ -11,10 +11,10 @@ scenario = ( # Our presence, sent to the other user, and ourself expect_unordered( - ["/presence[@to='{jid_one}/{resource_one}'][@from='#foo%{irc_server_one}/{nick_two}']/muc_user:x/muc_user:item[@affiliation='none'][@jid='{lower_nick_two}%{irc_server_one}/~{nick_two}@irc.localhost'][@role='participant']"], + ["/presence[@to='{jid_one}/{resource_one}'][@from='#foo%{irc_server_one}/{nick_two}']/muc_user:x/muc_user:item[@affiliation='none'][@jid='{lower_nick_two}%{irc_server_one}/~{nick_two}@{irc_host_one}'][@role='participant']"], ["/presence[@to='{jid_two}/{resource_one}'][@from='#foo%{irc_server_one}/{nick_one}']/muc_user:x/muc_user:item[@affiliation='admin'][@role='moderator']"], [ - "/presence[@to='{jid_two}/{resource_one}'][@from='#foo%{irc_server_one}/{nick_two}']/muc_user:x/muc_user:item[@affiliation='none'][@jid='{lower_nick_two}%{irc_server_one}/~{nick_two}@irc.localhost'][@role='participant']", + "/presence[@to='{jid_two}/{resource_one}'][@from='#foo%{irc_server_one}/{nick_two}']/muc_user:x/muc_user:item[@affiliation='none'][@jid='{lower_nick_two}%{irc_server_one}/~{nick_two}@{irc_host_one}'][@role='participant']", "/presence/muc_user:x/muc_user:status[@code='110']" ], ["/message[@from='#foo%{irc_server_one}'][@type='groupchat']/subject[not(text())]"], diff --git a/tests/end_to_end/scenarios/multiline_message.py b/tests/end_to_end/scenarios/multiline_message.py index 73e9331..594761b 100644 --- a/tests/end_to_end/scenarios/multiline_message.py +++ b/tests/end_to_end/scenarios/multiline_message.py @@ -38,10 +38,10 @@ scenario = ( sequences.connection("irc.localhost", '{jid_two}/{resource_one}'), # Our presence, sent to the other user expect_unordered( - ["/presence[@to='{jid_one}/{resource_one}'][@from='#foo%{irc_server_one}/{nick_two}']/muc_user:x/muc_user:item[@affiliation='none'][@jid='{lower_nick_two}%{irc_server_one}/~{nick_two}@irc.localhost'][@role='participant']"], + ["/presence[@to='{jid_one}/{resource_one}'][@from='#foo%{irc_server_one}/{nick_two}']/muc_user:x/muc_user:item[@affiliation='none'][@jid='{lower_nick_two}%{irc_server_one}/~{nick_two}@{irc_host_one}'][@role='participant']"], ["/presence[@to='{jid_two}/{resource_one}'][@from='#foo%{irc_server_one}/{nick_one}']/muc_user:x/muc_user:item[@affiliation='admin'][@role='moderator']"], [ - "/presence[@to='{jid_two}/{resource_one}'][@from='#foo%{irc_server_one}/{nick_two}']/muc_user:x/muc_user:item[@affiliation='none'][@jid='{lower_nick_two}%{irc_server_one}/~{nick_two}@irc.localhost'][@role='participant']", + "/presence[@to='{jid_two}/{resource_one}'][@from='#foo%{irc_server_one}/{nick_two}']/muc_user:x/muc_user:item[@affiliation='none'][@jid='{lower_nick_two}%{irc_server_one}/~{nick_two}@{irc_host_one}'][@role='participant']", "/presence/muc_user:x/muc_user:status[@code='110']" ], ["/message[@from='#foo%{irc_server_one}'][@type='groupchat']/subject[not(text())]"] diff --git a/tests/end_to_end/scenarios/raw_message.py b/tests/end_to_end/scenarios/raw_message.py index 98df0ea..efce8e7 100644 --- a/tests/end_to_end/scenarios/raw_message.py +++ b/tests/end_to_end/scenarios/raw_message.py @@ -7,5 +7,5 @@ scenario = ( expect_stanza("/message"), send_stanza("WHOIS {nick_one}"), - expect_stanza("/message[@from='{irc_server_one}'][@type='chat']/body[text()='irc.localhost: {nick_one} ~{nick_one} irc.localhost * {nick_one}']"), + expect_stanza("/message[@from='{irc_server_one}'][@type='chat']/body[text()='{irc_host_one}: {nick_one} ~{nick_one} {irc_host_one} * {nick_one}']"), ) diff --git a/tests/end_to_end/scenarios/raw_message_fixed_irc_server.py b/tests/end_to_end/scenarios/raw_message_fixed_irc_server.py index b5006c7..86fe7ed 100644 --- a/tests/end_to_end/scenarios/raw_message_fixed_irc_server.py +++ b/tests/end_to_end/scenarios/raw_message_fixed_irc_server.py @@ -9,6 +9,6 @@ scenario = ( expect_stanza("/message"), send_stanza("WHOIS {nick_one}"), - expect_stanza("/message[@from='{biboumi_host}'][@type='chat']/body[text()='irc.localhost: {nick_one} ~{nick_one} irc.localhost * {nick_one}']"), + expect_stanza("/message[@from='{biboumi_host}'][@type='chat']/body[text()='{irc_host_one}: {nick_one} ~{nick_one} {irc_host_one} * {nick_one}']"), ) diff --git a/tests/end_to_end/scenarios/sasl.py b/tests/end_to_end/scenarios/sasl.py index 9f2a27a..97dd2fd 100644 --- a/tests/end_to_end/scenarios/sasl.py +++ b/tests/end_to_end/scenarios/sasl.py @@ -86,7 +86,9 @@ scenario = ( expect_stanza("/iq[@type='result']/commands:command[@node='configure'][@status='completed']/commands:note[@type='info'][text()='Configuration successfully applied.']"), send_stanza(""), - # Here, the 6 connecting… connected messages from the connection attempt + # Here, the 8 connecting… connected messages from the connection attempt + expect_stanza("/message"), + expect_stanza("/message"), expect_stanza("/message"), expect_stanza("/message"), expect_stanza("/message"), diff --git a/tests/end_to_end/sequences.py b/tests/end_to_end/sequences.py index f151bc7..647c787 100644 --- a/tests/end_to_end/sequences.py +++ b/tests/end_to_end/sequences.py @@ -26,12 +26,14 @@ def connection_begin(irc_host, jid, expected_irc_presence=False, fixed_irc_serve if expected_irc_presence: result += (expect_stanza("/presence[@from='" + irc_host + "@biboumi.localhost']"),) - if login is not None: - result += (expect_stanza("/message/body[text()='irc.localhost: You are now logged in as %s']" % (login,)),) result += ( expect_stanza("/message/body[text()='irc.localhost: *** Looking up your hostname...']"), expect_stanza("/message/body[text()='irc.localhost: *** Found your hostname']") ) + + if login is not None: + result += (expect_stanza("/message/body[text()='irc.localhost: You are now logged in as %s']" % (login,)),) + return result def connection_tls_begin(irc_host, jid, fixed_irc_server): @@ -61,12 +63,12 @@ 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')]" irc_host = 'irc.localhost' return ( - expect_stanza("/message/body[re:test(text(), '%s')]" % (r'^%s: Your host is %s, running version oragono-2\.0\.0(-[a-z0-9]+)? $' % (irc_host, irc_host))), + expect_stanza("/message/body[re:test(text(), '%s')]" % (r'^%s: Your host is %s, running version ergo-2\.\d+\.\d+(-[a-z0-9]+)? $' % (irc_host, 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+ server\(s\)$' % irc_host)), - expect_stanza(xpath_re % ("%s: \d+ IRC Operators online" % irc_host,)), - expect_stanza(xpath_re % ("%s: \d+ unregistered connections" % irc_host,)), - expect_stanza(xpath_re % ("%s: \d+ channels formed" % irc_host,)), + expect_stanza(xpath_re % ("%s: \\d+ IRC Operators online" % irc_host,)), + 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: \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)),