From 5868607156e7dda0d1c4ee0a3c6e9d034855f02a Mon Sep 17 00:00:00 2001 From: shrapnelnet Date: Thu, 13 Aug 2026 11:35:45 +0100 Subject: [PATCH] bundle ngircd config with test resources Signed-off-by: observer --- .../com/shr4pnel/ferretirc/IrcClientTest.kt | 10 +++- src/test/resources/ngircd.conf | 55 +++++++++++++++++++ 2 files changed, 62 insertions(+), 3 deletions(-) create mode 100644 src/test/resources/ngircd.conf diff --git a/src/test/kotlin/com/shr4pnel/ferretirc/IrcClientTest.kt b/src/test/kotlin/com/shr4pnel/ferretirc/IrcClientTest.kt index edad587..85a75d1 100644 --- a/src/test/kotlin/com/shr4pnel/ferretirc/IrcClientTest.kt +++ b/src/test/kotlin/com/shr4pnel/ferretirc/IrcClientTest.kt @@ -29,12 +29,16 @@ class IrcClientTest { @BeforeAll fun setup() { val logFile = File("src/test/resources/logs/ngircd.log") + val ngircdConfigPath = javaClass.classLoader.getResource("ngircd.conf")!!.path logFile.createNewFile() processes = ProcessBuilder.startPipeline( listOf( - ProcessBuilder("ngircd", "-dn").redirectErrorStream(true), - ProcessBuilder("ts", "(%H:%M:%S)").redirectErrorStream(true), - ProcessBuilder("sed", "-ue", "s/\\[[^][]*\\]//g").redirectOutput(logFile) + // Run IRC server in [-d] debug log mode, with [-n] no daemon, using config [-f] file at path + ProcessBuilder("ngircd", "-dnf", ngircdConfigPath).redirectErrorStream(true), + // Remove unhelpful default ngircd info [PID. relative time, GID?] + ProcessBuilder("sed", "-ue", "s/\\[[^][]*\\]//g"), + // Add relative timestamp + ProcessBuilder("ts", "-s", "%H:%M:%.S").redirectOutput(logFile) ) ) client.scope.launch { diff --git a/src/test/resources/ngircd.conf b/src/test/resources/ngircd.conf new file mode 100644 index 0000000..969e989 --- /dev/null +++ b/src/test/resources/ngircd.conf @@ -0,0 +1,55 @@ +[GLOBAL] + Name = localhost.host + AdminInfo1 = FerretIRC Testing Server + AdminInfo2 = United Kingdom + AdminEMail = admin@shr4pnel.com + HelpFile = /usr/share/doc/ngircd/Commands.txt + ;Info = ngIRCd 28 + Listen = 127.0.0.1 + ;MotdFile = + MotdPhrase = "happy hunting!" + ;Network = + ;Password = + ;PidFile = + Ports = 6667 + ServerGID = 1000 + ServerUID = 1000 + +[LIMITS] + ConnectRetry = 60 + IdleTimeout = 0 + MaxConnections = 0 + MaxConnectionsIP = 5 + MaxJoins = 10 + MaxNickLength = 9 + MaxPenaltyTime = 0 + MaxListSize = 100 + PingTimeout = 120 + PongTimeout = 20 + +[OPTIONS] + AllowedChannelTypes = #&+ + AllowRemoteOper = no + ChrootDir = + CloakHost = + CloakHostModeX = +; CloakHostSalt = koxDpiu[UIF8gF8oHsmtpF8Z?ftyyC(Y + CloakUserToNick = no + ConnectIPv4 = yes + ConnectIPv6 = yes + DefaultChannelModes = + DefaultUserModes = + DNS = no +; IncludeDir = /etc/ngircd.conf.d + MorePrivacy = no + NoticeBeforeRegistration = no + OperCanUseMode = no + OperChanPAutoOp = yes + OperServerMode = no + PAM = no + PAMIsOptional = yes + PAMServiceName = ngircd + RequireAuthPing = no + ScrubCTCP = no + SyslogFacility = local5 + WebircPassword =