Skip to content

Commit caca5f0

Browse files
committed
Merge commit 'e03b0c0ec4716c0500b4fcdaceb89570381011b0'
2 parents 1215544 + e03b0c0 commit caca5f0

5 files changed

Lines changed: 20 additions & 27 deletions

File tree

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
live-run: ${{ inputs.live-run || false }}
5656
version: ${{ steps.create-release-branch.outputs.version }}
5757
branch: ${{ steps.create-release-branch.outputs.branch }}
58-
bump-deps-pattern: zenoh.*
58+
bump-deps-pattern: "zenoh(?!-test).*"
5959
bump-deps-version: ${{ steps.create-release-branch.outputs.version }}
6060
github-token: ${{ secrets.BOT_TOKEN_WORKFLOW }}
6161

@@ -91,7 +91,7 @@ jobs:
9191
repo: ${{ github.repository }}
9292
live-run: ${{ inputs.live-run || false }}
9393
branch: ${{ needs.tag.outputs.branch }}
94-
unpublished-deps-patterns: "zenoh.*"
94+
unpublished-deps-patterns: "zenoh(?!-test).*"
9595
secrets: inherit
9696

9797
debian:

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ zenoh-shm = { version = "=1.9.0", path = "commons/zenoh-shm" }
256256
zenoh-stats = { version = "=1.9.0", path = "commons/zenoh-stats" }
257257
zenoh-sync = { version = "=1.9.0", path = "commons/zenoh-sync" }
258258
zenoh-task = { version = "=1.9.0", path = "commons/zenoh-task" }
259-
zenoh-test = { version = "=1.9.0", path = "commons/zenoh-test" }
259+
zenoh-test = { path = "commons/zenoh-test" }
260260
zenoh-transport = { version = "=1.9.0", path = "io/zenoh-transport", default-features = false }
261261
zenoh-uring = { version = "=1.9.0", path = "commons/zenoh-uring" }
262262
zenoh-util = { version = "=1.9.0", path = "commons/zenoh-util" }

plugins/zenoh-plugin-rest/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ serde_json = { workspace = true }
6363

6464
[dev-dependencies]
6565
clap = { workspace = true }
66+
zenoh-test = { workspace = true }
6667

6768
[[example]]
6869
name = "z_serve_sse"

plugins/zenoh-plugin-rest/src/lib.rs

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -572,36 +572,21 @@ mod tests {
572572
use futures::{FutureExt, StreamExt};
573573
use tokio::time::timeout;
574574
use tower::ServiceExt;
575-
use zenoh::{bytes::Encoding, sample::SampleKind, Config, Session, Wait};
575+
use zenoh::{bytes::Encoding, sample::SampleKind, Session, Wait};
576+
use zenoh_test::TestSessions;
576577

577578
use crate::app;
578579

579-
const TEST_PORTS: [u16; 3] = [42000, 42001, 42002];
580-
581-
async fn setup(port: u16) -> (Session, Session) {
582-
let mut config1 = Config::default();
583-
config1.scouting.multicast.set_enabled(Some(false)).unwrap();
584-
config1
585-
.listen
586-
.endpoints
587-
.set(vec![format!("tcp/127.0.0.1:{}", port).parse().unwrap()])
588-
.unwrap();
589-
590-
let mut config2 = Config::default();
591-
config2.scouting.multicast.set_enabled(Some(false)).unwrap();
592-
config2
593-
.connect
594-
.endpoints
595-
.set(vec![format!("tcp/127.0.0.1:{}", port).parse().unwrap()])
596-
.unwrap();
597-
let (s1, s2) = tokio::try_join!(zenoh::open(config1), zenoh::open(config2)).unwrap();
580+
async fn setup() -> (TestSessions, Session, Session) {
581+
let mut test_sessions = TestSessions::new();
582+
let (s1, s2) = test_sessions.open_pairs().await;
598583
tokio::time::sleep(Duration::from_secs(1)).await;
599-
(s1, s2)
584+
(test_sessions, s1, s2)
600585
}
601586

602587
#[tokio::test(flavor = "multi_thread", worker_threads = 4)]
603588
async fn publish() {
604-
let (pub_session, sub_session) = setup(TEST_PORTS[0]).await;
589+
let (mut test_sessions, pub_session, sub_session) = setup().await;
605590
let subscriber = sub_session.declare_subscriber("test/**").await.unwrap();
606591
tokio::time::sleep(Duration::from_secs(1)).await;
607592
for method in [Method::PUT, Method::PATCH] {
@@ -639,11 +624,13 @@ mod tests {
639624
let sample = subscriber.try_recv().unwrap().unwrap();
640625
assert_eq!(sample.kind(), SampleKind::Delete);
641626
assert_eq!(sample.key_expr().as_str(), "test/publish");
627+
628+
test_sessions.close().await;
642629
}
643630

644631
#[tokio::test(flavor = "multi_thread", worker_threads = 4)]
645632
async fn subscribe() {
646-
let (pub_session, sub_session) = setup(TEST_PORTS[1]).await;
633+
let (mut test_sessions, pub_session, sub_session) = setup().await;
647634
let response = app(sub_session.clone())
648635
.oneshot(
649636
Request::builder()
@@ -685,11 +672,13 @@ mod tests {
685672
}),
686673
);
687674
}
675+
676+
test_sessions.close().await;
688677
}
689678

690679
#[tokio::test(flavor = "multi_thread", worker_threads = 4)]
691680
async fn query() {
692-
let (get_session, queryable_session) = setup(TEST_PORTS[2]).await;
681+
let (mut test_sessions, get_session, queryable_session) = setup().await;
693682
let _queryable = queryable_session
694683
.declare_queryable("test/**")
695684
.callback(|q| {
@@ -746,5 +735,7 @@ mod tests {
746735
.unwrap();
747736
check(body);
748737
}
738+
739+
test_sessions.close().await;
749740
}
750741
}

0 commit comments

Comments
 (0)