Add Integration Test for Remote Logging - #344
Conversation
Signed-off-by: Konrad Breitsprecher <Konrad.Breitsprecher@vector.com>
snps-behrens
left a comment
There was a problem hiding this comment.
Looks pretty good already. I left some comments and questions.
| " LogName: " | ||
| + receiverLogName + "\n"; | ||
|
|
||
| SimTestHarness testHarness{{"Sender1", "Sender2", "Receiver"}, "silkit://localhost:0", true}; |
There was a problem hiding this comment.
This version of the constructor is marked deprecated, and says the single-argument version taking a SimTestHarnessArgs object should be used.
| Level: Trace | ||
| )"; | ||
|
|
||
| const auto receiverConfig = "Logging:\n" |
There was a problem hiding this comment.
I think this could be made more consistent with the above senderConfig by using a raw string inside a call to fmt::format().
| std::filesystem::path logFile; | ||
| std::string logContent; | ||
|
|
||
| while (std::chrono::steady_clock::now() < deadline) |
There was a problem hiding this comment.
Why is this polling loop necessary?
| const std::string sender1Message = "remote-log-from-sender-1"; | ||
| const std::string sender2Message = "remote-log-from-sender-2"; | ||
|
|
||
| std::atomic<bool> sender1Logged{false}; |
There was a problem hiding this comment.
I don't think these std::atomics are needed, right?
| auto* sender2TimeSync = sender2->GetOrCreateTimeSyncService(); | ||
| auto* receiverTimeSync = receiver->GetOrCreateTimeSyncService(); | ||
|
|
||
| auto* sender1Logger = sender1->Participant()->GetLogger(); |
There was a problem hiding this comment.
Looks like SimParticipant also has a GetLogger function. Maybe use that here instead?
| } | ||
| } | ||
|
|
||
| if (candidates.size() != 1u) |
There was a problem hiding this comment.
Would it make sense to distiguish between the two failure modes here already? candidates.emty() is an expected result during polling, but candidates.size() > 1 would indicate somehting else went wrong.
Summary
Add a new integration test for remote logging with three participants in
SilKit/IntegrationTests/ITest_RemoteLogging.cpp.Sender1andSender2configured with a remote logging sinkReceiverconfigured withLogFromRemotes: trueand a file sinkSender1andSender2each emit a unique log message