Skip to content

Commit

Permalink
PHOENIX-4159 phoenix-spark tests are failing
Browse files Browse the repository at this point in the history
Fix usage of underlying JUnit 'TemporaryFolder' in phoenix-spark
tests. Need to disable parallel execution until JUnit 4.13 is
released (junit-team/junit4#1223)
  • Loading branch information
jmahonin committed Sep 6, 2017
1 parent 94ef3eb commit 20aaf63
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
5 changes: 4 additions & 1 deletion phoenix-spark/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,10 @@
<goal>test</goal>
</goals>
<configuration>
<parallel>true</parallel>
<!-- Need this false until we can switch to JUnit 4.13 due to
https://github.com/junit-team/junit4/issues/1223
-->
<parallel>false</parallel>
<tagsToExclude>Integration-Test</tagsToExclude>
<argLine>-Xmx1536m -XX:MaxPermSize=512m -XX:ReservedCodeCacheSize=512m</argLine>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import org.apache.phoenix.end2end.BaseHBaseManagedTimeIT
import org.apache.phoenix.query.BaseTest
import org.apache.phoenix.util.PhoenixRuntime
import org.apache.spark.{SparkConf, SparkContext}
import org.scalatest.{BeforeAndAfterAll, FunSuite, Matchers}
import org.scalatest.{BeforeAndAfter, BeforeAndAfterAll, FunSuite, Matchers}


// Helper object to access the protected abstract static methods hidden in BaseHBaseManagedTimeIT
Expand All @@ -33,15 +33,18 @@ object PhoenixSparkITHelper extends BaseHBaseManagedTimeIT {
BaseHBaseManagedTimeIT.doSetup()
}

def doTeardown = BaseHBaseManagedTimeIT.doTeardown()
def doTeardown = {
BaseHBaseManagedTimeIT.doTeardown()
BaseTest.tmpFolder.delete()
}

def getUrl = BaseTest.getUrl
}

/**
* Base class for PhoenixSparkIT
*/
class AbstractPhoenixSparkIT extends FunSuite with Matchers with BeforeAndAfterAll {
class AbstractPhoenixSparkIT extends FunSuite with Matchers with BeforeAndAfter with BeforeAndAfterAll {

// A global tenantId we can use across tests
final val TenantId = "theTenant"
Expand All @@ -62,9 +65,8 @@ class AbstractPhoenixSparkIT extends FunSuite with Matchers with BeforeAndAfterA
// Optional argument tenantId used for running tenant-specific SQL
def setupTables(sqlSource: String, tenantId: Option[String]): Unit = {
val props = new Properties
val id = tenantId match {
case Some(tid) => props.setProperty(PhoenixRuntime.TENANT_ID_ATTRIB, tid)
case _ =>
if(tenantId.isDefined) {
props.setProperty(PhoenixRuntime.TENANT_ID_ATTRIB, tenantId.get)
}

conn = DriverManager.getConnection(PhoenixSparkITHelper.getUrl, props)
Expand All @@ -88,7 +90,7 @@ class AbstractPhoenixSparkIT extends FunSuite with Matchers with BeforeAndAfterA
PhoenixSparkITHelper.doSetup

// We pass in null for TenantId here since these tables will be globally visible
setupTables("globalSetup.sql", null)
setupTables("globalSetup.sql", None)
// We pass in a TenantId to allow the DDL to create tenant-specific tables/views
setupTables("tenantSetup.sql", Some(TenantId))

Expand All @@ -103,6 +105,7 @@ class AbstractPhoenixSparkIT extends FunSuite with Matchers with BeforeAndAfterA
override def afterAll() {
conn.close()
sc.stop()
PhoenixSparkITHelper.cleanUpAfterTest()
PhoenixSparkITHelper.doTeardown
}
}

0 comments on commit 20aaf63

Please sign in to comment.