bundle ngircd config with test resources

This commit is contained in:
2026-08-13 11:35:45 +01:00
parent f2ecfcb61e
commit 0649e23ae6
2 changed files with 62 additions and 3 deletions
@@ -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>(
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 {