WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion async-nats/src/service/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ impl Group {
queue_group: Z,
) -> Group {
Group {
prefix: prefix.to_string(),
prefix: format!("{}.{}", self.prefix, prefix.to_string()),
stats: self.stats.clone(),
client: self.client.clone(),
shutdown_tx: self.shutdown_tx.clone(),
Expand Down Expand Up @@ -891,3 +891,30 @@ impl std::fmt::Debug for StatsHandler {
write!(f, "Stats handler")
}
}

#[cfg(test)]
mod tests {
use super::*;

#[tokio::test]
async fn test_group_with_queue_group() {
let server = nats_server::run_basic_server();
let client = crate::connect(server.client_url()).await.unwrap();

let group = Group {
prefix: "test".to_string(),
stats: Arc::new(Mutex::new(Endpoints {
endpoints: HashMap::new(),
})),
client,
shutdown_tx: tokio::sync::broadcast::channel(1).0,
subjects: Arc::new(Mutex::new(vec![])),
queue_group: "default".to_string(),
};

let new_group = group.group_with_queue_group("v1", "custom_queue");

assert_eq!(new_group.prefix, "test.v1");
assert_eq!(new_group.queue_group, "custom_queue");
}
}
Loading