Fix test suite peer ID collisions (#764)

Use unique peer IDs for each test suite to prevent global registry
collisions when Swift Testing runs suites in parallel.

- PrivateChatE2ETests: PRIV_* prefix
- PublicChatE2ETests: PUB_* prefix
- Update all peer ID references to use actual instance IDs

This fixes the race condition where simplePublicMessage() was receiving
duplicate deliveries due to registry contamination.

Co-authored-by: jack <jackjackbits@users.noreply.github.com>
This commit is contained in:
jack
2025-10-06 22:46:45 +02:00
committed by GitHub
co-authored by jack
parent eb13eec4c5
commit af6703cf24
2 changed files with 23 additions and 23 deletions
@@ -21,12 +21,12 @@ struct PublicChatE2ETests {
init() {
MockBLEService.resetTestBus()
// Create mock services
alice = MockBLEService(peerID: TestConstants.testPeerID1, nickname: TestConstants.testNickname1)
bob = MockBLEService(peerID: TestConstants.testPeerID2, nickname: TestConstants.testNickname2)
charlie = MockBLEService(peerID: TestConstants.testPeerID3, nickname: TestConstants.testNickname3)
david = MockBLEService(peerID: TestConstants.testPeerID4, nickname: TestConstants.testNickname4)
// Create mock services with unique peer IDs to avoid collision with other test suites
alice = MockBLEService(peerID: "PUB_ALICE__", nickname: TestConstants.testNickname1)
bob = MockBLEService(peerID: "PUB_BOB____", nickname: TestConstants.testNickname2)
charlie = MockBLEService(peerID: "PUB_CHARLIE", nickname: TestConstants.testNickname3)
david = MockBLEService(peerID: "PUB_DAVID__", nickname: TestConstants.testNickname4)
}
// MARK: - Basic Broadcasting Tests