szaszm commented on code in PR #1929:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1929#discussion_r1951384074


##########
libminifi/test/libtest/CMakeLists.txt:
##########
@@ -16,5 +16,11 @@
 # specific language governing permissions and limitations
 # under the License.
 #
+if (NOT ENABLE_ALL AND NOT ENABLE_PROMETHEUS AND NOT ENABLE_GRAFANA_LOKI AND 
NOT ENABLE_CIVET)
+    message("CivetWeb was disabled for MiNiFi, but will be enabled for tests")
+    include(GetCivetWeb)
+    get_civetweb()
+endif()
+

Review Comment:
   I think this should just always run and make sure that civet is available 
when tests need it. I'd remove the `if` condition and make sure that including 
GetCivetWeb from multiple files only created the target once.



##########
extensions/standard-processors/tests/integration/InvokeHTTPTests.cpp:
##########
@@ -271,9 +290,12 @@ TEST_CASE("InvokeHTTP Attributes to Send uses full string 
matching, not substrin
   auto file_contents = result.at(InvokeHTTP::Success);
   REQUIRE(file_contents.size() == 1);
   REQUIRE(test_controller.plan->getContent(file_contents[0]) == "data");
-  REQUIRE(utils::verifyLogLinePresenceInPollTime(1s, "key:header 
value:value2"));
-  REQUIRE_FALSE(LogTestController::getInstance().contains("key:header1 
value:value1"));
-  REQUIRE_FALSE(LogTestController::getInstance().contains("key:invalid", 0s));
+  REQUIRE(http_server.getHeaders().at("header") == "value2");
+  REQUIRE_FALSE(http_server.getHeaders().contains("header1"));
+  auto header_keys = http_server.getHeaderKeys();
+  REQUIRE(std::find_if(header_keys.begin(), header_keys.end(), [] (const auto& 
key) {
+    return minifi::utils::string::startsWith(key, "invalid");
+  }) == header_keys.end());

Review Comment:
   Higher level algorithms make the code more descriptive
   ```suggestion
     REQUIRE(std::none_of(header_keys.begin(), header_keys.end(), [] (const 
auto& key) {
       return minifi::utils::string::startsWith(key, "invalid");
     }));
   ```
   
   This snippet is repeated 4 times, and it's not trivial, so I think it should 
be extracted.



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

To unsubscribe, e-mail: [email protected]

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

Reply via email to