Skip to content

Commit 3f8d219

Browse files
committed
Deflake connect_error test
By making it less strict, removing the expect_no_events call. Fixes #1332.
1 parent 15b9977 commit 3f8d219

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

tests/tcp.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ fn connect_error() {
555555
let mut events = Events::with_capacity(16);
556556

557557
// Pick a "random" port that shouldn't be in use.
558-
let mut listener = match TcpStream::connect("127.0.0.1:38381".parse().unwrap()) {
558+
let mut stream = match TcpStream::connect("127.0.0.1:38381".parse().unwrap()) {
559559
Ok(l) => l,
560560
Err(ref e) if e.kind() == io::ErrorKind::ConnectionRefused => {
561561
// Connection failed synchronously. This is not a bug, but it
@@ -566,7 +566,7 @@ fn connect_error() {
566566
};
567567

568568
poll.registry()
569-
.register(&mut listener, Token(0), Interest::WRITABLE)
569+
.register(&mut stream, Token(0), Interest::WRITABLE)
570570
.unwrap();
571571

572572
'outer: loop {
@@ -580,9 +580,7 @@ fn connect_error() {
580580
}
581581
}
582582

583-
assert!(listener.take_error().unwrap().is_some());
584-
585-
expect_no_events(&mut poll, &mut events);
583+
assert!(stream.take_error().unwrap().is_some());
586584
}
587585

588586
#[test]

0 commit comments

Comments
 (0)