Assert successful exit code from sstabledump in org.apache.cassandra.cql3.EmptyValuesTest

patch by Daniel Jatnieks; reviewed by Ekaterina Dimitrova and Berenguer Blasi for CASSANDRA-18436
This commit is contained in:
Daniel Jatnieks 2023-05-04 12:39:46 -07:00 committed by Ekaterina Dimitrova
parent 290bd0d337
commit 5768e5ae41
1 changed files with 5 additions and 3 deletions

View File

@ -19,7 +19,6 @@
package org.apache.cassandra.cql3;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.nio.charset.StandardCharsets;
import java.util.regex.Pattern;
@ -73,17 +72,20 @@ public class EmptyValuesTest extends CQLTester
ByteArrayOutputStream buf = new ByteArrayOutputStream();
for (SSTableReader ssTable : cfs.getLiveSSTables())
{
try (PrintStream out = new PrintStream(buf, true))
int exitValue = 0;
try
{
ProcessBuilder pb = new ProcessBuilder("tools/bin/sstabledump", ssTable.getFilename());
pb.redirectErrorStream(true);
Process process = pb.start();
process.waitFor();
exitValue = process.waitFor();
IOUtils.copy(process.getInputStream(), buf);
}
catch (Throwable t)
{
Assert.fail(t.getClass().getName());
}
Assert.assertEquals(buf.toString(), 0, exitValue);
}
String outString = new String(buf.toByteArray(), StandardCharsets.UTF_8);