Author: bmahe
Date: Fri Jul 20 06:04:57 2012
New Revision: 1363660
URL: http://svn.apache.org/viewvc?rev=1363660&view=rev
Log:
BIGTOP-678. Make hive TestJdbcDriver more robust (Wing Yew Poon via Bruno Mahé)
Modified:
incubator/bigtop/trunk/bigtop-tests/test-artifacts/hive/src/main/groovy/org/apache/bigtop/itest/hivesmoke/TestJdbcDriver.java
Modified:
incubator/bigtop/trunk/bigtop-tests/test-artifacts/hive/src/main/groovy/org/apache/bigtop/itest/hivesmoke/TestJdbcDriver.java
URL:
http://svn.apache.org/viewvc/incubator/bigtop/trunk/bigtop-tests/test-artifacts/hive/src/main/groovy/org/apache/bigtop/itest/hivesmoke/TestJdbcDriver.java?rev=1363660&r1=1363659&r2=1363660&view=diff
==============================================================================
---
incubator/bigtop/trunk/bigtop-tests/test-artifacts/hive/src/main/groovy/org/apache/bigtop/itest/hivesmoke/TestJdbcDriver.java
(original)
+++
incubator/bigtop/trunk/bigtop-tests/test-artifacts/hive/src/main/groovy/org/apache/bigtop/itest/hivesmoke/TestJdbcDriver.java
Fri Jul 20 06:04:57 2012
@@ -48,7 +48,7 @@ public class TestJdbcDriver {
private Connection con;
@BeforeClass
- public static void setUp() throws ClassNotFoundException,
InterruptedException {
+ public static void setUp() throws ClassNotFoundException,
InterruptedException {
Class.forName(driverName);
sh.exec("hadoop fs -mkdir " + testDir);
assertTrue("Could not create test directory", sh.getRet() == 0);
@@ -57,7 +57,15 @@ public class TestJdbcDriver {
// start hiveserver in background and remember the pid
sh.exec("(HIVE_PORT=10000 hive --service hiveserver > /dev/null 2>&1 &
echo $! ) 2> /dev/null");
hiveserver_pid = sh.getOut().get(0);
- Thread.sleep(1000); // allow time for hiveserver to be up
+ String hiveserver_startup_wait =
System.getProperty("hiveserver.startup.wait");
+ int wait;
+ try {
+ wait = Integer.parseInt(hiveserver_startup_wait);
+ }
+ catch (Exception e) {
+ wait = 1000; // default
+ }
+ Thread.sleep(wait); // allow time for hiveserver to be up
}
@Before
@@ -80,11 +88,11 @@ public class TestJdbcDriver {
sh.exec("kill -9 " + hiveserver_pid);
}
- @Test
+ @Test(timeout=120000L)
public void testCreate() throws SQLException {
Statement stmt = con.createStatement();
String tableName = "hive_jdbc_driver_test";
- stmt.executeQuery("drop table " + tableName);
+ stmt.executeQuery("drop table if exists " + tableName);
ResultSet res = stmt.executeQuery("create table " + tableName +
" (key int, value string)");
// show tables