From cb90c08e5f9143385f8cd3080b5883f18ed29ea7 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Thu, 12 Jan 2023 16:18:24 +0100 Subject: Add missing meta information to behaviour tests Signed-off-by: Matthias Beyer --- .../src/behaviour/invalid_utf8_is_rejected.rs | 21 +++++++++++++++++++++ mqtt-tester/src/behaviour/wait_for_connect.rs | 21 +++++++++++++++++++++ 2 files changed, 42 insertions(+) (limited to 'mqtt-tester') diff --git a/mqtt-tester/src/behaviour/invalid_utf8_is_rejected.rs b/mqtt-tester/src/behaviour/invalid_utf8_is_rejected.rs index eea0fa5..efe7a6d 100644 --- a/mqtt-tester/src/behaviour/invalid_utf8_is_rejected.rs +++ b/mqtt-tester/src/behaviour/invalid_utf8_is_rejected.rs @@ -10,6 +10,7 @@ use crate::{ behaviour_test::BehaviourTest, command::{Input, Output}, executable::ClientExecutableCommand, + report::ReportResult, }; pub struct InvalidUtf8IsRejected; @@ -44,4 +45,24 @@ impl BehaviourTest for InvalidUtf8IsRejected { .await?; Ok(()) } + + fn report_name(&self) -> &str { + "Check if invalid UTF-8 is rejected" + } + + fn report_desc(&self) -> &str { + "Invalid UTF-8 is not allowed per the MQTT spec. Any receiver should immediately close the connection upon receiving such a packet." + } + + fn report_normative(&self) -> &str { + "[MQTT-1.5.3-1, MQTT-1.5.3-2]" + } + + fn translate_client_exit_code(&self, success: bool) -> ReportResult { + if success { + ReportResult::Failure + } else { + ReportResult::Success + } + } } diff --git a/mqtt-tester/src/behaviour/wait_for_connect.rs b/mqtt-tester/src/behaviour/wait_for_connect.rs index d61fe85..561acca 100644 --- a/mqtt-tester/src/behaviour/wait_for_connect.rs +++ b/mqtt-tester/src/behaviour/wait_for_connect.rs @@ -8,6 +8,7 @@ use crate::{ behaviour_test::BehaviourTest, command::{Input, Output}, executable::ClientExecutableCommand, + report::ReportResult, }; pub struct WaitForConnect; @@ -40,6 +41,26 @@ impl BehaviourTest for WaitForConnect { ) .await } + + fn report_name(&self) -> &str { + "Wait for client to connect" + } + + fn report_desc(&self) -> &str { + "A client should send a CONNECT packet to connect to the server" + } + + fn report_normative(&self) -> &str { + "none" + } + + fn translate_client_exit_code(&self, success: bool) -> ReportResult { + if success { + ReportResult::Success + } else { + ReportResult::Failure + } + } } fn find_connect_flags(bytes: &[u8]) -> Option { -- cgit v1.2.3