Skip to content

Commit 529fe66

Browse files
committed
Use ignore attribute to filter tests requiring Docker
Using the ignore attribute allows us to write all tests as if Docker were available. This also means that cargo build does not complain about unused imports and code if Docker is not available when running the tests.
1 parent 72ae29c commit 529fe66

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

tests/publish_subscribe.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,12 @@
1313

1414
use std::{str::FromStr, sync::Arc, time::Duration};
1515

16-
use tokio::sync::Notify;
1716
use up_rust::{MockUListener, UMessageBuilder, UTransport, UUri};
1817

1918
mod common;
2019

2120
#[tokio::test]
22-
#[cfg(docker_available)]
21+
#[cfg_attr(not(docker_available), ignore)]
2322
// This test requires Docker to run the Mosquitto MQTT broker.
2423
async fn test_publish_and_subscribe() {
2524
env_logger::init();
@@ -29,7 +28,7 @@ async fn test_publish_and_subscribe() {
2928

3029
let payload = "test_payload";
3130
let expected_payload = payload.to_owned();
32-
let message_received = Arc::new(Notify::new());
31+
let message_received = Arc::new(tokio::sync::Notify::new());
3332
let message_received_clone = message_received.clone();
3433
let mut listener = MockUListener::new();
3534
listener.expect_on_receive().once().return_once(move |msg| {

0 commit comments

Comments
 (0)