hunyadi-dev commented on a change in pull request #835:
URL: https://github.com/apache/nifi-minifi-cpp/pull/835#discussion_r458082474



##########
File path: libminifi/test/integration/OnScheduleErrorHandlingTests.cpp
##########
@@ -25,31 +25,45 @@
 #include "core/state/ProcessorController.h"
 #include "../TestBase.h"
 #include "../KamikazeProcessor.h"
+#include "utils/IntegrationTestUtils.h"
 
 /*Verify behavior in case exceptions are thrown in onSchedule or onTrigger 
functions
  * KamikazeProcessor is a test processor to trigger errors in these functions 
*/
 class KamikazeErrorHandlingTests : public IntegrationBase {
  public:
   void runAssertions() override {
-    std::string logs = LogTestController::getInstance().log_output.str();
-
-    auto result = countPatInStr(logs, 
minifi::processors::KamikazeProcessor::OnScheduleExceptionStr);
-    size_t last_pos = result.first;
-    int occurrences = result.second;
-
-    assert(occurrences > 1);  // Verify retry of onSchedule and onUnSchedule 
calls
+    using org::apache::nifi::minifi::utils::verifyEventHappenedInPollTime;
+    
assert(verifyEventHappenedInPollTime(std::chrono::milliseconds(wait_time_), [&] 
{
+      const std::string logs = 
LogTestController::getInstance().log_output.str();
+      const auto result = countPatInStr(logs, 
minifi::processors::KamikazeProcessor::OnScheduleExceptionStr);
+      const int occurrences = result.second;
+      if (occurrences <= 1) {  // Verify retry of onSchedule and onUnSchedule 
calls

Review comment:
       Updated according to the suggestion, I did not realize that the 
suggestion is actually combining the return statements. I completely agree that 
it is the sane thing to do, I do not know how I missed it :D
   
   Updated the PublishKafkaOnScheduleTests as well that follows a similar 
pattern.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to