Search in sources :

Example 11 with QTestProcessExecResult

use of org.apache.hadoop.hive.ql.QTestProcessExecResult in project hive by apache.

the class CoreNegativeCliDriver method runTest.

@Override
public void runTest(String tname, String fname, String fpath) throws Exception {
    long startTime = System.currentTimeMillis();
    try {
        System.err.println("Begin query: " + fname);
        qt.setInputFile(fpath);
        qt.cliInit();
        try {
            qt.executeClient();
            qt.failed(fname, QTestUtil.DEBUG_HINT);
        } catch (CommandProcessorException e) {
        // this is the expected outcome
        }
        QTestProcessExecResult result = qt.checkCliDriverResults();
        if (result.getReturnCode() != 0) {
            String message = Strings.isNullOrEmpty(result.getCapturedOutput()) ? QTestUtil.DEBUG_HINT : "\r\n" + result.getCapturedOutput();
            qt.failedDiff(result.getReturnCode(), fname, message);
        }
    } catch (AssumptionViolatedException e) {
        throw e;
    } catch (Error error) {
        QTestProcessExecResult qTestProcessExecResult = qt.checkNegativeResults(fname, error);
        if (qTestProcessExecResult.getReturnCode() != 0) {
            String message = Strings.isNullOrEmpty(qTestProcessExecResult.getCapturedOutput()) ? QTestUtil.DEBUG_HINT : "\r\n" + qTestProcessExecResult.getCapturedOutput();
            qt.failedDiff(qTestProcessExecResult.getReturnCode(), fname, message);
        }
    } catch (Exception e) {
        qt.failedWithException(e, fname, QTestUtil.DEBUG_HINT);
    }
    long elapsedTime = System.currentTimeMillis() - startTime;
    System.err.println("Done query: " + fname + " elapsedTime=" + elapsedTime / 1000 + "s");
    assertTrue("Test passed", true);
}
Also used : CommandProcessorException(org.apache.hadoop.hive.ql.processors.CommandProcessorException) AssumptionViolatedException(org.junit.internal.AssumptionViolatedException) QTestProcessExecResult(org.apache.hadoop.hive.ql.QTestProcessExecResult) CommandProcessorException(org.apache.hadoop.hive.ql.processors.CommandProcessorException) AssumptionViolatedException(org.junit.internal.AssumptionViolatedException)

Example 12 with QTestProcessExecResult

use of org.apache.hadoop.hive.ql.QTestProcessExecResult in project hive by apache.

the class CoreKuduNegativeCliDriver method runTest.

@Override
public void runTest(String tname, String fname, String fpath) {
    long startTime = System.currentTimeMillis();
    try {
        System.err.println("Begin query: " + fname);
        qt.setInputFile(fpath);
        qt.cliInit();
        try {
            qt.executeClient();
            qt.failed(fname, null);
        } catch (CommandProcessorException e) {
        // this is the expected behaviour
        }
        QTestProcessExecResult result = qt.checkCliDriverResults();
        if (result.getReturnCode() != 0) {
            qt.failedDiff(result.getReturnCode(), fname, result.getCapturedOutput());
        }
    } catch (Exception e) {
        qt.failedWithException(e, fname, null);
    }
    long elapsedTime = System.currentTimeMillis() - startTime;
    System.err.println("Done query: " + fname + " elapsedTime=" + elapsedTime / 1000 + "s");
    assertTrue("Test passed", true);
}
Also used : CommandProcessorException(org.apache.hadoop.hive.ql.processors.CommandProcessorException) QTestProcessExecResult(org.apache.hadoop.hive.ql.QTestProcessExecResult) CommandProcessorException(org.apache.hadoop.hive.ql.processors.CommandProcessorException)

Aggregations

QTestProcessExecResult (org.apache.hadoop.hive.ql.QTestProcessExecResult)12 CommandProcessorException (org.apache.hadoop.hive.ql.processors.CommandProcessorException)9 AssumptionViolatedException (org.junit.internal.AssumptionViolatedException)4 IOException (java.io.IOException)2 SQLException (java.sql.SQLException)2 QFileBeeLineClient (org.apache.hive.beeline.QFileBeeLineClient)2 Stopwatch (com.google.common.base.Stopwatch)1 File (java.io.File)1 ArrayList (java.util.ArrayList)1