Skip to content

Commit

Permalink
fix: wait for the bootstrap of wireguard-linuxserver before running t…
Browse files Browse the repository at this point in the history
…he test (#407)
  • Loading branch information
VendettaReborn authored May 14, 2024
1 parent c69339e commit 79c18fb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
4 changes: 2 additions & 2 deletions clash/tests/data/config/wg_config/.donoteditthisfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ORIG_SERVERURL="36.161.169.198"
ORIG_SERVERPORT="51820"
ORIG_SERVERURL="127.0.0.1"
ORIG_SERVERPORT="10002"
ORIG_PEERDNS="10.13.13.1"
ORIG_PEERS="1"
ORIG_INTERFACE="10.13.13"
Expand Down
2 changes: 1 addition & 1 deletion clash/tests/data/config/wg_config/templates/peer.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Interface]
Address = ${CLIENT_IP}
PrivateKey = $(cat /config/${PEER_ID}/privatekey-${PEER_ID})
ListenPort = 10002
ListenPort = 51820
DNS = ${PEERDNS}

[Peer]
Expand Down
12 changes: 5 additions & 7 deletions clash_lib/src/proxy/wg/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ mod tests {
"PGID=1000",
"TZ=Etc/UTC",
"SERVERPORT=10002",
"SERVERURL=127.0.0.1",
"PEERS=1",
"PEERDNS=auto",
"INTERNAL_SUBNET=10.13.13.0",
Expand All @@ -321,7 +322,6 @@ mod tests {

#[tokio::test]
#[serial_test::serial]
#[ignore = "TODO: fix me please"]
async fn test_wg() -> anyhow::Result<()> {
let opts = HandlerOpts {
name: "wg".to_owned(),
Expand All @@ -345,11 +345,9 @@ mod tests {
// cannot run the ping pong test, since the wireguard server is running on bridge network mode
// and the `net.ipv4.conf.all.src_valid_mark` is not supported in the host network mode
// the latency test should be enough
run_test_suites_and_cleanup(
handler,
get_runner().await?,
&[Suite::LatencyTcp, Suite::DnsUdp],
)
.await
let runner = get_runner().await?;
// FIXME: wait for the startup of the test runner in a more elegant way
tokio::time::sleep(tokio::time::Duration::from_secs(2)).await;
run_test_suites_and_cleanup(handler, runner, &[Suite::LatencyTcp, Suite::DnsUdp]).await
}
}

0 comments on commit 79c18fb

Please sign in to comment.