commit af9a0ef9b1472c6b6ed05352d4fdf9ecb86fe381 Author: ksuresh1 Date: Thu Oct 13 16:55:22 2016 -0700 HIVE-14935:Add tests for beeline force option diff --git a/itests/hive-unit/src/test/java/org/apache/hive/beeline/TestBeeLineWithArgs.java b/itests/hive-unit/src/test/java/org/apache/hive/beeline/TestBeeLineWithArgs.java index 1ca7623..9e99a91 100644 --- a/itests/hive-unit/src/test/java/org/apache/hive/beeline/TestBeeLineWithArgs.java +++ b/itests/hive-unit/src/test/java/org/apache/hive/beeline/TestBeeLineWithArgs.java @@ -911,4 +911,19 @@ public void testBeelineShellCommandWithoutConn() throws Throwable { final String EXPECTED_PATTERN = "hello world"; testScriptFile(SCRIPT_TEXT, EXPECTED_PATTERN, true, argList,true,false); } + + /** + * Attempt to execute Beeline with force option to continue running script even after errors. + * Test for presence of an expected pattern to match the output of a valid command at the end. + */ + @Test + public void testBeelineWithForce() throws Throwable { + final String SCRIPT_TEXT = "drop table does_not_exist;\ncreate table incomplete_syntax(a, string, );\n " + + "drop table if exists new_table;\n create table new_table(foo int, bar string);\n " + + "desc new_table;\n"; + final String EXPECTED_PATTERN = "2 rows selected"; + List argList = getBaseArgs(miniHS2.getBaseJdbcURL()); + argList.add("--force"); + testScriptFile(SCRIPT_TEXT, EXPECTED_PATTERN, true, argList); + } }