diff options
-rw-r--r-- | mqtt-tester/src/behaviour/invalid_utf8_is_rejected.rs | 21 | ||||
-rw-r--r-- | mqtt-tester/src/behaviour/wait_for_connect.rs | 21 |
2 files changed, 42 insertions, 0 deletions
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<u8> { |