Skip to content

Commit 2341936

Browse files
committed
Adding optional tests to showcase that it currently only works with electrs servers
1 parent 1290819 commit 2341936

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

Cargo.toml

+4
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,7 @@ debug-calls = []
4343
proxy = ["byteorder", "winapi", "libc"]
4444
use-rustls = ["webpki", "webpki-roots", "rustls"]
4545
use-openssl = ["openssl"]
46+
test_servers = ["default"]
47+
48+
[dev-dependencies]
49+
rstest = "^0.11"

tests/test_electrum_servers.rs

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
extern crate electrum_client;
2+
extern crate rstest;
3+
4+
use electrum_client::{Client, ElectrumApi};
5+
use rstest::rstest;
6+
7+
// picked some random servers from https://1209k.com/bitcoin-eye/ele.php
8+
#[cfg(feature = "test_servers")]
9+
#[rstest]
10+
#[case::electrs(["electrum.blockstream.info", "ax101.blockeng.ch", "ax102.blockeng.ch", "ulrichard.ch"])]
11+
#[case::electrumx(["electrumx-core.1209k.com", "skbxmit.coinjoined.com", "eai.coincited.net", "bitcoin.lu.ke"])]
12+
#[case::fulcrum(["poonode-bitcoin.duckdns.org", "btc.lastingcoin.net", "de.poiuty.com", "fullnode.titanconnect.ca"])]
13+
fn test_electrum_servers(#[case] servers: [&str; 4]) {
14+
for srv in servers {
15+
let url = "ssl://".to_string() + srv + ":50002";
16+
let client = Client::new(&url).unwrap();
17+
if let Err(err) = client.ping() {
18+
panic!("electrum server error {} : {:?}", url, err);
19+
}
20+
}
21+
}

0 commit comments

Comments
 (0)