Skip to content

Add tools/testnet: local linked-network test kit with link and CAP tests - #270

Open
devin-ai-integration[bot] wants to merge 2 commits into
masterfrom
devin/1791946917-testnet
Open

devin-ai-integration[bot] wants to merge 2 commits into
masterfrom
devin/1791946917-testnet

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Summary

Adds tools/testnet/, a stdlib-only Python kit that starts a three-server network on 127.0.0.1 from a built src/ircd, runs unittest tests against it, and shuts it down. It needs only python3 and the openssl CLI, so it runs the same on a laptop (Linux/macOS) or in CI. New IRCv3 caps can each add a tests/test_<cap>.py.

tools/testnet/testnet.py test [--ircd path] [--pattern 'test_cap*'] [--keep]
tools/testnet/testnet.py up | down
hub.test (16667, TLS 16697)
 |-- leaf1.test  plain link, flags HZ
 `-- leaf2.test  TLS link,   flags HSZ

Things that aren't obvious from the code:

  • Throttle: every client and link comes from 127.0.0.1, so the default throttle (3 connects in 15s) z-lines the tests. When each server starts, the launcher opens one oper "control" connection and sends SET THROTTLE ENABLE off. The hub is turned off before the leaves start, and connects that fail with "connection refused" are retried and don't count toward the throttle. The hub's control connection is then used to poll LINKS until all three servers are linked.
  • Propagation races: tests call wait_for_nick() (repeats WHOIS until it gets 311) before messaging a user on another server, and accept the topic either as 332 or as a later TOPIC line.
  • ircd -t keeps the server in the foreground, so the launcher tracks each server's pid and down stops it with SIGTERM.
  • tests/test_cap.py skips itself when CAP returns 421, so it skips on current master and runs once Add IRCv3 CAP negotiation skeleton with a static capability registry #269 is merged.

Tests:

  • test_link.py: LINKS, PRIVMSG leaf↔leaf across the hub, remote WHOIS, channel JOIN/TOPIC/PRIVMSG across links, NICK and QUIT propagation, and the TLS client port.
  • test_cap.py: the CAP LS/LIST/REQ/END behavior from Add IRCv3 CAP negotiation skeleton with a static capability registry #269, including:
    • no name=value in CAP LIST
    • 461 for a REQ with an empty or all-space list
    • an over-long REQ is NAKed on a whole-token boundary, within 510 bytes, with no change

Results, run locally:

Link to Devin session: https://app.devin.ai/sessions/9c171b7fd3d341178646e3cce156ddd7
Open in Devin Desktop: https://app.devin.ai/desktop/session/9c171b7fd3d341178646e3cce156ddd7?variant=devin
Requested by: @eaescob

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant