Skip to content

Commit 98cb703

Browse files
committed
Drop test_local_timeout test case
The local timeout test was introduce in f30be3b as a wait to check that connection timeouts work. However, it uses a pretty flaky setup to begin with, requiring manual `iptables` rules in CI, and it leans on a dummy server implementation that doesn't actually do anything besides accepting the connection. However, as with protocol v1.6 we now only consider the connection successful (and for now return the `Client`) if the counterparty responded to our version negotiation, we're now incompatible with the dummy setup of `test_local_timeout`. Since I'm not sure how solid and important the specific test coverage is to begin with, I here opted to just drop the test case.
1 parent f0cffb3 commit 98cb703

2 files changed

Lines changed: 0 additions & 54 deletions

File tree

.github/workflows/cont_integration.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@ jobs:
3030
toolchain: ${{ matrix.rust }}
3131
- name: Test
3232
run: cargo test --verbose --all-features
33-
- name: Setup iptables for the timeout test
34-
run: sudo ip6tables -I INPUT 1 -p tcp -d ::1 --dport 60000 -j DROP
35-
- name: Timeout test
36-
run: cargo test -- --ignored test_local_timeout
3733
- run: cargo check --verbose --features=use-openssl
3834
- run: cargo check --verbose --no-default-features --features=proxy
3935
- run: cargo check --verbose --no-default-features --features=minimal

src/client.rs

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -412,54 +412,4 @@ mod tests {
412412

413413
assert!(!exhausted)
414414
}
415-
416-
#[test]
417-
#[ignore]
418-
fn test_local_timeout() {
419-
// This test assumes a couple things:
420-
// - that `localhost` is resolved to two IP addresses, `127.0.0.1` and `::1` (with the v6
421-
// one having higher priority)
422-
// - that the system silently drops packets to `[::1]:60000` or a different port if
423-
// specified through `TEST_ELECTRUM_TIMEOUT_PORT`
424-
//
425-
// this can be setup with: ip6tables -I INPUT 1 -p tcp -d ::1 --dport 60000 -j DROP
426-
// and removed with: ip6tables -D INPUT -p tcp -d ::1 --dport 60000 -j DROP
427-
//
428-
// The test tries to create a client to `localhost` and expects it to succeed, but only
429-
// after at least 2 seconds have passed which is roughly the timeout time for the first
430-
// try.
431-
432-
use std::net::TcpListener;
433-
use std::sync::mpsc::channel;
434-
use std::time::{Duration, Instant};
435-
436-
let endpoint =
437-
std::env::var("TEST_ELECTRUM_TIMEOUT_PORT").unwrap_or("localhost:60000".into());
438-
let (sender, receiver) = channel();
439-
440-
std::thread::spawn(move || {
441-
let listener = TcpListener::bind("127.0.0.1:60000").unwrap();
442-
sender.send(()).unwrap();
443-
444-
for _stream in listener.incoming() {
445-
std::thread::sleep(Duration::from_secs(60))
446-
}
447-
});
448-
449-
receiver
450-
.recv_timeout(Duration::from_secs(5))
451-
.expect("Can't start local listener");
452-
453-
let now = Instant::now();
454-
let client = Client::from_config(
455-
&endpoint,
456-
crate::config::ConfigBuilder::new()
457-
.timeout(Some(Duration::from_secs(5)))
458-
.build(),
459-
);
460-
let elapsed = now.elapsed();
461-
462-
assert!(client.is_ok());
463-
assert!(elapsed > Duration::from_secs(2));
464-
}
465415
}

0 commit comments

Comments
 (0)