@@ -805,4 +805,83 @@ TEST_F(ITest_Internals_DataPubSub, test_1pub_1sub_async_rejoin)
805805 ShutdownSystem ();
806806}
807807
808+
809+ // Two publishers (optional label1), one subscriber (optional label1, label2); publishers start first; subscriber joins
810+ TEST_F (ITest_Internals_DataPubSub, test_2pub_1sub_async_starting_order)
811+ {
812+ const uint32_t numMsgToPublish = 1 ;
813+ const uint32_t numMsgToReceive = 1 * numMsgToPublish;
814+
815+ std::vector<PubSubParticipant> publishers;
816+ publishers.push_back ({" Pub1" ,
817+ {{" PubCtrl1" ,
818+ " TopicA" ,
819+ {" A" },
820+ {{" K1" , " V1" , SilKit::Services::MatchingLabel::Kind::Optional}},
821+ 1 ,
822+ defaultMsgSize,
823+ numMsgToPublish}},
824+ {}});
825+ publishers.push_back ({" Pub2" ,
826+ {{" PubCtrl1" ,
827+ " TopicA" ,
828+ {" A" },
829+ {{" K1" , " V1" , SilKit::Services::MatchingLabel::Kind::Optional}},
830+ 1 ,
831+ defaultMsgSize,
832+ numMsgToPublish}},
833+ {}});
834+
835+ std::vector<PubSubParticipant> subscribers;
836+ std::vector<std::vector<uint8_t >> expectedDataUnordered;
837+ expectedDataUnordered.reserve (numMsgToReceive);
838+ for (uint32_t d = 0 ; d < numMsgToReceive; d++)
839+ {
840+ // Receive the same blob several times (once from every publisher)
841+ expectedDataUnordered.emplace_back (std::vector<uint8_t >(defaultMsgSize, 0 ));
842+ }
843+ subscribers.push_back (
844+ {" Sub1" ,
845+ {},
846+ {{
847+ " SubCtrl1" ,
848+ " TopicA" ,
849+ {" A" },
850+ {{" K1" , " V1" , SilKit::Services::MatchingLabel::Kind::Optional},
851+ {" K2" , " V2" , SilKit::Services::MatchingLabel::Kind::Optional}
852+ }, // BUGHUNT: Second label breaks communication
853+ defaultMsgSize,
854+ numMsgToReceive,
855+ 1 ,
856+ expectedDataUnordered,
857+ }}});
858+
859+ for (auto & sub : subscribers)
860+ {
861+ sub.communicationTimeout = std::chrono::milliseconds (1000 );
862+ }
863+
864+ _testSystem.SetupRegistryAndSystemMaster (" silkit://localhost:0" , false , {});
865+
866+
867+ // BUGHUNT: Subscribers start first fails SOMETIMES
868+ // RunParticipants(subscribers, _testSystem.GetRegistryUri(), false);
869+
870+ // BUGHUNT: Publishers start first fails ALWAYS
871+
872+ // Start publishers
873+ RunParticipants (publishers, _testSystem.GetRegistryUri (), false );
874+ for (auto & p : publishers)
875+ {
876+ p.WaitForAllSent ();
877+ }
878+
879+ // Start subscriber
880+ RunParticipants (subscribers, _testSystem.GetRegistryUri (), false );
881+
882+
883+ JoinPubSubThreads ();
884+ ShutdownSystem ();
885+ }
886+
808887} // anonymous namespace
0 commit comments