mirror of
https://github.com/storytold/soundcraft.git
synced 2026-12-02 20:22:27 -05:00
test(automation): wait until a write on the reset socket fails (#1709)
Fixes #1708. The scheduled FreeBSD 15 x86_64 job has been failing tests::a_mutation_sent_on_the_second_attempt_and_not_answered_is_unconfirmed since #1538: the fake app never sees the mutation on the second connection (seen == 0), while the client already reports it unconfirmed. The test waited only until a read on the reset socket stopped timing out. On FreeBSD a later write can still succeed, so Remote::request treats the mutation as already sent and does not open a new connection. After the read-wait, this now loops until a write on that socket fails, then makes the call. The FreeBSD aarch64 job only cross-compiles tests; it does not run them, so a green aarch64 leg is not a test pass.
This commit is contained in:
1 parent
85623f28f9
commit
915481be1b
1 file changed
+11
-1
@@ -613,7 +613,11 @@ mod tests {
|
||||
});
|
||||
let (stream, _) = remote.connection().unwrap();
|
||||
writeln!(stream, "bytes the app never reads").unwrap();
|
||||
// Wait until the reset has arrived (the read stops timing out).
|
||||
// Wait until the reset has arrived (the read stops timing out) and a write on
|
||||
// this socket fails, so the call below cannot be counted as already sent on it.
|
||||
// On some stacks (FreeBSD among them) a read can see the close while a later
|
||||
// write still succeeds, which made the client report the mutation unconfirmed
|
||||
// without opening the second connection the test is checking.
|
||||
let mut byte = [0u8; 1];
|
||||
for _ in 0..20 {
|
||||
match stream.read(&mut byte) {
|
||||
@@ -621,6 +625,12 @@ mod tests {
|
||||
_ => break,
|
||||
}
|
||||
}
|
||||
for _ in 0..20 {
|
||||
if writeln!(stream, "probe").is_err() {
|
||||
break;
|
||||
}
|
||||
std::thread::sleep(Duration::from_millis(20));
|
||||
}
|
||||
let error = remote.call("engine.execute", json!({"command": "track.new"})).unwrap_err();
|
||||
assert_eq!(seen.load(Ordering::SeqCst), 1, "the call went out once, on the second connection: {error}");
|
||||
assert!(error.contains("may or may not have been executed"), "{error}");
|
||||
|
||||
Reference in new issue
Block a user