This is an automated email from the ASF dual-hosted git repository. shuber pushed a commit to branch opensearch-persistence in repository https://gitbox.apache.org/repos/asf/unomi.git
commit 00584ac6fd9fdec141b6300b88afd3a578b0651d Author: Serge Huber <[email protected]> AuthorDate: Tue Dec 31 17:32:01 2024 +0100 - Small cosmetic changes to the progress listener's top 10 slowest tests output to be CSV compatible - Added a known issue in the itests README to reference the log issue on OpenSearch 2.18. --- itests/README.md | 10 +++++-- .../org/apache/unomi/itests/ProgressListener.java | 33 +++++++++++++--------- 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/itests/README.md b/itests/README.md index 1e24c52f3..ad9f77f82 100644 --- a/itests/README.md +++ b/itests/README.md @@ -275,9 +275,15 @@ And the final step is, zipping the new version of the snapshot repository and re Now you can modify the migration test class to test that your added data in 1.6.x is correctly migrated in 2.0.0 -# Integration Tests +# Known issues -This directory contains the integration tests for Apache Unomi. +In the OpenSearch test logs, you will see a lot of lines that look like this : + + opensearch> [2024-12-31T15:33:14,652][WARN ][o.o.w.QueryGroupTask ] [f3200971b164] QueryGroup _id can't be null, It should be set before accessing it. This is abnormal behaviour + +This is due to a bug in OpenSearch 2.18 but it has no impact on the actual functionality. You can track this bug here: + + https://github.com/opensearch-project/OpenSearch/issues/16874 ## Karaf Tools diff --git a/itests/src/test/java/org/apache/unomi/itests/ProgressListener.java b/itests/src/test/java/org/apache/unomi/itests/ProgressListener.java index a1441983d..ca764ba06 100644 --- a/itests/src/test/java/org/apache/unomi/itests/ProgressListener.java +++ b/itests/src/test/java/org/apache/unomi/itests/ProgressListener.java @@ -170,25 +170,32 @@ public class ProgressListener extends RunListener { ansiSupported ? RESET : ""); // Display the top 10 slowest tests - System.out.println("═══════════════════════════════════════════════════════════"); System.out.printf("Top 10 Slowest Tests:%n"); - // Table header - System.out.printf("%s%-4s %-50s %-10s%s%n", - ansiSupported ? BLUE : "", - "Rank", "Test Name", "Duration", - ansiSupported ? RESET : ""); - System.out.printf("%s%-4s %-50s %-10s%s%n", - ansiSupported ? BLUE : "", - "----", "--------------------------------------------------", "----------", - ansiSupported ? RESET : ""); + // Prepare CSV data + StringBuilder csvBuilder = new StringBuilder(); + csvBuilder.append("Rank,Test Name,Duration (ms)\n"); - // Table rows for the top 10 slowest tests AtomicInteger rank = new AtomicInteger(1); slowTests.stream() .sorted((t1, t2) -> Long.compare(t2.time, t1.time)) // Sort by descending order .limit(10) - .forEach(test -> System.out.printf("%-4d %-50s %-10d ms%n", - rank.getAndIncrement(), test.name, test.time)); + .forEach(test -> csvBuilder.append(String.format("%d,\"%s\",%d%n", + rank.getAndIncrement(), escapeCsv(test.name), test.time))); + + // Output CSV + System.out.println(csvBuilder.toString()); + System.out.println("═══════════════════════════════════════════════════════════"); + + } + + /** + * Escapes special characters for CSV compatibility. + */ + private String escapeCsv(String value) { + if (value.contains(",") || value.contains("\"") || value.contains("\n")) { + return "\"" + value.replace("\"", "\"\"") + "\""; + } + return value; } private void displayProgress() {
