Skip to content

Commit 9734377

Browse files
committed
test(plan88): Add UDS transport tests to RelayManagerTests
Tests for: - testUDSTransportDescription: Verifies UDS transport has 'uds:' prefix - testUDSWithVirtioFSMountPath: Verifies explicit Virtio-FS mount path handling These verify UDS Virtio-FS relay transport behavior (Plan 88 Decision 3).
1 parent 5d89804 commit 9734377

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

Tests/Container-Compose-Tests/Networking/RelayManagerTests.swift

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -868,6 +868,46 @@ func testSocketPathLengthMargins() async throws {
868868
let margin = 104 - actualCount
869869
XCTAssertGreaterThanOrEqual(margin, 16, "Production path should have at least 16-char margin, had \(margin)")
870870
}
871+
872+
func testUDSTransportDescription() async throws {
873+
// Plan 88: Verify UDS transport description format
874+
let socketPath = "/tmp/test-uds-description.sock"
875+
let eventLog = RelayEventLog()
876+
877+
let relay = try UDSVirtioFSRelay(
878+
socketPath: socketPath,
879+
createSignalSocket: true,
880+
eventLog: eventLog
881+
)
882+
883+
let transport = await relay.transportType
884+
let description = transport.description
885+
886+
XCTAssertTrue(description.hasPrefix("uds:"), "UDS transport should have 'uds:' prefix, got: \(description)")
887+
XCTAssertTrue(description.contains(socketPath), "Description should contain socket path")
888+
}
889+
890+
func testUDSWithVirtioFSMountPath() async throws {
891+
// Plan 88: Verify UDS relay accepts explicit Virtio-FS mount path
892+
let socketPath = "/Users/test/.containers/Volumes/myapp/sockets/test.sock"
893+
let virtioMount = "/Users/test/.containers/Volumes/myapp"
894+
let eventLog = RelayEventLog()
895+
896+
let relay = try UDSVirtioFSRelay(
897+
socketPath: socketPath,
898+
virtioFSMountPath: virtioMount,
899+
createSignalSocket: false,
900+
eventLog: eventLog
901+
)
902+
903+
let transport = await relay.transportType
904+
if case .uds(let path, let mount) = transport {
905+
XCTAssertEqual(path, socketPath)
906+
XCTAssertEqual(mount, virtioMount)
907+
} else {
908+
XCTFail("Transport should be UDS")
909+
}
910+
}
871911
}
872912

873913
// MARK: - Virtio-FS Detection Tests (Plan 84)

0 commit comments

Comments
 (0)