You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "lordgamez (via GitHub)" <gi...@apache.org> on 2025/02/11 11:35:42 UTC

[PR] MINIFICPP-2475: Fix CivetWeb build dependencies [nifi-minifi-cpp]

lordgamez opened a new pull request, #1929:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1929

   - CivetWeb lib is built for Prometheus, Loki and Civetweb extensions
   - CivetWeb lib is built for tests separately if no extension needs the library
   - Tests only link to CivetWeb library instead of minifi-civetweb extension
   - Tests requiring processors and C2 receivers from CivetWeb extension are moved under CivetWeb extension
   - ListenHTTP processor from CivetWeb extension is removed from InvokeHTTPTests
   
   https://issues.apache.org/jira/browse/MINIFICPP-2475
   
   ---------------------------
   Thank you for submitting a contribution to Apache NiFi - MiNiFi C++.
   
   In order to streamline the review of the contribution we ask you
   to ensure the following steps have been taken:
   
   ### For all changes:
   - [ ] Is there a JIRA ticket associated with this PR? Is it referenced
        in the commit message?
   
   - [ ] Does your PR title start with MINIFICPP-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
   
   - [ ] Has your PR been rebased against the latest commit within the target branch (typically main)?
   
   - [ ] Is your initial contribution a single, squashed commit?
   
   ### For code changes:
   - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)?
   - [ ] If applicable, have you updated the LICENSE file?
   - [ ] If applicable, have you updated the NOTICE file?
   
   ### For documentation related changes:
   - [ ] Have you ensured that format looks appropriate for the output in which it is rendered?
   
   ### Note:
   Please ensure that once the PR is submitted, you check GitHub Actions CI results for build issues and submit an update to your PR as soon as possible.
   


-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINIFICPP-2475: Fix CivetWeb build dependencies [nifi-minifi-cpp]

Posted by "lordgamez (via GitHub)" <gi...@apache.org>.
lordgamez commented on code in PR #1929:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1929#discussion_r1952290966


##########
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:
   Good idea, updated in https://github.com/apache/nifi-minifi-cpp/pull/1929/commits/6c1f137170ca6a00a79b19e3427f9144e1bcefa7



##########
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:
   Good point, updated in https://github.com/apache/nifi-minifi-cpp/pull/1929/commits/6c1f137170ca6a00a79b19e3427f9144e1bcefa7



-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINIFICPP-2475: Fix CivetWeb build dependencies [nifi-minifi-cpp]

Posted by "fgerlits (via GitHub)" <gi...@apache.org>.
fgerlits closed pull request #1929: MINIFICPP-2475: Fix CivetWeb build dependencies
URL: https://github.com/apache/nifi-minifi-cpp/pull/1929


-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINIFICPP-2475: Fix CivetWeb build dependencies [nifi-minifi-cpp]

Posted by "szaszm (via GitHub)" <gi...@apache.org>.
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org