Skip to content

Commit

Permalink
tests(ipv6): Do not run IPv6 tests if the host doesn't support IPv6 (#…
Browse files Browse the repository at this point in the history
…1059)

Seems some of the cross environments simply don't do IPv6 at all.  In
that case there's no point in supporting IPv6.
  • Loading branch information
flub committed Jun 2, 2023
1 parent fcc74b8 commit e27cc77
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ jobs:
with:
submodules: recursive

- name: Install nightly
- name: Install Rust 1.67
# See https://github.com/cross-rs/cross/issues/1222
uses: dtolnay/rust-toolchain@1.67

Expand Down
3 changes: 3 additions & 0 deletions src/hp/magicsock/rebinding_conn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,9 @@ mod tests {

#[tokio::test]
async fn test_rebinding_conn_send_recv_ipv6() -> Result<()> {
if !crate::hp::netcheck::os_has_ipv6().await {
return Ok(());
}
rebinding_conn_send_recv(Network::Ipv6).await
}

Expand Down
2 changes: 1 addition & 1 deletion src/hp/netcheck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1721,7 +1721,7 @@ async fn recv_stun_once(sock: &UdpSocket, buf: &mut [u8], actor_addr: &ActorAddr
}

/// Test if IPv6 works at all, or if it's been hard disabled at the OS level.
async fn os_has_ipv6() -> bool {
pub(crate) async fn os_has_ipv6() -> bool {
// TODO: use socket2 to specify binding to ipv6
let udp = UdpSocket::bind("[::1]:0").await;
udp.is_ok()
Expand Down

0 comments on commit e27cc77

Please sign in to comment.