SwiftTesting: Enable in GitHubActions + peer uuids (#767)

This commit is contained in:
Islam
2025-10-07 12:40:20 +02:00
committed by GitHub
parent 0f23ed0a99
commit fbc15ea08f
3 changed files with 12 additions and 14 deletions
+1 -1
View File
@@ -24,4 +24,4 @@ jobs:
run: swift build
- name: Run Tests
run: swift test --parallel --disable-swift-testing # so it only runs xctests: https://github.com/swiftlang/swift-package-manager/issues/8529#issuecomment-2815711345
run: swift test --parallel
@@ -8,6 +8,7 @@
import Testing
import CryptoKit
import struct Foundation.UUID
@testable import bitchat
// TODO: Remove once MockBLEService is refactored to fix race condition
@@ -20,12 +21,10 @@ struct PrivateChatE2ETests {
private let mockKeychain: MockKeychain
init() {
MockBLEService.resetTestBus()
// Create services with unique peer IDs to avoid collision with other test suites
alice = MockBLEService(peerID: "PRIV_ALICE_", nickname: TestConstants.testNickname1)
bob = MockBLEService(peerID: "PRIV_BOB___", nickname: TestConstants.testNickname2)
charlie = MockBLEService(peerID: "PRIV_CHARLE", nickname: TestConstants.testNickname3)
// Create services with unique peer IDs to avoid any collision
alice = MockBLEService(peerID: PeerID(str: UUID().uuidString), nickname: TestConstants.testNickname1)
bob = MockBLEService(peerID: PeerID(str: UUID().uuidString), nickname: TestConstants.testNickname2)
charlie = MockBLEService(peerID: PeerID(str: UUID().uuidString), nickname: TestConstants.testNickname3)
mockKeychain = MockKeychain()
}
@@ -7,6 +7,7 @@
//
import Testing
import struct Foundation.UUID
@testable import bitchat
@Suite(.serialized)
@@ -20,13 +21,11 @@ struct PublicChatE2ETests {
private var receivedMessages: [String: [BitchatMessage]] = [:]
init() {
MockBLEService.resetTestBus()
// 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)
// Create mock services with unique peer IDs to avoid any collision
alice = MockBLEService(peerID: PeerID(str: UUID().uuidString), nickname: TestConstants.testNickname1)
bob = MockBLEService(peerID: PeerID(str: UUID().uuidString), nickname: TestConstants.testNickname2)
charlie = MockBLEService(peerID: PeerID(str: UUID().uuidString), nickname: TestConstants.testNickname3)
david = MockBLEService(peerID: PeerID(str: UUID().uuidString), nickname: TestConstants.testNickname4)
}
// MARK: - Basic Broadcasting Tests