bakaid commented on a change in pull request #596: MINIFICPP-925 - Fix TailFile
hang on long lines
URL: https://github.com/apache/nifi-minifi-cpp/pull/596#discussion_r296877515
##########
File path: extensions/standard-processors/tests/unit/TailFileTests.cpp
##########
@@ -105,12 +111,127 @@ TEST_CASE("TailFileWithOutDelimiter",
"[tailfiletest2]") {
testController.runSession(plan, false);
auto records = plan->getProvenanceRecords();
- std::shared_ptr<core::FlowFile> record = plan->getCurrentFlowFile();
- REQUIRE(record == nullptr);
REQUIRE(records.size() == 2);
testController.runSession(plan, false);
+ REQUIRE(LogTestController::getInstance().contains("Logged 1 flow files"));
+ REQUIRE(LogTestController::getInstance().contains("Size:" +
std::to_string(NEWLINE_FILE.size()) + " Offset:0"));
+
+ LogTestController::getInstance().reset();
+
+ // Delete the test and state file.
+ remove(TMP_FILE);
+ remove(STATE_FILE);
+}
+
+TEST_CASE("TailFileLongWithDelimiter", "[tailfiletest2]") {
+ std::string line1("foo");
+ std::string line2(8050, 0);
+ std::mt19937 gen(std::random_device { }());
+ std::generate_n(line2.begin(), line2.size(), [&]() -> char {
Review comment:
The result of my code is very similar to the code you have linked, as it
generates a string of printable characters for ASCII 32 to 126, therefore this
particular instance does not necessitate hex conversion.
I will write a global comment explaining the process and rational behind the
changes in this PR, hopefully that will clear things up.
----------------------------------------------------------------
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]
With regards,
Apache Git Services