This is an automated email from the ASF dual-hosted git repository.

stoty pushed a commit to branch 5.1
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/5.1 by this push:
     new 1badf0b291 PHOENIX-7428 Add usable error message in 
BackwardCompatibilityIT (#2007)
1badf0b291 is described below

commit 1badf0b2914b3f63ed32e7e65502d4004fe102b7
Author: Istvan Toth <[email protected]>
AuthorDate: Wed Oct 16 14:17:17 2024 +0200

    PHOENIX-7428 Add usable error message in BackwardCompatibilityIT (#2007)
---
 .../phoenix/end2end/BackwardCompatibilityTestUtil.java       | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BackwardCompatibilityTestUtil.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BackwardCompatibilityTestUtil.java
index d4b5495049..a05b6d75c5 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BackwardCompatibilityTestUtil.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BackwardCompatibilityTestUtil.java
@@ -41,6 +41,8 @@ import java.io.FileWriter;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.net.URL;
+import java.nio.file.Files;
+import java.nio.file.Paths;
 import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.PreparedStatement;
@@ -202,8 +204,14 @@ public final class BackwardCompatibilityTestUtil {
         };
         errorStreamThread.start();
         p.waitFor();
-        assertEquals(String.format("Executing the query failed%s. Check the 
result file: %s",
-                sb.length() > 0 ? sb.append(" with : ").toString() : "", 
resultFilePath),
+        String resultDump = "PLACEHOLDER. Could not read result file";
+        try {
+            resultDump = new 
String(Files.readAllBytes(Paths.get(resultFilePath)));
+        } catch (Exception e) {
+            //We return the placeholder
+        }
+        assertEquals(String.format("Executing the query failed%s. Check the 
result file: %s\nResult file dump follows:\n%s",
+                sb.length() > 0 ? sb.append(" with : ").toString() : "", 
resultFilePath, resultDump),
                 0, p.exitValue());
     }
 

Reply via email to