Page MenuHomePhabricator

D4746.diff
No OneTemporary

D4746.diff

diff --git a/services/tunnelbroker/test/AmqpManagerTest.cpp b/services/tunnelbroker/test/AmqpManagerTest.cpp
--- a/services/tunnelbroker/test/AmqpManagerTest.cpp
+++ b/services/tunnelbroker/test/AmqpManagerTest.cpp
@@ -37,7 +37,11 @@
"6d37StvXBzfJoZVU79UeOF2bFvb3DNoArEOe";
const database::MessageItem messageItem{
messageID, fromDeviceID, toDeviceID, payload, ""};
- EXPECT_EQ(AmqpManager::getInstance().send(&messageItem), true);
+ // To properly test multi-thread delivery we should send in another thread
+ std::thread sendThread([&messageItem]() {
+ EXPECT_EQ(AmqpManager::getInstance().send(&messageItem), true);
+ });
+ sendThread.join();
DeliveryBrokerMessage receivedMessage =
DeliveryBroker::getInstance().pop(toDeviceID);
EXPECT_EQ(messageID, receivedMessage.messageID);
@@ -55,7 +59,11 @@
const std::string payload = tools::generateRandomString(512);
const database::MessageItem messageItem{
messageID, fromDeviceID, toDeviceID, payload, ""};
- EXPECT_EQ(AmqpManager::getInstance().send(&messageItem), true);
+ // To properly test multi-thread delivery we should send in another thread
+ std::thread sendThread([&messageItem]() {
+ EXPECT_EQ(AmqpManager::getInstance().send(&messageItem), true);
+ });
+ sendThread.join();
DeliveryBrokerMessage receivedMessage =
DeliveryBroker::getInstance().pop(toDeviceID);
EXPECT_EQ(messageID, receivedMessage.messageID)

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 23, 8:06 PM (20 h, 15 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2572301
Default Alt Text
D4746.diff (1 KB)

Event Timeline