Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3540316
D4746.id15915.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D4746.id15915.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D4746: [services] Tunnelbroker - Changes in Amqp messages testing to send and listen in different threads
Attached
Detach File
Event Timeline
Log In to Comment