2017-10-16 01:52:56 +02:00
|
|
|
use super::*;
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_open_delete() {
|
|
|
|
// Simple test with default queue settings
|
|
|
|
let name = Name::new("/test-queue").unwrap();
|
2022-02-07 16:49:59 +01:00
|
|
|
let queue = Queue::open_or_create(name).expect("Opening queue failed");
|
2017-10-16 01:52:56 +02:00
|
|
|
|
|
|
|
let message = Message {
|
|
|
|
data: "test-message".as_bytes().to_vec(),
|
|
|
|
priority: 0,
|
|
|
|
};
|
|
|
|
|
|
|
|
queue.send(&message).expect("message sending failed");
|
|
|
|
|
|
|
|
let result = queue.receive().expect("message receiving failed");
|
|
|
|
|
|
|
|
assert_eq!(message, result);
|
|
|
|
|
2020-01-20 12:48:35 +01:00
|
|
|
queue.delete().expect("deleting queue failed");
|
2017-10-16 01:52:56 +02:00
|
|
|
}
|