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/07/08 12:57:07 UTC

[GitHub] [nifi-minifi-cpp] fgerlits commented on a change in pull request #835: MINIFICPP-1281 - Improve test performance by using event polling instead of sleep by sync

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



##########
File path: extensions/http-curl/tests/HTTPIntegrationBase.h
##########
@@ -135,6 +135,9 @@ class VerifyC2Describe : public VerifyC2Base {
   }
 
   void runAssertions() override {
+    // This class is never used for running assertions, but we are forced to wait for DescribeManifestHandler to verifyJsonHasAgentManifest
+    // if we were to log something on finished verification, we could poll on finding it 
+    std::this_thread::sleep_for(std::chrono::milliseconds(wait_time_));

Review comment:
       A `runAssertions()` function that doesn't run assertions looks weird (as you clearly felt, too, hence the comment).  It may be better to keep `waitToVerifyProcessor()` and `runAssertions()` separate, but make their default implementations no-op.

##########
File path: libminifi/test/0-9
##########
@@ -0,0 +1 @@
+C API raNdOMcaSe test d4t4 th1s is!

Review comment:
       garbage left over by a test run

##########
File path: libminifi/include/utils/IntegrationTestUtils.h
##########
@@ -0,0 +1,65 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <utility>
+#include <string>
+
+#include "../../../libminifi/test/TestBase.h"
+
+namespace org {
+namespace apache {
+namespace nifi {
+namespace minifi {
+namespace utils {
+
+template <class Rep, class Period, typename Fun>
+bool verifyEventHappenedInPollTime(const std::chrono::duration<Rep, Period>& wait_duration, Fun&& check) {

Review comment:
       You could replace the `becomesTrueWithinTimeout()` calls in `libminifi/test/unit/MinifiConcurrentQueueTests.cpp` with calls to this function, or make `becomesTrueWithinTimeout()` call `verifyEventHappenedInPollTime()`, as they are almost identical.

##########
File path: extensions/http-curl/tests/VerifyInvokeHTTPTest.cpp
##########
@@ -93,47 +95,55 @@ class VerifyInvokeHTTP : public CoapIntegrationBase {
     flowController_->unload();
     flowController_->stopC2();
 
-    runAssertions();
     cleanup();
   }
 };
 
 class VerifyInvokeHTTPOKResponse : public VerifyInvokeHTTP {
-public:
-  virtual void runAssertions() override {
-    assert(LogTestController::getInstance().contains("key:invokehttp.status.code value:201"));
-    assert(LogTestController::getInstance().contains("response code 201"));
+ public:
+  void runAssertions() override {
+    using org::apache::nifi::minifi::utils::verifyLogLinePresenceInPollTime;
+    assert(verifyLogLinePresenceInPollTime(std::chrono::seconds(6),

Review comment:
       Why did the timeouts in this test increase to 6 seconds (from the default 3 seconds which they were before)?




----------------------------------------------------------------
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