You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2020/08/05 16:10:09 UTC

[GitHub] [nifi-minifi-cpp] szaszm commented on a change in pull request #861: MINIFICPP-1312 - Fix flaky FlowControllerTest

szaszm commented on a change in pull request #861:
URL: https://github.com/apache/nifi-minifi-cpp/pull/861#discussion_r465840051



##########
File path: libminifi/test/flow-tests/FlowControllerTests.cpp
##########
@@ -215,20 +220,19 @@ TEST_CASE("Extend the waiting period during shutdown", "[TestFlow4]") {
   testController.startFlow();
 
   // wait for the source processor to enqueue its flowFiles
-  int tryCount = 0;
-  while (tryCount++ < 10 && root->getTotalFlowFileCount() != 3) {
-    std::this_thread::sleep_for(std::chrono::milliseconds{20});
-  }
+  busy_wait(std::chrono::milliseconds{50}, [&] {return root->getTotalFlowFileCount() != 0;});
 
-  REQUIRE(root->getTotalFlowFileCount() == 3);
+  REQUIRE(root->getTotalFlowFileCount() != 0);
   REQUIRE(sourceProc->trigger_count.load() == 1);
 
   std::thread shutdownThread([&]{
     execSinkPromise.set_value();
     controller->stop(true);
   });
 
-  while (controller->isRunning()) {
+  int extendCount = 0;
+  while (extendCount++ < 5 && controller->isRunning()) {

Review comment:
       shorter sleeps and checking for a timeout instead of run count should achieve the same goal without multiplying the uncertainty of the agents.




----------------------------------------------------------------
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:
users@infra.apache.org