From f203222e6384299f8089ed0b2808e76e9af504da Mon Sep 17 00:00:00 2001 From: Michael Ilyin Date: Tue, 10 Dec 2024 10:30:45 +0100 Subject: [PATCH 01/17] Remove unstable feature flags from liveliness examples and API --- examples/Cargo.toml | 3 --- zenoh/src/api/liveliness.rs | 33 --------------------------------- zenoh/src/api/mod.rs | 1 - zenoh/src/lib.rs | 1 - 4 files changed, 38 deletions(-) diff --git a/examples/Cargo.toml b/examples/Cargo.toml index af948d5b2..3e5283b61 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -127,17 +127,14 @@ path = "examples/z_forward.rs" [[example]] name = "z_liveliness" path = "examples/z_liveliness.rs" -required-features = ["unstable"] [[example]] name = "z_sub_liveliness" path = "examples/z_sub_liveliness.rs" -required-features = ["unstable"] [[example]] name = "z_get_liveliness" path = "examples/z_get_liveliness.rs" -required-features = ["unstable"] [[example]] name = "z_pub_thr" diff --git a/zenoh/src/api/liveliness.rs b/zenoh/src/api/liveliness.rs index 3e4b0d696..e391fe392 100644 --- a/zenoh/src/api/liveliness.rs +++ b/zenoh/src/api/liveliness.rs @@ -94,12 +94,10 @@ use crate::{ /// # } /// ``` -#[zenoh_macros::unstable] pub struct Liveliness<'a> { pub(crate) session: &'a Session, } -#[zenoh_macros::unstable] impl<'a> Liveliness<'a> { /// Create a [`LivelinessToken`](LivelinessToken) for the given key expression. /// @@ -120,7 +118,6 @@ impl<'a> Liveliness<'a> { /// .unwrap(); /// # } /// ``` - #[zenoh_macros::unstable] pub fn declare_token<'b, TryIntoKeyExpr>( &self, key_expr: TryIntoKeyExpr, @@ -157,7 +154,6 @@ impl<'a> Liveliness<'a> { /// } /// # } /// ``` - #[zenoh_macros::unstable] pub fn declare_subscriber<'b, TryIntoKeyExpr>( &self, key_expr: TryIntoKeyExpr, @@ -194,7 +190,6 @@ impl<'a> Liveliness<'a> { /// } /// # } /// ``` - #[zenoh_macros::unstable] pub fn get<'b, TryIntoKeyExpr>( &self, key_expr: TryIntoKeyExpr, @@ -233,19 +228,16 @@ impl<'a> Liveliness<'a> { /// # } /// ``` #[must_use = "Resolvables do nothing unless you resolve them using `.await` or `zenoh::Wait::wait`"] -#[zenoh_macros::unstable] #[derive(Debug)] pub struct LivelinessTokenBuilder<'a, 'b> { pub(crate) session: &'a Session, pub(crate) key_expr: ZResult>, } -#[zenoh_macros::unstable] impl Resolvable for LivelinessTokenBuilder<'_, '_> { type To = ZResult; } -#[zenoh_macros::unstable] impl Wait for LivelinessTokenBuilder<'_, '_> { #[inline] fn wait(self) -> ::To { @@ -262,7 +254,6 @@ impl Wait for LivelinessTokenBuilder<'_, '_> { } } -#[zenoh_macros::unstable] impl IntoFuture for LivelinessTokenBuilder<'_, '_> { type Output = ::To; type IntoFuture = Ready<::To>; @@ -296,7 +287,6 @@ impl IntoFuture for LivelinessTokenBuilder<'_, '_> { /// .unwrap(); /// # } /// ``` -#[zenoh_macros::unstable] #[must_use = "Liveliness tokens will be immediately dropped and undeclared if not bound to a variable"] #[derive(Debug)] pub struct LivelinessToken { @@ -323,22 +313,18 @@ pub struct LivelinessToken { /// # } /// ``` #[must_use = "Resolvables do nothing unless you resolve them using `.await` or `zenoh::Wait::wait`"] -#[zenoh_macros::unstable] pub struct LivelinessTokenUndeclaration(LivelinessToken); -#[zenoh_macros::unstable] impl Resolvable for LivelinessTokenUndeclaration { type To = ZResult<()>; } -#[zenoh_macros::unstable] impl Wait for LivelinessTokenUndeclaration { fn wait(mut self) -> ::To { self.0.undeclare_impl() } } -#[zenoh_macros::unstable] impl IntoFuture for LivelinessTokenUndeclaration { type Output = ::To; type IntoFuture = Ready<::To>; @@ -348,7 +334,6 @@ impl IntoFuture for LivelinessTokenUndeclaration { } } -#[zenoh_macros::unstable] impl LivelinessToken { /// Undeclare the [`LivelinessToken`]. /// @@ -379,7 +364,6 @@ impl LivelinessToken { } } -#[zenoh_macros::unstable] impl UndeclarableSealed<()> for LivelinessToken { type Undeclaration = LivelinessTokenUndeclaration; @@ -388,7 +372,6 @@ impl UndeclarableSealed<()> for LivelinessToken { } } -#[zenoh_macros::unstable] impl Drop for LivelinessToken { fn drop(&mut self) { if self.undeclare_on_drop { @@ -415,7 +398,6 @@ impl Drop for LivelinessToken { /// # } /// ``` #[must_use = "Resolvables do nothing unless you resolve them using `.await` or `zenoh::Wait::wait`"] -#[zenoh_macros::unstable] #[derive(Debug)] pub struct LivelinessSubscriberBuilder<'a, 'b, Handler, const BACKGROUND: bool = false> { pub session: &'a Session, @@ -424,7 +406,6 @@ pub struct LivelinessSubscriberBuilder<'a, 'b, Handler, const BACKGROUND: bool = pub history: bool, } -#[zenoh_macros::unstable] impl<'a, 'b> LivelinessSubscriberBuilder<'a, 'b, DefaultHandler> { /// Receive the samples for this liveliness subscription with a callback. /// @@ -443,7 +424,6 @@ impl<'a, 'b> LivelinessSubscriberBuilder<'a, 'b, DefaultHandler> { /// # } /// ``` #[inline] - #[zenoh_macros::unstable] pub fn callback(self, callback: F) -> LivelinessSubscriberBuilder<'a, 'b, Callback> where F: Fn(Sample) + Send + Sync + 'static, @@ -472,7 +452,6 @@ impl<'a, 'b> LivelinessSubscriberBuilder<'a, 'b, DefaultHandler> { /// # } /// ``` #[inline] - #[zenoh_macros::unstable] pub fn callback_mut( self, callback: F, @@ -503,7 +482,6 @@ impl<'a, 'b> LivelinessSubscriberBuilder<'a, 'b, DefaultHandler> { /// # } /// ``` #[inline] - #[zenoh_macros::unstable] pub fn with(self, handler: Handler) -> LivelinessSubscriberBuilder<'a, 'b, Handler> where Handler: IntoHandler, @@ -556,14 +534,12 @@ impl<'a, 'b> LivelinessSubscriberBuilder<'a, 'b, Callback> { impl LivelinessSubscriberBuilder<'_, '_, Handler, BACKGROUND> { #[inline] - #[zenoh_macros::unstable] pub fn history(mut self, history: bool) -> Self { self.history = history; self } } -#[zenoh_macros::unstable] impl Resolvable for LivelinessSubscriberBuilder<'_, '_, Handler> where Handler: IntoHandler + Send, @@ -572,13 +548,11 @@ where type To = ZResult>; } -#[zenoh_macros::unstable] impl Wait for LivelinessSubscriberBuilder<'_, '_, Handler> where Handler: IntoHandler + Send, Handler::Handler: Send, { - #[zenoh_macros::unstable] fn wait(self) -> ::To { use super::subscriber::SubscriberKind; @@ -606,7 +580,6 @@ where } } -#[zenoh_macros::unstable] impl IntoFuture for LivelinessSubscriberBuilder<'_, '_, Handler> where Handler: IntoHandler + Send, @@ -615,20 +588,16 @@ where type Output = ::To; type IntoFuture = Ready<::To>; - #[zenoh_macros::unstable] fn into_future(self) -> Self::IntoFuture { std::future::ready(self.wait()) } } -#[zenoh_macros::unstable] impl Resolvable for LivelinessSubscriberBuilder<'_, '_, Callback, true> { type To = ZResult<()>; } -#[zenoh_macros::unstable] impl Wait for LivelinessSubscriberBuilder<'_, '_, Callback, true> { - #[zenoh_macros::unstable] fn wait(self) -> ::To { self.session.0.declare_liveliness_subscriber_inner( &self.key_expr?, @@ -640,12 +609,10 @@ impl Wait for LivelinessSubscriberBuilder<'_, '_, Callback, true> { } } -#[zenoh_macros::unstable] impl IntoFuture for LivelinessSubscriberBuilder<'_, '_, Callback, true> { type Output = ::To; type IntoFuture = Ready<::To>; - #[zenoh_macros::unstable] fn into_future(self) -> Self::IntoFuture { std::future::ready(self.wait()) } diff --git a/zenoh/src/api/mod.rs b/zenoh/src/api/mod.rs index 6981e02f7..e5d19325c 100644 --- a/zenoh/src/api/mod.rs +++ b/zenoh/src/api/mod.rs @@ -22,7 +22,6 @@ pub(crate) mod encoding; pub(crate) mod handlers; pub(crate) mod info; pub(crate) mod key_expr; -#[cfg(feature = "unstable")] pub(crate) mod liveliness; #[cfg(feature = "plugins")] pub(crate) mod loader; diff --git a/zenoh/src/lib.rs b/zenoh/src/lib.rs index ec39dd29c..8fe9099b9 100644 --- a/zenoh/src/lib.rs +++ b/zenoh/src/lib.rs @@ -419,7 +419,6 @@ pub mod scouting { /// } /// # } /// ``` -#[zenoh_macros::unstable] pub mod liveliness { pub use crate::api::liveliness::{ Liveliness, LivelinessGetBuilder, LivelinessSubscriberBuilder, LivelinessToken, From c6740a1ad7bfd649b744aeb6063d4702f9d50bcf Mon Sep 17 00:00:00 2001 From: Michael Ilyin Date: Tue, 10 Dec 2024 11:42:38 +0100 Subject: [PATCH 02/17] compile errors partially fixed --- zenoh/src/api/query.rs | 1 - zenoh/src/api/session.rs | 35 ++++++++++++----------------------- 2 files changed, 12 insertions(+), 24 deletions(-) diff --git a/zenoh/src/api/query.rs b/zenoh/src/api/query.rs index 8eff89831..3e1f66ed1 100644 --- a/zenoh/src/api/query.rs +++ b/zenoh/src/api/query.rs @@ -146,7 +146,6 @@ impl From for Result { } } -#[cfg(feature = "unstable")] pub(crate) struct LivelinessQueryState { pub(crate) callback: Callback, } diff --git a/zenoh/src/api/session.rs b/zenoh/src/api/session.rs index 15b7fb4d7..f8856e945 100644 --- a/zenoh/src/api/session.rs +++ b/zenoh/src/api/session.rs @@ -36,11 +36,7 @@ use zenoh_config::{qos::PublisherQoSConfig, unwrap_or_default, wrappers::ZenohId use zenoh_core::{zconfigurable, zread, Resolve, ResolveClosure, ResolveFuture, Wait}; use zenoh_keyexpr::keyexpr_tree::KeBoxTree; #[cfg(feature = "unstable")] -use zenoh_protocol::network::{ - declare::{DeclareToken, SubscriberId, TokenId, UndeclareToken}, - ext, - interest::InterestId, -}; +use zenoh_protocol::network::declare::SubscriberId; use zenoh_protocol::{ core::{ key_expr::{keyexpr, OwnedKeyExpr}, @@ -51,10 +47,11 @@ use zenoh_protocol::{ self, declare::{ self, common::ext::WireExprType, queryable::ext::QueryableInfoType, Declare, - DeclareBody, DeclareKeyExpr, DeclareQueryable, DeclareSubscriber, UndeclareQueryable, - UndeclareSubscriber, + DeclareBody, DeclareKeyExpr, DeclareQueryable, DeclareSubscriber, DeclareToken, + TokenId, UndeclareQueryable, UndeclareSubscriber, UndeclareToken, }, - interest::{InterestMode, InterestOptions}, + ext, + interest::{InterestId, InterestMode, InterestOptions}, push, request, AtomicRequestId, DeclareFinal, Interest, Mapping, Push, Request, RequestId, Response, ResponseFinal, }, @@ -75,10 +72,9 @@ use crate::api::selector::ZenohParameters; #[cfg(feature = "unstable")] use crate::api::{ builders::querier::QuerierBuilder, - liveliness::Liveliness, matching::{MatchingListenerState, MatchingStatus, MatchingStatusType}, querier::QuerierState, - query::{LivelinessQueryState, ReplyKeyExpr}, + query::ReplyKeyExpr, sample::SourceInfo, }; use crate::{ @@ -99,8 +95,12 @@ use crate::{ handlers::{Callback, DefaultHandler}, info::SessionInfo, key_expr::{KeyExpr, KeyExprInner}, + liveliness::Liveliness, publisher::{Priority, PublisherState}, - query::{ConsolidationMode, QueryConsolidation, QueryState, QueryTarget, Reply}, + query::{ + ConsolidationMode, LivelinessQueryState, QueryConsolidation, QueryState, QueryTarget, + Reply, + }, queryable::{Query, QueryInner, QueryableState}, sample::{DataInfo, DataInfoIntoSample, Locality, QoS, Sample, SampleKind}, selector::Selector, @@ -127,7 +127,6 @@ pub(crate) struct SessionState { pub(crate) primitives: Option>, // @TODO replace with MaybeUninit ?? pub(crate) expr_id_counter: AtomicExprId, // @TODO: manage rollover and uniqueness pub(crate) qid_counter: AtomicRequestId, - #[cfg(feature = "unstable")] pub(crate) liveliness_qid_counter: AtomicRequestId, pub(crate) local_resources: HashMap, pub(crate) remote_resources: HashMap, @@ -136,7 +135,6 @@ pub(crate) struct SessionState { pub(crate) publishers: HashMap, #[cfg(feature = "unstable")] pub(crate) queriers: HashMap, - #[cfg(feature = "unstable")] pub(crate) remote_tokens: HashMap>, //pub(crate) publications: Vec, pub(crate) subscribers: HashMap>, @@ -147,7 +145,6 @@ pub(crate) struct SessionState { #[cfg(feature = "unstable")] pub(crate) matching_listeners: HashMap>, pub(crate) queries: HashMap, - #[cfg(feature = "unstable")] pub(crate) liveliness_queries: HashMap, pub(crate) aggregated_subscribers: Vec, pub(crate) aggregated_publishers: Vec, @@ -164,7 +161,6 @@ impl SessionState { primitives: None, expr_id_counter: AtomicExprId::new(1), // Note: start at 1 because 0 is reserved for NO_RESOURCE qid_counter: AtomicRequestId::new(0), - #[cfg(feature = "unstable")] liveliness_qid_counter: AtomicRequestId::new(0), local_resources: HashMap::new(), remote_resources: HashMap::new(), @@ -173,7 +169,6 @@ impl SessionState { publishers: HashMap::new(), #[cfg(feature = "unstable")] queriers: HashMap::new(), - #[cfg(feature = "unstable")] remote_tokens: HashMap::new(), //publications: Vec::new(), subscribers: HashMap::new(), @@ -184,7 +179,6 @@ impl SessionState { #[cfg(feature = "unstable")] matching_listeners: HashMap::new(), queries: HashMap::new(), - #[cfg(feature = "unstable")] liveliness_queries: HashMap::new(), aggregated_subscribers, aggregated_publishers, @@ -1027,7 +1021,6 @@ impl Session { /// .unwrap(); /// # } /// ``` - #[zenoh_macros::unstable] pub fn liveliness(&self) -> Liveliness<'_> { Liveliness { session: self } } @@ -1712,7 +1705,6 @@ impl SessionInner { } } - #[zenoh_macros::unstable] pub(crate) fn declare_liveliness_inner(&self, key_expr: &KeyExpr) -> ZResult { tracing::trace!("declare_liveliness({:?})", key_expr); let id = self.runtime.next_id(); @@ -1730,7 +1722,6 @@ impl SessionInner { Ok(id) } - #[cfg(feature = "unstable")] pub(crate) fn declare_liveliness_subscriber_inner( &self, key_expr: &KeyExpr, @@ -1807,7 +1798,6 @@ impl SessionInner { reliability: Reliability::Reliable, #[cfg(feature = "unstable")] source_info: SourceInfo::empty(), - #[cfg(feature = "unstable")] attachment: None, }); } @@ -1831,7 +1821,6 @@ impl SessionInner { Ok(sub_state) } - #[zenoh_macros::unstable] pub(crate) fn undeclare_liveliness(&self, tid: Id) -> ZResult<()> { let Ok(primitives) = zread!(self.state).primitives() else { return Ok(()); @@ -2338,7 +2327,6 @@ impl SessionInner { Ok(()) } - #[cfg(feature = "unstable")] pub(crate) fn liveliness_query( self: &Arc, key_expr: &KeyExpr<'_>, @@ -2352,6 +2340,7 @@ impl SessionInner { self.task_controller .spawn_with_rt(zenoh_runtime::ZRuntime::Net, { let session = WeakSession::new(self); + #[cfg(feature = "unstable")] let zid = self.zid(); async move { tokio::select! { From c1208fa5141cf8f855a49200ceefdc94eb4de66f Mon Sep 17 00:00:00 2001 From: Michael Ilyin Date: Tue, 10 Dec 2024 12:28:00 +0100 Subject: [PATCH 03/17] compilation error fixed --- zenoh/src/api/liveliness.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zenoh/src/api/liveliness.rs b/zenoh/src/api/liveliness.rs index e391fe392..e509b2615 100644 --- a/zenoh/src/api/liveliness.rs +++ b/zenoh/src/api/liveliness.rs @@ -200,7 +200,7 @@ impl<'a> Liveliness<'a> { { let key_expr = key_expr.try_into().map_err(Into::into); let timeout = { - let conf = self.session.0.runtime.config().lock(); + let conf = &self.session.0.runtime.config().lock().0; Duration::from_millis(unwrap_or_default!(conf.queries_default_timeout())) }; LivelinessGetBuilder { From 56b5ac982a8991588f21ca6c99ae9e18b3c876b4 Mon Sep 17 00:00:00 2001 From: Michael Ilyin Date: Tue, 10 Dec 2024 12:39:27 +0100 Subject: [PATCH 04/17] clippy fix --- zenoh/src/api/liveliness.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/zenoh/src/api/liveliness.rs b/zenoh/src/api/liveliness.rs index e509b2615..c70b67323 100644 --- a/zenoh/src/api/liveliness.rs +++ b/zenoh/src/api/liveliness.rs @@ -93,7 +93,6 @@ use crate::{ /// } /// # } /// ``` - pub struct Liveliness<'a> { pub(crate) session: &'a Session, } From dd2ca3713624c5f20a2fb5ddf5ac8b784cd545c6 Mon Sep 17 00:00:00 2001 From: Michael Ilyin Date: Tue, 10 Dec 2024 12:53:49 +0100 Subject: [PATCH 05/17] cargo doc fix --- zenoh/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zenoh/src/lib.rs b/zenoh/src/lib.rs index 8fe9099b9..96ee6f777 100644 --- a/zenoh/src/lib.rs +++ b/zenoh/src/lib.rs @@ -371,7 +371,7 @@ pub mod scouting { /// Liveliness primitives /// /// A [`LivelinessToken`](liveliness::LivelinessToken) is a token which liveliness is tied -/// to the Zenoh [`Session`](Session) and can be monitored by remote applications. +/// to the Zenoh [`Session`] and can be monitored by remote applications. /// /// # Examples /// ### Declaring a token From 5274d55b3b4902355ed90d27b46dce42d789055f Mon Sep 17 00:00:00 2001 From: Michael Ilyin Date: Tue, 10 Dec 2024 15:45:49 +0100 Subject: [PATCH 06/17] code simplified, unstable from liveliness tests removed --- zenoh/src/api/session.rs | 4 +--- zenoh/tests/liveliness.rs | 50 --------------------------------------- zenoh/tests/routing.rs | 9 ------- 3 files changed, 1 insertion(+), 62 deletions(-) diff --git a/zenoh/src/api/session.rs b/zenoh/src/api/session.rs index f8856e945..efeba8b87 100644 --- a/zenoh/src/api/session.rs +++ b/zenoh/src/api/session.rs @@ -2340,8 +2340,6 @@ impl SessionInner { self.task_controller .spawn_with_rt(zenoh_runtime::ZRuntime::Net, { let session = WeakSession::new(self); - #[cfg(feature = "unstable")] - let zid = self.zid(); async move { tokio::select! { _ = tokio::time::sleep(timeout) => { @@ -2352,7 +2350,7 @@ impl SessionInner { query.callback.call(Reply { result: Err(ReplyError::new("Timeout", Encoding::ZENOH_STRING)), #[cfg(feature = "unstable")] - replier_id: Some(zid.into()), + replier_id: Some(session.zid().into()), }); } } diff --git a/zenoh/tests/liveliness.rs b/zenoh/tests/liveliness.rs index 968b24303..23a73a72d 100644 --- a/zenoh/tests/liveliness.rs +++ b/zenoh/tests/liveliness.rs @@ -11,10 +11,8 @@ // Contributors: // ZettaScale Zenoh Team, // -#[cfg(feature = "unstable")] use zenoh_core::ztimeout; -#[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_clique() { use std::time::Duration; @@ -77,7 +75,6 @@ async fn test_liveliness_subscriber_clique() { peer2.close().await.unwrap(); } -#[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_query_clique() { use std::time::Duration; @@ -134,7 +131,6 @@ async fn test_liveliness_query_clique() { peer2.close().await.unwrap(); } -#[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_brokered() { use std::time::Duration; @@ -213,7 +209,6 @@ async fn test_liveliness_subscriber_brokered() { client2.close().await.unwrap(); } -#[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_query_brokered() { use std::time::Duration; @@ -284,7 +279,6 @@ async fn test_liveliness_query_brokered() { client2.close().await.unwrap(); } -#[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_local() { use std::time::Duration; @@ -327,7 +321,6 @@ async fn test_liveliness_subscriber_local() { peer.close().await.unwrap(); } -#[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_query_local() { use std::time::Duration; @@ -362,7 +355,6 @@ async fn test_liveliness_query_local() { peer.close().await.unwrap(); } -#[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_after_close() { use std::time::Duration; @@ -421,7 +413,6 @@ async fn test_liveliness_after_close() { /// ------------------------------------------------------- /// DOUBLE CLIENT /// ------------------------------------------------------- -#[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_client_before() { use std::time::Duration; @@ -516,7 +507,6 @@ async fn test_liveliness_subscriber_double_client_before() { router.close().await.unwrap(); } -#[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_client_middle() { use std::time::Duration; @@ -614,7 +604,6 @@ async fn test_liveliness_subscriber_double_client_middle() { router.close().await.unwrap(); } -#[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_client_after() { use std::time::Duration; @@ -714,7 +703,6 @@ async fn test_liveliness_subscriber_double_client_after() { router.close().await.unwrap(); } -#[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_client_history_before() { use std::time::Duration; @@ -817,7 +805,6 @@ async fn test_liveliness_subscriber_double_client_history_before() { router.close().await.unwrap(); } -#[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_client_history_middle() { use std::time::Duration; @@ -920,7 +907,6 @@ async fn test_liveliness_subscriber_double_client_history_middle() { router.close().await.unwrap(); } -#[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_client_history_after() { use std::time::Duration; @@ -1025,7 +1011,6 @@ async fn test_liveliness_subscriber_double_client_history_after() { /// ------------------------------------------------------- /// DOUBLE PEER /// ------------------------------------------------------- -#[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_peer_before() { use std::time::Duration; @@ -1114,7 +1099,6 @@ async fn test_liveliness_subscriber_double_peer_before() { router.close().await.unwrap(); } -#[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_peer_middle() { use std::time::Duration; @@ -1206,7 +1190,6 @@ async fn test_liveliness_subscriber_double_peer_middle() { router.close().await.unwrap(); } -#[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_peer_after() { use std::time::Duration; @@ -1300,7 +1283,6 @@ async fn test_liveliness_subscriber_double_peer_after() { router.close().await.unwrap(); } -#[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_peer_history_before() { use std::time::Duration; @@ -1403,7 +1385,6 @@ async fn test_liveliness_subscriber_double_peer_history_before() { router.close().await.unwrap(); } -#[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_peer_history_middle() { use std::time::Duration; @@ -1506,7 +1487,6 @@ async fn test_liveliness_subscriber_double_peer_history_middle() { router.close().await.unwrap(); } -#[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_peer_history_after() { use std::time::Duration; @@ -1611,7 +1591,6 @@ async fn test_liveliness_subscriber_double_peer_history_after() { /// ------------------------------------------------------- /// DOUBLE ROUTER /// ------------------------------------------------------- -#[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_router_before() { use std::time::Duration; @@ -1711,7 +1690,6 @@ async fn test_liveliness_subscriber_double_router_before() { router.close().await.unwrap(); } -#[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_router_middle() { use std::time::Duration; @@ -1814,7 +1792,6 @@ async fn test_liveliness_subscriber_double_router_middle() { router.close().await.unwrap(); } -#[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_router_after() { use std::time::Duration; @@ -1919,7 +1896,6 @@ async fn test_liveliness_subscriber_double_router_after() { router.close().await.unwrap(); } -#[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_router_history_before() { use std::time::Duration; @@ -2027,7 +2003,6 @@ async fn test_liveliness_subscriber_double_router_history_before() { router.close().await.unwrap(); } -#[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_router_history_middle() { use std::time::Duration; @@ -2135,7 +2110,6 @@ async fn test_liveliness_subscriber_double_router_history_middle() { router.close().await.unwrap(); } -#[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_router_history_after() { use std::time::Duration; @@ -2245,7 +2219,6 @@ async fn test_liveliness_subscriber_double_router_history_after() { /// ------------------------------------------------------- /// DOUBLE CLIENT VIA PEER /// ------------------------------------------------------- -#[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_clientviapeer_before() { use std::time::Duration; @@ -2359,7 +2332,6 @@ async fn test_liveliness_subscriber_double_clientviapeer_before() { router.close().await.unwrap(); } -#[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_clientviapeer_middle() { use std::time::Duration; @@ -2476,7 +2448,6 @@ async fn test_liveliness_subscriber_double_clientviapeer_middle() { router.close().await.unwrap(); } -#[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_clientviapeer_after() { use std::time::Duration; @@ -2595,7 +2566,6 @@ async fn test_liveliness_subscriber_double_clientviapeer_after() { router.close().await.unwrap(); } -#[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_clientviapeer_history_before() { use std::time::Duration; @@ -2718,7 +2688,6 @@ async fn test_liveliness_subscriber_double_clientviapeer_history_before() { router.close().await.unwrap(); } -#[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_clientviapeer_history_middle() { use std::time::Duration; @@ -2841,7 +2810,6 @@ async fn test_liveliness_subscriber_double_clientviapeer_history_middle() { router.close().await.unwrap(); } -#[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_clientviapeer_history_after() { use std::time::Duration; @@ -2966,7 +2934,6 @@ async fn test_liveliness_subscriber_double_clientviapeer_history_after() { /// ------------------------------------------------------- /// SUBGET CLIENT /// ------------------------------------------------------- -#[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subget_client_before() { use std::time::Duration; @@ -3059,7 +3026,6 @@ async fn test_liveliness_subget_client_before() { router.close().await.unwrap(); } -#[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subget_client_middle() { use std::time::Duration; @@ -3157,7 +3123,6 @@ async fn test_liveliness_subget_client_middle() { router.close().await.unwrap(); } -#[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subget_client_history_before() { use std::time::Duration; @@ -3254,7 +3219,6 @@ async fn test_liveliness_subget_client_history_before() { router.close().await.unwrap(); } -#[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subget_client_history_middle() { use std::time::Duration; @@ -3356,7 +3320,6 @@ async fn test_liveliness_subget_client_history_middle() { /// ------------------------------------------------------- /// SUBGET PEER /// ------------------------------------------------------- -#[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subget_peer_before() { use std::time::Duration; @@ -3449,7 +3412,6 @@ async fn test_liveliness_subget_peer_before() { router.close().await.unwrap(); } -#[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subget_peer_middle() { use std::time::Duration; @@ -3547,7 +3509,6 @@ async fn test_liveliness_subget_peer_middle() { router.close().await.unwrap(); } -#[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subget_peer_history_before() { use std::time::Duration; @@ -3644,7 +3605,6 @@ async fn test_liveliness_subget_peer_history_before() { router.close().await.unwrap(); } -#[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subget_peer_history_middle() { use std::time::Duration; @@ -3746,7 +3706,6 @@ async fn test_liveliness_subget_peer_history_middle() { /// ------------------------------------------------------- /// SUBGET ROUTER /// ------------------------------------------------------- -#[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subget_router_before() { use std::time::Duration; @@ -3844,7 +3803,6 @@ async fn test_liveliness_subget_router_before() { router.close().await.unwrap(); } -#[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subget_router_middle() { use std::time::Duration; @@ -3947,7 +3905,6 @@ async fn test_liveliness_subget_router_middle() { router.close().await.unwrap(); } -#[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subget_router_history_before() { use std::time::Duration; @@ -4049,7 +4006,6 @@ async fn test_liveliness_subget_router_history_before() { router.close().await.unwrap(); } -#[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subget_router_history_middle() { use std::time::Duration; @@ -4153,7 +4109,6 @@ async fn test_liveliness_subget_router_history_middle() { router.close().await.unwrap(); } -#[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_regression_1() { use std::time::Duration; @@ -4237,7 +4192,6 @@ async fn test_liveliness_regression_1() { router.close().await.unwrap(); } -#[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_regression_2() { use std::time::Duration; @@ -4331,7 +4285,6 @@ async fn test_liveliness_regression_2() { peer_sub.close().await.unwrap(); } -#[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_regression_2_history() { use std::time::Duration; @@ -4432,7 +4385,6 @@ async fn test_liveliness_regression_2_history() { peer_sub.close().await.unwrap(); } -#[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_regression_3() { use std::time::Duration; @@ -4538,7 +4490,6 @@ async fn test_liveliness_regression_3() { router.close().await.unwrap(); } -#[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_issue_1470() { // https://github.com/eclipse-zenoh/zenoh/issues/1470 @@ -4722,7 +4673,6 @@ async fn test_liveliness_issue_1470() { /// ------------------------------------------------------- /// DOUBLE UNDECLARE CLIQUE /// ------------------------------------------------------- -#[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_double_undeclare_clique() { use std::time::Duration; diff --git a/zenoh/tests/routing.rs b/zenoh/tests/routing.rs index 1250e1479..83dcc2d3d 100644 --- a/zenoh/tests/routing.rs +++ b/zenoh/tests/routing.rs @@ -31,7 +31,6 @@ use zenoh_result::bail; const TIMEOUT: Duration = Duration::from_secs(10); const MSG_COUNT: usize = 50; -#[cfg(feature = "unstable")] const LIVELINESSGET_DELAY: Duration = Duration::from_millis(10); #[derive(Debug, Clone, PartialEq, Eq)] @@ -40,13 +39,9 @@ enum Task { Sub(String, usize), Queryable(String, usize), Get(String, usize), - #[cfg(feature = "unstable")] Liveliness(String), - #[cfg(feature = "unstable")] LivelinessGet(String), - #[cfg(feature = "unstable")] LivelinessLoop(String), - #[cfg(feature = "unstable")] LivelinessSub(String), Sleep(Duration), Wait, @@ -155,7 +150,6 @@ impl Task { println!("Get got sufficient amount of messages. Done."); } - #[cfg(feature = "unstable")] // The Liveliness task. Self::Liveliness(ke) => { let _liveliness = ztimeout!(session.liveliness().declare_token(ke))?; @@ -164,7 +158,6 @@ impl Task { println!("Liveliness task done."); } - #[cfg(feature = "unstable")] // The LivelinessGet task. Self::LivelinessGet(ke) => { let mut counter = 0; @@ -192,7 +185,6 @@ impl Task { } // The LivelinessLoop task. - #[cfg(feature = "unstable")] Self::LivelinessLoop(ke) => { let mut liveliness: Option = None; @@ -221,7 +213,6 @@ impl Task { println!("LivelinessLoop task done."); } - #[cfg(feature = "unstable")] // The LivelinessSub task. Self::LivelinessSub(ke) => { let sub = ztimeout!(session.liveliness().declare_subscriber(ke))?; From 7111b54d1556a50179fa1029bdff92d06ed54410 Mon Sep 17 00:00:00 2001 From: Michael Ilyin Date: Tue, 10 Dec 2024 16:25:23 +0100 Subject: [PATCH 07/17] explicitly enable internal_config access for tests only --- .github/workflows/ci.yml | 6 ++--- zenoh/Cargo.toml | 2 +- zenoh/tests/liveliness.rs | 50 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bb5a49643..cbad34c4a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -143,15 +143,15 @@ jobs: uses: taiki-e/install-action@nextest - name: Run tests - run: cargo nextest run -F test --exclude zenoh-examples --exclude zenoh-plugin-example --workspace + run: cargo nextest run -F test -F internal_config --exclude zenoh-examples --exclude zenoh-plugin-example --workspace - name: Run tests with SHM if: ${{ matrix.os == 'macOS-latest' || matrix.os == 'windows-latest' }} - run: cargo nextest run -F test -F shared-memory -F unstable -E 'not (test(test_default_features))' --exclude zenoh-examples --exclude zenoh-plugin-example --workspace + run: cargo nextest run -F test -F shared-memory -F unstable -F internal_config -E 'not (test(test_default_features))' --exclude zenoh-examples --exclude zenoh-plugin-example --workspace - name: Run tests with SHM + unixpipe if: ${{ matrix.os == 'ubuntu-latest' }} - run: cargo nextest run -F test -F shared-memory -F unstable -F transport_unixpipe -E 'not (test(test_default_features))' --exclude zenoh-examples --exclude zenoh-plugin-example --workspace + run: cargo nextest run -F test -F shared-memory -F unstable -F internal_config -F transport_unixpipe -E 'not (test(test_default_features))' --exclude zenoh-examples --exclude zenoh-plugin-example --workspace - name: Check for feature leaks if: ${{ matrix.os == 'ubuntu-latest' }} diff --git a/zenoh/Cargo.toml b/zenoh/Cargo.toml index 6a998b296..3fe0a6a01 100644 --- a/zenoh/Cargo.toml +++ b/zenoh/Cargo.toml @@ -64,7 +64,7 @@ transport_udp = ["zenoh-transport/transport_udp"] transport_unixsock-stream = ["zenoh-transport/transport_unixsock-stream"] transport_ws = ["zenoh-transport/transport_ws"] transport_vsock = ["zenoh-transport/transport_vsock"] -unstable = ["internal_config", "zenoh-keyexpr/unstable", "zenoh-config/unstable"] +unstable = ["zenoh-keyexpr/unstable", "zenoh-config/unstable"] internal_config = [] [dependencies] diff --git a/zenoh/tests/liveliness.rs b/zenoh/tests/liveliness.rs index 23a73a72d..f0b9fc208 100644 --- a/zenoh/tests/liveliness.rs +++ b/zenoh/tests/liveliness.rs @@ -11,8 +11,10 @@ // Contributors: // ZettaScale Zenoh Team, // +#[cfg(feature = "internal_config")] use zenoh_core::ztimeout; +#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_clique() { use std::time::Duration; @@ -75,6 +77,7 @@ async fn test_liveliness_subscriber_clique() { peer2.close().await.unwrap(); } +#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_query_clique() { use std::time::Duration; @@ -131,6 +134,7 @@ async fn test_liveliness_query_clique() { peer2.close().await.unwrap(); } +#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_brokered() { use std::time::Duration; @@ -209,6 +213,7 @@ async fn test_liveliness_subscriber_brokered() { client2.close().await.unwrap(); } +#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_query_brokered() { use std::time::Duration; @@ -279,6 +284,7 @@ async fn test_liveliness_query_brokered() { client2.close().await.unwrap(); } +#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_local() { use std::time::Duration; @@ -321,6 +327,7 @@ async fn test_liveliness_subscriber_local() { peer.close().await.unwrap(); } +#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_query_local() { use std::time::Duration; @@ -355,6 +362,7 @@ async fn test_liveliness_query_local() { peer.close().await.unwrap(); } +#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_after_close() { use std::time::Duration; @@ -413,6 +421,7 @@ async fn test_liveliness_after_close() { /// ------------------------------------------------------- /// DOUBLE CLIENT /// ------------------------------------------------------- +#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_client_before() { use std::time::Duration; @@ -507,6 +516,7 @@ async fn test_liveliness_subscriber_double_client_before() { router.close().await.unwrap(); } +#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_client_middle() { use std::time::Duration; @@ -604,6 +614,7 @@ async fn test_liveliness_subscriber_double_client_middle() { router.close().await.unwrap(); } +#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_client_after() { use std::time::Duration; @@ -703,6 +714,7 @@ async fn test_liveliness_subscriber_double_client_after() { router.close().await.unwrap(); } +#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_client_history_before() { use std::time::Duration; @@ -805,6 +817,7 @@ async fn test_liveliness_subscriber_double_client_history_before() { router.close().await.unwrap(); } +#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_client_history_middle() { use std::time::Duration; @@ -907,6 +920,7 @@ async fn test_liveliness_subscriber_double_client_history_middle() { router.close().await.unwrap(); } +#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_client_history_after() { use std::time::Duration; @@ -1011,6 +1025,7 @@ async fn test_liveliness_subscriber_double_client_history_after() { /// ------------------------------------------------------- /// DOUBLE PEER /// ------------------------------------------------------- +#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_peer_before() { use std::time::Duration; @@ -1099,6 +1114,7 @@ async fn test_liveliness_subscriber_double_peer_before() { router.close().await.unwrap(); } +#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_peer_middle() { use std::time::Duration; @@ -1190,6 +1206,7 @@ async fn test_liveliness_subscriber_double_peer_middle() { router.close().await.unwrap(); } +#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_peer_after() { use std::time::Duration; @@ -1283,6 +1300,7 @@ async fn test_liveliness_subscriber_double_peer_after() { router.close().await.unwrap(); } +#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_peer_history_before() { use std::time::Duration; @@ -1385,6 +1403,7 @@ async fn test_liveliness_subscriber_double_peer_history_before() { router.close().await.unwrap(); } +#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_peer_history_middle() { use std::time::Duration; @@ -1487,6 +1506,7 @@ async fn test_liveliness_subscriber_double_peer_history_middle() { router.close().await.unwrap(); } +#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_peer_history_after() { use std::time::Duration; @@ -1591,6 +1611,7 @@ async fn test_liveliness_subscriber_double_peer_history_after() { /// ------------------------------------------------------- /// DOUBLE ROUTER /// ------------------------------------------------------- +#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_router_before() { use std::time::Duration; @@ -1690,6 +1711,7 @@ async fn test_liveliness_subscriber_double_router_before() { router.close().await.unwrap(); } +#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_router_middle() { use std::time::Duration; @@ -1792,6 +1814,7 @@ async fn test_liveliness_subscriber_double_router_middle() { router.close().await.unwrap(); } +#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_router_after() { use std::time::Duration; @@ -1896,6 +1919,7 @@ async fn test_liveliness_subscriber_double_router_after() { router.close().await.unwrap(); } +#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_router_history_before() { use std::time::Duration; @@ -2003,6 +2027,7 @@ async fn test_liveliness_subscriber_double_router_history_before() { router.close().await.unwrap(); } +#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_router_history_middle() { use std::time::Duration; @@ -2110,6 +2135,7 @@ async fn test_liveliness_subscriber_double_router_history_middle() { router.close().await.unwrap(); } +#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_router_history_after() { use std::time::Duration; @@ -2219,6 +2245,7 @@ async fn test_liveliness_subscriber_double_router_history_after() { /// ------------------------------------------------------- /// DOUBLE CLIENT VIA PEER /// ------------------------------------------------------- +#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_clientviapeer_before() { use std::time::Duration; @@ -2332,6 +2359,7 @@ async fn test_liveliness_subscriber_double_clientviapeer_before() { router.close().await.unwrap(); } +#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_clientviapeer_middle() { use std::time::Duration; @@ -2448,6 +2476,7 @@ async fn test_liveliness_subscriber_double_clientviapeer_middle() { router.close().await.unwrap(); } +#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_clientviapeer_after() { use std::time::Duration; @@ -2566,6 +2595,7 @@ async fn test_liveliness_subscriber_double_clientviapeer_after() { router.close().await.unwrap(); } +#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_clientviapeer_history_before() { use std::time::Duration; @@ -2688,6 +2718,7 @@ async fn test_liveliness_subscriber_double_clientviapeer_history_before() { router.close().await.unwrap(); } +#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_clientviapeer_history_middle() { use std::time::Duration; @@ -2810,6 +2841,7 @@ async fn test_liveliness_subscriber_double_clientviapeer_history_middle() { router.close().await.unwrap(); } +#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_clientviapeer_history_after() { use std::time::Duration; @@ -2934,6 +2966,7 @@ async fn test_liveliness_subscriber_double_clientviapeer_history_after() { /// ------------------------------------------------------- /// SUBGET CLIENT /// ------------------------------------------------------- +#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subget_client_before() { use std::time::Duration; @@ -3026,6 +3059,7 @@ async fn test_liveliness_subget_client_before() { router.close().await.unwrap(); } +#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subget_client_middle() { use std::time::Duration; @@ -3123,6 +3157,7 @@ async fn test_liveliness_subget_client_middle() { router.close().await.unwrap(); } +#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subget_client_history_before() { use std::time::Duration; @@ -3219,6 +3254,7 @@ async fn test_liveliness_subget_client_history_before() { router.close().await.unwrap(); } +#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subget_client_history_middle() { use std::time::Duration; @@ -3320,6 +3356,7 @@ async fn test_liveliness_subget_client_history_middle() { /// ------------------------------------------------------- /// SUBGET PEER /// ------------------------------------------------------- +#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subget_peer_before() { use std::time::Duration; @@ -3412,6 +3449,7 @@ async fn test_liveliness_subget_peer_before() { router.close().await.unwrap(); } +#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subget_peer_middle() { use std::time::Duration; @@ -3509,6 +3547,7 @@ async fn test_liveliness_subget_peer_middle() { router.close().await.unwrap(); } +#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subget_peer_history_before() { use std::time::Duration; @@ -3605,6 +3644,7 @@ async fn test_liveliness_subget_peer_history_before() { router.close().await.unwrap(); } +#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subget_peer_history_middle() { use std::time::Duration; @@ -3706,6 +3746,7 @@ async fn test_liveliness_subget_peer_history_middle() { /// ------------------------------------------------------- /// SUBGET ROUTER /// ------------------------------------------------------- +#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subget_router_before() { use std::time::Duration; @@ -3803,6 +3844,7 @@ async fn test_liveliness_subget_router_before() { router.close().await.unwrap(); } +#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subget_router_middle() { use std::time::Duration; @@ -3905,6 +3947,7 @@ async fn test_liveliness_subget_router_middle() { router.close().await.unwrap(); } +#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subget_router_history_before() { use std::time::Duration; @@ -4006,6 +4049,7 @@ async fn test_liveliness_subget_router_history_before() { router.close().await.unwrap(); } +#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subget_router_history_middle() { use std::time::Duration; @@ -4109,6 +4153,7 @@ async fn test_liveliness_subget_router_history_middle() { router.close().await.unwrap(); } +#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_regression_1() { use std::time::Duration; @@ -4192,6 +4237,7 @@ async fn test_liveliness_regression_1() { router.close().await.unwrap(); } +#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_regression_2() { use std::time::Duration; @@ -4285,6 +4331,7 @@ async fn test_liveliness_regression_2() { peer_sub.close().await.unwrap(); } +#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_regression_2_history() { use std::time::Duration; @@ -4385,6 +4432,7 @@ async fn test_liveliness_regression_2_history() { peer_sub.close().await.unwrap(); } +#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_regression_3() { use std::time::Duration; @@ -4490,6 +4538,7 @@ async fn test_liveliness_regression_3() { router.close().await.unwrap(); } +#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_issue_1470() { // https://github.com/eclipse-zenoh/zenoh/issues/1470 @@ -4673,6 +4722,7 @@ async fn test_liveliness_issue_1470() { /// ------------------------------------------------------- /// DOUBLE UNDECLARE CLIQUE /// ------------------------------------------------------- +#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_double_undeclare_clique() { use std::time::Duration; From 857ba11dbacfe5c43e4726a81481208e1918add4 Mon Sep 17 00:00:00 2001 From: Michael Ilyin Date: Tue, 10 Dec 2024 16:35:27 +0100 Subject: [PATCH 08/17] clippy fix, internal config global for liveliness test --- zenoh/tests/liveliness.rs | 52 ++------------------------------------- zenoh/tests/matching.rs | 1 + 2 files changed, 3 insertions(+), 50 deletions(-) diff --git a/zenoh/tests/liveliness.rs b/zenoh/tests/liveliness.rs index f0b9fc208..b88ac922b 100644 --- a/zenoh/tests/liveliness.rs +++ b/zenoh/tests/liveliness.rs @@ -11,10 +11,10 @@ // Contributors: // ZettaScale Zenoh Team, // -#[cfg(feature = "internal_config")] +#![cfg(feature = "internal_config")] + use zenoh_core::ztimeout; -#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_clique() { use std::time::Duration; @@ -77,7 +77,6 @@ async fn test_liveliness_subscriber_clique() { peer2.close().await.unwrap(); } -#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_query_clique() { use std::time::Duration; @@ -134,7 +133,6 @@ async fn test_liveliness_query_clique() { peer2.close().await.unwrap(); } -#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_brokered() { use std::time::Duration; @@ -213,7 +211,6 @@ async fn test_liveliness_subscriber_brokered() { client2.close().await.unwrap(); } -#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_query_brokered() { use std::time::Duration; @@ -284,7 +281,6 @@ async fn test_liveliness_query_brokered() { client2.close().await.unwrap(); } -#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_local() { use std::time::Duration; @@ -327,7 +323,6 @@ async fn test_liveliness_subscriber_local() { peer.close().await.unwrap(); } -#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_query_local() { use std::time::Duration; @@ -362,7 +357,6 @@ async fn test_liveliness_query_local() { peer.close().await.unwrap(); } -#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_after_close() { use std::time::Duration; @@ -421,7 +415,6 @@ async fn test_liveliness_after_close() { /// ------------------------------------------------------- /// DOUBLE CLIENT /// ------------------------------------------------------- -#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_client_before() { use std::time::Duration; @@ -516,7 +509,6 @@ async fn test_liveliness_subscriber_double_client_before() { router.close().await.unwrap(); } -#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_client_middle() { use std::time::Duration; @@ -614,7 +606,6 @@ async fn test_liveliness_subscriber_double_client_middle() { router.close().await.unwrap(); } -#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_client_after() { use std::time::Duration; @@ -714,7 +705,6 @@ async fn test_liveliness_subscriber_double_client_after() { router.close().await.unwrap(); } -#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_client_history_before() { use std::time::Duration; @@ -817,7 +807,6 @@ async fn test_liveliness_subscriber_double_client_history_before() { router.close().await.unwrap(); } -#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_client_history_middle() { use std::time::Duration; @@ -920,7 +909,6 @@ async fn test_liveliness_subscriber_double_client_history_middle() { router.close().await.unwrap(); } -#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_client_history_after() { use std::time::Duration; @@ -1025,7 +1013,6 @@ async fn test_liveliness_subscriber_double_client_history_after() { /// ------------------------------------------------------- /// DOUBLE PEER /// ------------------------------------------------------- -#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_peer_before() { use std::time::Duration; @@ -1114,7 +1101,6 @@ async fn test_liveliness_subscriber_double_peer_before() { router.close().await.unwrap(); } -#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_peer_middle() { use std::time::Duration; @@ -1206,7 +1192,6 @@ async fn test_liveliness_subscriber_double_peer_middle() { router.close().await.unwrap(); } -#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_peer_after() { use std::time::Duration; @@ -1300,7 +1285,6 @@ async fn test_liveliness_subscriber_double_peer_after() { router.close().await.unwrap(); } -#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_peer_history_before() { use std::time::Duration; @@ -1403,7 +1387,6 @@ async fn test_liveliness_subscriber_double_peer_history_before() { router.close().await.unwrap(); } -#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_peer_history_middle() { use std::time::Duration; @@ -1506,7 +1489,6 @@ async fn test_liveliness_subscriber_double_peer_history_middle() { router.close().await.unwrap(); } -#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_peer_history_after() { use std::time::Duration; @@ -1611,7 +1593,6 @@ async fn test_liveliness_subscriber_double_peer_history_after() { /// ------------------------------------------------------- /// DOUBLE ROUTER /// ------------------------------------------------------- -#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_router_before() { use std::time::Duration; @@ -1711,7 +1692,6 @@ async fn test_liveliness_subscriber_double_router_before() { router.close().await.unwrap(); } -#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_router_middle() { use std::time::Duration; @@ -1814,7 +1794,6 @@ async fn test_liveliness_subscriber_double_router_middle() { router.close().await.unwrap(); } -#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_router_after() { use std::time::Duration; @@ -1919,7 +1898,6 @@ async fn test_liveliness_subscriber_double_router_after() { router.close().await.unwrap(); } -#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_router_history_before() { use std::time::Duration; @@ -2027,7 +2005,6 @@ async fn test_liveliness_subscriber_double_router_history_before() { router.close().await.unwrap(); } -#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_router_history_middle() { use std::time::Duration; @@ -2135,7 +2112,6 @@ async fn test_liveliness_subscriber_double_router_history_middle() { router.close().await.unwrap(); } -#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_router_history_after() { use std::time::Duration; @@ -2245,7 +2221,6 @@ async fn test_liveliness_subscriber_double_router_history_after() { /// ------------------------------------------------------- /// DOUBLE CLIENT VIA PEER /// ------------------------------------------------------- -#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_clientviapeer_before() { use std::time::Duration; @@ -2359,7 +2334,6 @@ async fn test_liveliness_subscriber_double_clientviapeer_before() { router.close().await.unwrap(); } -#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_clientviapeer_middle() { use std::time::Duration; @@ -2476,7 +2450,6 @@ async fn test_liveliness_subscriber_double_clientviapeer_middle() { router.close().await.unwrap(); } -#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_clientviapeer_after() { use std::time::Duration; @@ -2595,7 +2568,6 @@ async fn test_liveliness_subscriber_double_clientviapeer_after() { router.close().await.unwrap(); } -#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_clientviapeer_history_before() { use std::time::Duration; @@ -2718,7 +2690,6 @@ async fn test_liveliness_subscriber_double_clientviapeer_history_before() { router.close().await.unwrap(); } -#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_clientviapeer_history_middle() { use std::time::Duration; @@ -2841,7 +2812,6 @@ async fn test_liveliness_subscriber_double_clientviapeer_history_middle() { router.close().await.unwrap(); } -#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subscriber_double_clientviapeer_history_after() { use std::time::Duration; @@ -2966,7 +2936,6 @@ async fn test_liveliness_subscriber_double_clientviapeer_history_after() { /// ------------------------------------------------------- /// SUBGET CLIENT /// ------------------------------------------------------- -#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subget_client_before() { use std::time::Duration; @@ -3059,7 +3028,6 @@ async fn test_liveliness_subget_client_before() { router.close().await.unwrap(); } -#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subget_client_middle() { use std::time::Duration; @@ -3157,7 +3125,6 @@ async fn test_liveliness_subget_client_middle() { router.close().await.unwrap(); } -#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subget_client_history_before() { use std::time::Duration; @@ -3254,7 +3221,6 @@ async fn test_liveliness_subget_client_history_before() { router.close().await.unwrap(); } -#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subget_client_history_middle() { use std::time::Duration; @@ -3356,7 +3322,6 @@ async fn test_liveliness_subget_client_history_middle() { /// ------------------------------------------------------- /// SUBGET PEER /// ------------------------------------------------------- -#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subget_peer_before() { use std::time::Duration; @@ -3449,7 +3414,6 @@ async fn test_liveliness_subget_peer_before() { router.close().await.unwrap(); } -#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subget_peer_middle() { use std::time::Duration; @@ -3547,7 +3511,6 @@ async fn test_liveliness_subget_peer_middle() { router.close().await.unwrap(); } -#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subget_peer_history_before() { use std::time::Duration; @@ -3644,7 +3607,6 @@ async fn test_liveliness_subget_peer_history_before() { router.close().await.unwrap(); } -#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subget_peer_history_middle() { use std::time::Duration; @@ -3746,7 +3708,6 @@ async fn test_liveliness_subget_peer_history_middle() { /// ------------------------------------------------------- /// SUBGET ROUTER /// ------------------------------------------------------- -#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subget_router_before() { use std::time::Duration; @@ -3844,7 +3805,6 @@ async fn test_liveliness_subget_router_before() { router.close().await.unwrap(); } -#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subget_router_middle() { use std::time::Duration; @@ -3947,7 +3907,6 @@ async fn test_liveliness_subget_router_middle() { router.close().await.unwrap(); } -#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subget_router_history_before() { use std::time::Duration; @@ -4049,7 +4008,6 @@ async fn test_liveliness_subget_router_history_before() { router.close().await.unwrap(); } -#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_subget_router_history_middle() { use std::time::Duration; @@ -4153,7 +4111,6 @@ async fn test_liveliness_subget_router_history_middle() { router.close().await.unwrap(); } -#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_regression_1() { use std::time::Duration; @@ -4237,7 +4194,6 @@ async fn test_liveliness_regression_1() { router.close().await.unwrap(); } -#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_regression_2() { use std::time::Duration; @@ -4331,7 +4287,6 @@ async fn test_liveliness_regression_2() { peer_sub.close().await.unwrap(); } -#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_regression_2_history() { use std::time::Duration; @@ -4432,7 +4387,6 @@ async fn test_liveliness_regression_2_history() { peer_sub.close().await.unwrap(); } -#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_regression_3() { use std::time::Duration; @@ -4538,7 +4492,6 @@ async fn test_liveliness_regression_3() { router.close().await.unwrap(); } -#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_issue_1470() { // https://github.com/eclipse-zenoh/zenoh/issues/1470 @@ -4722,7 +4675,6 @@ async fn test_liveliness_issue_1470() { /// ------------------------------------------------------- /// DOUBLE UNDECLARE CLIQUE /// ------------------------------------------------------- -#[cfg(feature = "internal_config")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_liveliness_double_undeclare_clique() { use std::time::Duration; diff --git a/zenoh/tests/matching.rs b/zenoh/tests/matching.rs index 503c1f5e4..c5cab1dff 100644 --- a/zenoh/tests/matching.rs +++ b/zenoh/tests/matching.rs @@ -12,6 +12,7 @@ // ZettaScale Zenoh Team, // #![cfg(feature = "unstable")] +#![cfg(feature = "internal_config")] use std::time::Duration; From b1db84398693cc9350e4826b0824743abc42caed Mon Sep 17 00:00:00 2001 From: Michael Ilyin Date: Tue, 10 Dec 2024 16:48:05 +0100 Subject: [PATCH 09/17] compile error fix --- zenoh/src/net/runtime/adminspace.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zenoh/src/net/runtime/adminspace.rs b/zenoh/src/net/runtime/adminspace.rs index 33ed04eb1..6fceec676 100644 --- a/zenoh/src/net/runtime/adminspace.rs +++ b/zenoh/src/net/runtime/adminspace.rs @@ -243,7 +243,7 @@ impl AdminSpace { } let requested_plugins = { - let cfg_guard = admin.context.runtime.state.config.lock(); + let cfg_guard = &admin.context.runtime.state.config.lock().0; cfg_guard.plugins().load_requests().collect::>() }; let mut diffs = Vec::new(); From 81bf52e63e4ada9b5dd5c13570e7a517d2d333da Mon Sep 17 00:00:00 2001 From: Michael Ilyin Date: Tue, 10 Dec 2024 16:51:10 +0100 Subject: [PATCH 10/17] compile fix correction --- zenoh/src/net/runtime/adminspace.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zenoh/src/net/runtime/adminspace.rs b/zenoh/src/net/runtime/adminspace.rs index 6fceec676..6271bcf05 100644 --- a/zenoh/src/net/runtime/adminspace.rs +++ b/zenoh/src/net/runtime/adminspace.rs @@ -243,8 +243,8 @@ impl AdminSpace { } let requested_plugins = { - let cfg_guard = &admin.context.runtime.state.config.lock().0; - cfg_guard.plugins().load_requests().collect::>() + let cfg_guard = admin.context.runtime.state.config.lock(); + cfg_guard.0.plugins().load_requests().collect::>() }; let mut diffs = Vec::new(); for plugin in active_plugins.keys() { From 7c1164eec43e9513852d05736587893e1dd8e451 Mon Sep 17 00:00:00 2001 From: Michael Ilyin Date: Tue, 10 Dec 2024 16:59:04 +0100 Subject: [PATCH 11/17] corrected shm test --- zenoh/tests/shm.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zenoh/tests/shm.rs b/zenoh/tests/shm.rs index 327ad76c0..4ed6da239 100644 --- a/zenoh/tests/shm.rs +++ b/zenoh/tests/shm.rs @@ -11,7 +11,7 @@ // Contributors: // ZettaScale Zenoh Team, // -#![cfg(all(feature = "unstable", feature = "shared-memory"))] +#![cfg(all(feature = "unstable", feature = "shared-memory", feature = "internal_config"))] use std::{ sync::{ atomic::{AtomicUsize, Ordering}, From 39566653f72b99bf0c1b52db2481b74b5b08955e Mon Sep 17 00:00:00 2001 From: Michael Ilyin Date: Tue, 10 Dec 2024 17:01:27 +0100 Subject: [PATCH 12/17] cargo fmt --- zenoh/tests/shm.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/zenoh/tests/shm.rs b/zenoh/tests/shm.rs index 4ed6da239..50194e766 100644 --- a/zenoh/tests/shm.rs +++ b/zenoh/tests/shm.rs @@ -11,7 +11,11 @@ // Contributors: // ZettaScale Zenoh Team, // -#![cfg(all(feature = "unstable", feature = "shared-memory", feature = "internal_config"))] +#![cfg(all( + feature = "unstable", + feature = "shared-memory", + feature = "internal_config" +))] use std::{ sync::{ atomic::{AtomicUsize, Ordering}, From 6b9647c9fb0b4b6ab5be0fc84e6fec3d2159a507 Mon Sep 17 00:00:00 2001 From: Michael Ilyin Date: Tue, 10 Dec 2024 17:11:01 +0100 Subject: [PATCH 13/17] zenoh-ext requires internal_config --- zenoh-ext/examples/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zenoh-ext/examples/Cargo.toml b/zenoh-ext/examples/Cargo.toml index 658eba106..ae84c1093 100644 --- a/zenoh-ext/examples/Cargo.toml +++ b/zenoh-ext/examples/Cargo.toml @@ -34,7 +34,7 @@ default = [] [dependencies] tokio = { workspace = true, features = ["rt", "sync", "time", "macros", "io-std"] } futures = { workspace = true } -zenoh = { workspace = true, features = ["unstable"], default-features = false } +zenoh = { workspace = true, features = ["unstable", "internal_config"], default-features = false } clap = { workspace = true, features = ["derive"] } zenoh-ext = { workspace = true, features = ["unstable"] } From 73be16e7c817aceb03e6227251ff320ad0eb1b5a Mon Sep 17 00:00:00 2001 From: Michael Ilyin Date: Tue, 10 Dec 2024 17:50:25 +0100 Subject: [PATCH 14/17] internal_config for zenohd --- zenohd/Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/zenohd/Cargo.toml b/zenohd/Cargo.toml index a422b0e6c..7a75ae6c3 100644 --- a/zenohd/Cargo.toml +++ b/zenohd/Cargo.toml @@ -44,6 +44,7 @@ zenoh = { workspace = true, features = [ "internal", "plugins", "runtime_plugins", + "internal_config", ] } zenoh-config = { workspace = true } From ce4ff0ba0b3051acf69b0c90827c0b9e9198033a Mon Sep 17 00:00:00 2001 From: Michael Ilyin Date: Tue, 10 Dec 2024 18:25:20 +0100 Subject: [PATCH 15/17] liveliness functionality moved from unstable --- zenoh/src/api/session.rs | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/zenoh/src/api/session.rs b/zenoh/src/api/session.rs index efeba8b87..a15ac605c 100644 --- a/zenoh/src/api/session.rs +++ b/zenoh/src/api/session.rs @@ -1583,7 +1583,6 @@ impl SessionInner { } } SubscriberKind::LivelinessSubscriber => { - #[cfg(feature = "unstable")] if kind == SubscriberKind::LivelinessSubscriber { let primitives = state.primitives()?; drop(state); @@ -2235,8 +2234,6 @@ impl SessionInner { self.task_controller .spawn_with_rt(zenoh_runtime::ZRuntime::Net, { let session = WeakSession::new(self); - #[cfg(feature = "unstable")] - let zid = self.zid(); async move { tokio::select! { _ = tokio::time::sleep(timeout) => { @@ -2252,7 +2249,7 @@ impl SessionInner { query.callback.call(Reply { result: Err(ReplyError::new("Timeout", Encoding::ZENOH_STRING)), #[cfg(feature = "unstable")] - replier_id: Some(zid.into()), + replier_id: Some(session.zid().into()), }); } } @@ -2602,9 +2599,6 @@ impl Primitives for WeakSession { } } } - #[cfg(not(feature = "unstable"))] - zenoh_protocol::network::DeclareBody::DeclareToken(_) => {} - #[cfg(feature = "unstable")] zenoh_protocol::network::DeclareBody::DeclareToken(m) => { let mut state = zwrite!(self.state); if state.primitives.is_none() { @@ -2629,7 +2623,6 @@ impl Primitives for WeakSession { reliability: Reliability::Reliable, #[cfg(feature = "unstable")] source_info: SourceInfo::empty(), - #[cfg(feature = "unstable")] attachment: None, }), #[cfg(feature = "unstable")] @@ -2664,7 +2657,6 @@ impl Primitives for WeakSession { } zenoh_protocol::network::DeclareBody::UndeclareToken(m) => { trace!("recv UndeclareToken {:?}", m.id); - #[cfg(feature = "unstable")] { let mut state = zwrite!(self.state); if state.primitives.is_none() { @@ -2686,7 +2678,6 @@ impl Primitives for WeakSession { SubscriberKind::LivelinessSubscriber, #[cfg(feature = "unstable")] Reliability::Reliable, - #[cfg(feature = "unstable")] None, ); } else if m.ext_wire_expr.wire_expr != WireExpr::empty() { @@ -2710,7 +2701,6 @@ impl Primitives for WeakSession { SubscriberKind::LivelinessSubscriber, #[cfg(feature = "unstable")] Reliability::Reliable, - #[cfg(feature = "unstable")] None, ); } @@ -2726,8 +2716,6 @@ impl Primitives for WeakSession { } DeclareBody::DeclareFinal(DeclareFinal) => { trace!("recv DeclareFinal {:?}", msg.interest_id); - - #[cfg(feature = "unstable")] if let Some(interest_id) = msg.interest_id { let mut state = zwrite!(self.state); let _ = state.liveliness_queries.remove(&interest_id); From aaa2d691baa4ca6028180a0048f8681a22d43b55 Mon Sep 17 00:00:00 2001 From: Michael Ilyin Date: Tue, 10 Dec 2024 18:36:25 +0100 Subject: [PATCH 16/17] clippy fix --- zenoh/src/api/session.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/zenoh/src/api/session.rs b/zenoh/src/api/session.rs index a15ac605c..d6d8e0528 100644 --- a/zenoh/src/api/session.rs +++ b/zenoh/src/api/session.rs @@ -11,7 +11,6 @@ // Contributors: // ZettaScale Zenoh Team, // -#[cfg(feature = "unstable")] use std::collections::hash_map::Entry; use std::{ collections::HashMap, @@ -2645,7 +2644,6 @@ impl Primitives for WeakSession { SubscriberKind::LivelinessSubscriber, #[cfg(feature = "unstable")] Reliability::Reliable, - #[cfg(feature = "unstable")] None, ); } From dd7fc3dd210f722343528bb4de6fc7cbf829ff18 Mon Sep 17 00:00:00 2001 From: Michael Ilyin Date: Tue, 10 Dec 2024 18:47:07 +0100 Subject: [PATCH 17/17] cargo fmt --- zenoh/src/api/session.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/zenoh/src/api/session.rs b/zenoh/src/api/session.rs index d6d8e0528..f3e0fe1e7 100644 --- a/zenoh/src/api/session.rs +++ b/zenoh/src/api/session.rs @@ -11,9 +11,8 @@ // Contributors: // ZettaScale Zenoh Team, // -use std::collections::hash_map::Entry; use std::{ - collections::HashMap, + collections::{hash_map::Entry, HashMap}, convert::TryInto, fmt, ops::Deref,