Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions Tests/MixerLinkTests/XAirDriverTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -102,18 +102,19 @@ struct XAirDriverTests {
var state = FakeXAirMixer.State()
state.channels[0] = .init(name: "Kick", color: 1)
state.answersMixState = false
state.usbRouting = Self.defaultRouting // answered, so the only silence is the mix state (#462)
let mixer = try await FakeXAirMixer(state)
// A 1 s timeout, so a loaded machine can still answer the names (#323); missing mix state still costs one
// timeout (under 3 s), not one per Source (18 s).
let driver = XAirDriver(endpoint: MixerEndpoint(host: "127.0.0.1", port: mixer.port), timeout: .seconds(1))
// The one unanswered query waits out this timeout; every other query is answered, however busy the machine.
let driver = XAirDriver(endpoint: MixerEndpoint(host: "127.0.0.1", port: mixer.port), timeout: Loopback.mixedTimeout)

let clock = ContinuousClock()
var sources: [Source] = []
let elapsed = try await clock.measure { sources = try await driver.sources(usbChannelCount: 18) }
let sources = try await driver.sources(usbChannelCount: 18)

#expect(try #require(sources.first).name == "Kick")
#expect(sources.allSatisfy { $0.isMuted == nil && $0.fader == nil && $0.inputSource == nil })
#expect(elapsed < .seconds(3), "one timeout, not one per Source")
// Counted, not timed: a clock limit failed on a busy CI runner with nothing wrong (ShowRecorder #1249). Each
// unanswered query costs one timeout, so one mix-state query asked is one timeout, not one per Source.
let mixStateQueries = mixer.queries.filter { $0.contains("/mix/") || $0.hasSuffix("/config/insrc") }
#expect(mixStateQueries == ["/ch/01/mix/on"], "asked once, then skipped for the other 17 Sources")
}

@Test("An unexpected reply for mute, fader or input source leaves that value unknown, not the Link down")
Expand Down
Loading