Repository: robustmq/robustmq (language: rust)

Issue:
MINOR: Add a test case to is_message_expire of file src/mqtt-broker/src/handler/message.rs
### What type of enhancement is this?

Refactor

### What does the enhancement do?

Refer to the implementation of other test cases

### Implementation challenges

_No response_


Discussion / hints:
please assign me. thanks.

Fix patch:
diff --git a/src/journal-server/src/segment/read.rs b/src/journal-server/src/segment/read.rs
index ce1a455e9..5ea5e4ee2 100644
--- a/src/journal-server/src/segment/read.rs
+++ b/src/journal-server/src/segment/read.rs
@@ -11,7 +11,6 @@
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 // See the License for the specific language governing permissions and
 // limitations under the License.
-
 use std::sync::Arc;
 
 use protocol::journal_server::journal_engine::{
diff --git a/src/mqtt-broker/src/handler/message.rs b/src/mqtt-broker/src/handler/message.rs
index ca8bd9ecf..7897dc6b4 100644
--- a/src/mqtt-broker/src/handler/message.rs
+++ b/src/mqtt-broker/src/handler/message.rs
@@ -49,10 +49,11 @@ mod tests {
     use metadata_struct::mqtt::cluster::{
         MqttClusterDynamicConfig, MqttClusterDynamicConfigProtocol,
     };
+    use metadata_struct::mqtt::message::MqttMessage;
     use protocol::mqtt::common::PublishProperties;
 
     use crate::handler::cache::CacheManager;
-    use crate::handler::message::build_message_expire;
+    use crate::handler::message::{build_message_expire, is_message_expire};
 
     #[test]
     fn build_message_expire_test() {
@@ -79,4 +80,21 @@ mod tests {
         let res = build_message_expire(&cache_manager, &Some(publish_properties));
         assert_eq!(res, now_second() + 3);
     }
+
+    #[test]
+    fn is_message_expire_test() {
+        let message = MqttMessage {
+            expiry_interval: now_second() - 10,
+            ..Default::default()
+        };
+
+        assert!(is_message_expire(&message));
+
+        let message = MqttMessage {
+            expiry_interval: now_second() + 10,
+            ..Default::default()
+        };
+
+        assert!(!is_message_expire(&message));
+    }
 }


Test patch: