Page MenuHomePhabricator

D4746.id15915.diff
No OneTemporary

D4746.id15915.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
Fri, Dec 27, 4:44 AM (8 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2709407
Default Alt Text
D4746.id15915.diff (1 KB)

Event Timeline