From 7609278c871401224e5150440810336a1b0da1ee Mon Sep 17 00:00:00 2001 From: "ievgen.degtiarenko" Date: Mon, 9 Dec 2024 16:26:47 +0100 Subject: [PATCH] use dataFailure in all cases --- .../org/elasticsearch/xpack/esql/CsvAssert.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/x-pack/plugin/esql/qa/testFixtures/src/main/java/org/elasticsearch/xpack/esql/CsvAssert.java b/x-pack/plugin/esql/qa/testFixtures/src/main/java/org/elasticsearch/xpack/esql/CsvAssert.java index d5392b810c7f..8a4d44a69057 100644 --- a/x-pack/plugin/esql/qa/testFixtures/src/main/java/org/elasticsearch/xpack/esql/CsvAssert.java +++ b/x-pack/plugin/esql/qa/testFixtures/src/main/java/org/elasticsearch/xpack/esql/CsvAssert.java @@ -250,9 +250,13 @@ public static void assertData( } } - var delta = actualRow.size() - expectedRow.size(); - if (delta > 0) { - fail("Plan has extra columns, returned [" + actualRow.size() + "], expected [" + expectedRow.size() + "]"); + if (actualRow.size() != expectedRow.size()) { + dataFailure( + "Plan has extra columns, returned [" + actualRow.size() + "], expected [" + expectedRow.size() + "]", + dataFailures, + expected, + actualValues + ); } } catch (AssertionError ae) { if (logger != null && row + 1 < actualValues.size()) { @@ -266,9 +270,7 @@ public static void assertData( dataFailure("", dataFailures, expected, actualValues); } if (expectedValues.size() < actualValues.size()) { - fail( - "Elasticsearch still has data after [" + expectedValues.size() + "] entries:\n" + row(actualValues, expectedValues.size()) - ); + dataFailure("Elasticsearch still has data after [" + expectedValues.size() + "] entries", dataFailures, expected, actualValues); } } @@ -303,6 +305,9 @@ private static String pipeTable(String description, List headers, List maxRows) { + result.append("...").append(System.lineSeparator()); + } return result.toString(); }