Skip to content

Commit cf35b86

Browse files
committed
Adjusted DH1080KeyExchangeTests.
1 parent 248a7b8 commit cf35b86

3 files changed

Lines changed: 11 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7474
- **CTCP Tests**: Fixed hex escape sequence bug in tests - `\x01ACTION` was parsed as `\x01A` (0x01A = Ƭ) + "CTION", changed to `\u0001` to prevent C# from interpreting following hex digits as part of escape sequence
7575
- **IrcConnection integration tests**: Fixed timing/synchronization issues by adding proper delays for CAP negotiation and event processing, Task.Delay(200ms) after client connect, 700ms for event processing
7676
- **IrcConnection ConnectAsync_WithPassword test**: Fixed race condition where PASS command was sent before WaitForMessageAsync started listening, causing null passMsg in CI environments (especially Linux). Now starts message listener before connecting with 100ms delay and 5s timeout.
77+
- **DH1080 ECB mode test**: Fixed false positive in `CreateInitMessage_WithEcb_DoesNotContainCbc` test where Base64-encoded public key randomly contained "cbc" substring (e.g., `TcbcHTj1Lt`). Changed assertion from `.NotContain("cbc")` to `.NotStartWith("DH1080_INIT_cbc")` and `.NotEndWith(" CBC")` to only check for CBC mode indicators, not random Base64 content.
78+
- **IrcConnection ReceiveMessage_PrivateMessage test**: Fixed race condition with insufficient delay (200ms → 700ms) for message processing, added 200ms delay for CAP negotiation before server greeting.
7779
- Test projects for Core, Agent, Relay, and UI (xUnit + FluentAssertions)
7880
- **Munin.Agent**: New autonomous IRC bot agent inspired by Eggdrop
7981
- Runs independently 24/7 as Windows Service or Linux systemd service

tests/Munin.Core.Tests/Dh1080KeyExchangeTests.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,11 @@ public void CreateInitMessage_WithEcb_DoesNotContainCbc()
9999

100100
var message = dh.CreateInitMessage(useCbc: false);
101101

102+
// Should start with DH1080_INIT (not DH1080_INIT_cbc)
102103
message.Should().StartWith("DH1080_INIT ");
103-
message.Should().NotContain("cbc");
104-
message.Should().NotContain("CBC");
104+
message.Should().NotStartWith("DH1080_INIT_cbc");
105+
// Should not end with CBC suffix (FiSH-irssi format)
106+
message.Should().NotEndWith(" CBC");
105107
}
106108

107109
[Fact]

tests/Munin.Core.Tests/IrcConnectionTests.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,12 +373,16 @@ public async Task ReceiveMessage_PrivateMessage_RaisesPrivateMessageEvent()
373373
await _mockServer.StartAsync();
374374
var connectTask = connection.ConnectAsync();
375375
await _mockServer.WaitForClientAsync(TimeSpan.FromSeconds(5));
376+
377+
// Give time for CAP negotiation
378+
await Task.Delay(200);
379+
376380
await _mockServer.SendServerGreetingAsync("TestUser");
377381
await connectTask.WaitAsync(TimeSpan.FromSeconds(5));
378382

379383
// Act
380384
await _mockServer.SendAsync(":bob!user@host PRIVMSG TestUser :Private message");
381-
await Task.Delay(200);
385+
await Task.Delay(700); // Give time for message processing
382386

383387
// Assert
384388
receivedMessage.Should().Be("Private message");

0 commit comments

Comments
 (0)