gatewayd: serve_answers waits for every reply it reads
nobody_else_and_nothing_else_answers_it read five replies after waiting only for the first, so it failed whenever the other four were not posted yet. It failed once in a full `make gate` run, when many test binaries ran at once. The helper now waits for as many posts as the test reads. The M4b plan's copy is left as it was handed over. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -105,10 +105,13 @@ impl Stage {
|
||||
.posted(&post(&id('c', n), user, DM, root, text, at), "D");
|
||||
}
|
||||
|
||||
/// The text posted in the thread after the approval, within five seconds.
|
||||
fn replies(&self, after: usize) -> Vec<String> {
|
||||
let posts = self.mm.wait_posts(after + 1, WAIT);
|
||||
posts[after..].iter().map(|(_, _, t)| t.clone()).collect()
|
||||
/// The first `count` posts after the first `after`, waiting up to five seconds for all of them.
|
||||
fn replies(&self, after: usize, count: usize) -> Vec<String> {
|
||||
let posts = self.mm.wait_posts(after + count, WAIT);
|
||||
posts[after..after + count]
|
||||
.iter()
|
||||
.map(|(_, _, t)| t.clone())
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,7 +196,7 @@ fn nobody_else_and_nothing_else_answers_it() {
|
||||
s.command(4, KYLE, &root, "!approve 7", 7);
|
||||
s.command(5, KYLE, &root, "!approve 42 please", 8);
|
||||
assert_eq!(
|
||||
s.replies(1)[..5],
|
||||
s.replies(1, 5),
|
||||
[
|
||||
NOT_APPROVER.to_string(),
|
||||
"approval 42 is answered in its own thread".to_string(),
|
||||
|
||||
Reference in New Issue
Block a user