summaryrefslogtreecommitdiffstats
path: root/mqtt-tester
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2023-01-12 16:18:24 +0100
committerMatthias Beyer <mail@beyermatthias.de>2023-01-18 09:07:18 +0100
commitcb90c08e5f9143385f8cd3080b5883f18ed29ea7 (patch)
tree28ff9793a6f2f9f9dc5deb5390bcb06173512f58 /mqtt-tester
parent092d5c5817f54d01c011cae01d424603844ff539 (diff)
Add missing meta information to behaviour tests
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'mqtt-tester')
-rw-r--r--mqtt-tester/src/behaviour/invalid_utf8_is_rejected.rs21
-rw-r--r--mqtt-tester/src/behaviour/wait_for_connect.rs21
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> {