Skip to content

Commit

Permalink
ignore ipv6 tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SeverinAlexB committed Jan 16, 2025
1 parent ea539b8 commit 0e4562a
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 42 deletions.
6 changes: 1 addition & 5 deletions cli/src/external_ip/providers/external_ip_resolver.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::{
future::Future,
net::{AddrParseError, Ipv4Addr, Ipv6Addr, TcpListener},
net::{AddrParseError, Ipv4Addr, Ipv6Addr},
pin::Pin,
};

Expand Down Expand Up @@ -60,7 +60,3 @@ pub async fn resolve_ipv6_with_url<T: IntoUrl>(url: T) -> Result<Ipv6Addr, Exter
let ip: Ipv6Addr = text.parse()?;
Ok(ip)
}

pub fn is_ipv6_available() -> bool {
TcpListener::bind("[::1]:0").is_ok()
}
10 changes: 3 additions & 7 deletions cli/src/external_ip/providers/icanhazip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ pub fn get_resolver() -> ProviderResolver {

#[cfg(test)]
mod tests {
use crate::external_ip::providers::external_ip_resolver::is_ipv6_available;

use super::*;

#[tokio::test]
Expand All @@ -32,12 +30,10 @@ mod tests {
assert!(ip.is_ok());
}

#[ignore = "Github runners don't support ipv6 request."]
#[tokio::test]
async fn test_ipv6() {
if is_ipv6_available() {
// Only run test if ipv6 is available on this system.
let ip = resolve_ipv6().await;
assert!(ip.is_ok());
}
let ip = resolve_ipv6().await;
assert!(ip.is_ok());
}
}
10 changes: 3 additions & 7 deletions cli/src/external_ip/providers/identme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ pub fn get_resolver() -> ProviderResolver {

#[cfg(test)]
mod tests {
use crate::external_ip::providers::external_ip_resolver::is_ipv6_available;

use super::*;

#[tokio::test]
Expand All @@ -32,12 +30,10 @@ mod tests {
assert!(ip.is_ok());
}

#[ignore = "Github runners don't support ipv6 request."]
#[tokio::test]
async fn test_ipv6() {
if is_ipv6_available() {
// Only run test if ipv6 is available on this system.
let ip = resolve_ipv6().await;
assert!(ip.is_ok());
}
let ip = resolve_ipv6().await;
assert!(ip.is_ok());
}
}
10 changes: 3 additions & 7 deletions cli/src/external_ip/providers/ipifyorg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ pub fn get_resolver() -> ProviderResolver {

#[cfg(test)]
mod tests {
use crate::external_ip::providers::external_ip_resolver::is_ipv6_available;

use super::*;

#[tokio::test]
Expand All @@ -32,12 +30,10 @@ mod tests {
assert!(ip.is_ok());
}

#[ignore = "Github runners don't support ipv6 request."]
#[tokio::test]
async fn test_ipv6() {
if is_ipv6_available() {
// Only run test if ipv6 is available on this system.
let ip = resolve_ipv6().await;
assert!(ip.is_ok());
}
let ip = resolve_ipv6().await;
assert!(ip.is_ok());
}
}
12 changes: 4 additions & 8 deletions cli/src/external_ip/providers/ipinfoio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,18 @@ pub fn get_resolver() -> ProviderResolver {

#[cfg(test)]
mod tests {
use crate::external_ip::providers::external_ip_resolver::is_ipv6_available;

use super::*;

#[tokio::test]
async fn test_ipv4() {
let ip = resolve_ipv4().await;
ip.expect("Valid ipv4");
assert!(ip.is_ok());
}

#[ignore = "Github runners don't support ipv6 request."]
#[tokio::test]
async fn test_ipv6() {
if is_ipv6_available() {
// Only run test if ipv6 is available on this system.
let ip = resolve_ipv6().await;
assert!(ip.is_ok());
}
let ip = resolve_ipv6().await;
assert!(ip.is_ok());
}
}
12 changes: 4 additions & 8 deletions cli/src/external_ip/providers/myip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,18 @@ pub fn get_resolver() -> ProviderResolver {

#[cfg(test)]
mod tests {
use crate::external_ip::providers::external_ip_resolver::is_ipv6_available;

use super::*;

#[tokio::test]
async fn test_ipv4() {
let ip = resolve_ipv4().await;
ip.expect("Valid ipv4");
assert!(ip.is_ok());
}

#[ignore = "Github runners don't support ipv6 request."]
#[tokio::test]
async fn test_ipv6() {
if is_ipv6_available() {
// Only run test if ipv6 is available on this system.
let ip = resolve_ipv6().await;
assert!(ip.is_ok());
}
let ip = resolve_ipv6().await;
assert!(ip.is_ok());
}
}
1 change: 1 addition & 0 deletions cli/src/external_ip/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ mod tests {
println!("{:?}", ip.expect("Valid ipv4"));
}

#[ignore = "Github runners don't support ipv6 request."]
#[tokio::test]
async fn test_ipv6() {
let ip = resolve_ipv6().await;
Expand Down

0 comments on commit 0e4562a

Please sign in to comment.