Skip to content

Commit

Permalink
Add tests for vsock link
Browse files Browse the repository at this point in the history
  • Loading branch information
sashacmc committed Mar 18, 2024
1 parent ac2e5ff commit b6094e7
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 1 deletion.
2 changes: 1 addition & 1 deletion DEFAULT_CONFIG.json5
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
link: {
/// An optional whitelist of protocols to be used for accepting and opening sessions.
/// If not configured, all the supported protocols are automatically whitelisted.
/// The supported protocols are: ["tcp" , "udp", "tls", "quic", "ws", "unixsock-stream"]
/// The supported protocols are: ["tcp" , "udp", "tls", "quic", "ws", "unixsock-stream", "vsock"]
/// For example, to only enable "tls" and "quic":
// protocols: ["tls", "quic"],
/// Configure the zenoh TX parameters of a link
Expand Down
14 changes: 14 additions & 0 deletions io/zenoh-transport/tests/endpoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,3 +408,17 @@ AXVFFIgCSluyrolaD6CWD9MqOex4YOfJR2bNxI7lFvuK4AwjyUJzT1U1HXib17mM
let endpoints = vec![endpoint];
run(&endpoints).await;
}

#[cfg(all(feature = "transport_vsock", target_os = "linux"))]
#[tokio::test(flavor = "multi_thread", worker_threads = 4)]
async fn endpoint_vsock() {
let _ = env_logger::try_init();
// Define the locators
let endpoints: Vec<EndPoint> = vec![
"vsock/-1:1234".parse().unwrap(),
"vsock/VMADDR_CID_ANY:VMADDR_PORT_ANY".parse().unwrap(),
"vsock/VMADDR_CID_LOCAL:2345".parse().unwrap(),
"vsock/VMADDR_CID_LOCAL:VMADDR_PORT_ANY".parse().unwrap(),
];
run(&endpoints).await;
}
14 changes: 14 additions & 0 deletions io/zenoh-transport/tests/transport_whitelist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,17 @@ async fn transport_whitelist_unixpipe() {
// Run
run(&endpoints).await;
}

#[cfg(all(feature = "transport_vsock", target_os = "linux"))]
#[tokio::test(flavor = "multi_thread", worker_threads = 4)]
async fn transport_whitelist_vsock() {
let _ = env_logger::try_init();

// Define the locators
let endpoints: Vec<EndPoint> = vec![
"vsock/VMADDR_CID_LOCAL:17000".parse().unwrap(),
"vsock/1:17001".parse().unwrap(),
];
// Run
run(&endpoints).await;
}
8 changes: 8 additions & 0 deletions io/zenoh-transport/tests/unicast_intermittent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -464,3 +464,11 @@ async fn transport_unixpipe_intermittent_for_lowlatency_transport() {
.unwrap();
lowlatency_transport_intermittent(&endpoint).await;
}

#[cfg(all(feature = "transport_vsock", target_os = "linux"))]
#[tokio::test(flavor = "multi_thread", worker_threads = 4)]
async fn transport_vsock_intermittent() {
let _ = env_logger::try_init();
let endpoint: EndPoint = "vsock/VMADDR_CID_LOCAL:17000".parse().unwrap();
universal_transport_intermittent(&endpoint).await;
}
9 changes: 9 additions & 0 deletions io/zenoh-transport/tests/unicast_multilink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -722,4 +722,13 @@ R+IdLiXcyIkg0m9N8I17p0ljCSkbrgGMD3bbePRTfg==

multilink_transport(&endpoint).await;
}

#[cfg(all(feature = "transport_vsock", target_os = "linux"))]
#[tokio::test(flavor = "multi_thread", worker_threads = 4)]
async fn multilink_vsock_only() {
let _ = env_logger::try_init();

let endpoint: EndPoint = "vsock/VMADDR_CID_LOCAL:17000".parse().unwrap();
multilink_transport(&endpoint).await;
}
}
8 changes: 8 additions & 0 deletions io/zenoh-transport/tests/unicast_openclose.rs
Original file line number Diff line number Diff line change
Expand Up @@ -825,3 +825,11 @@ async fn openclose_udp_only_listen_with_interface_restriction() {
// should not connect to local interface and external address
openclose_transport(&listen_endpoint, &connect_endpoint, false).await;
}

#[cfg(all(feature = "transport_vsock", target_os = "linux"))]
#[tokio::test(flavor = "multi_thread", worker_threads = 4)]
async fn openclose_vsock() {
let _ = env_logger::try_init();
let endpoint: EndPoint = "vsock/VMADDR_CID_LOCAL:17000".parse().unwrap();
openclose_lowlatency_transport(&endpoint).await;
}

0 comments on commit b6094e7

Please sign in to comment.