diff options
author | Didier Wenzek <didier.wenzek@free.fr> | 2022-02-07 16:16:07 +0000 |
---|---|---|
committer | Didier Wenzek <didier.wenzek@free.fr> | 2022-02-08 14:02:59 +0000 |
commit | 6438323c0ee3e88bffd6d7396abe7b8f1f416021 (patch) | |
tree | e1780c0817002a2950707f23b6684c96f62e6788 /crates/common/mqtt_channel/src | |
parent | 593e2ae1f3993fc68ae459b8b51b276303ae6431 (diff) |
Improve error handling on subscription errors
There is still a weird corner case: the test mqtt server reject
subscriptions on a topic which prefix is test.
Signed-off-by: Didier Wenzek <didier.wenzek@free.fr>
Diffstat (limited to 'crates/common/mqtt_channel/src')
-rw-r--r-- | crates/common/mqtt_channel/src/tests.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/common/mqtt_channel/src/tests.rs b/crates/common/mqtt_channel/src/tests.rs index 274e5f22..f47096ab 100644 --- a/crates/common/mqtt_channel/src/tests.rs +++ b/crates/common/mqtt_channel/src/tests.rs @@ -446,10 +446,10 @@ mod tests { let topic = TopicFilter::new_unchecked("test/topic"); let mqtt_config = mqtt_config.with_subscriptions(topic); - if let Err(MqttError::SubscriptionFailure) = Connection::new(&mqtt_config).await { - // For some unknown reason, the test MQTT server rejects any subscription on `test/#` topics - } else { - panic!("The MQTT subscription is expected to fail"); - } + // For some unknown reason, the test MQTT server rejects any subscription on `test/#` topics + assert!(matches!( + Connection::new(&mqtt_config).await, + Err(MqttError::SubscriptionFailure) + )); } } |