Repository: carbondata Updated Branches: refs/heads/master 842b9e5f4 -> e40963254
[CARBONDATA-2063][Tests] Fix bugs in interdependent tests Tests should not depend on each other, otherwise tests will fail in developer's IDE if they only run a single test at once. This closes #1843 Project: http://git-wip-us.apache.org/repos/asf/carbondata/repo Commit: http://git-wip-us.apache.org/repos/asf/carbondata/commit/e4096325 Tree: http://git-wip-us.apache.org/repos/asf/carbondata/tree/e4096325 Diff: http://git-wip-us.apache.org/repos/asf/carbondata/diff/e4096325 Branch: refs/heads/master Commit: e4096325468aaba39dbf69c4bb1a72bf0e321f92 Parents: 842b9e5 Author: xuchuanyin <[email protected]> Authored: Mon Jan 22 16:14:38 2018 +0800 Committer: chenliang613 <[email protected]> Committed: Sun Jan 28 15:23:17 2018 +0800 ---------------------------------------------------------------------- .../testsuite/dataload/TestLoadDataGeneral.scala | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/carbondata/blob/e4096325/integration/spark-common-test/src/test/scala/org/apache/carbondata/integration/spark/testsuite/dataload/TestLoadDataGeneral.scala ---------------------------------------------------------------------- diff --git a/integration/spark-common-test/src/test/scala/org/apache/carbondata/integration/spark/testsuite/dataload/TestLoadDataGeneral.scala b/integration/spark-common-test/src/test/scala/org/apache/carbondata/integration/spark/testsuite/dataload/TestLoadDataGeneral.scala index c122287..09ca9e5 100644 --- a/integration/spark-common-test/src/test/scala/org/apache/carbondata/integration/spark/testsuite/dataload/TestLoadDataGeneral.scala +++ b/integration/spark-common-test/src/test/scala/org/apache/carbondata/integration/spark/testsuite/dataload/TestLoadDataGeneral.scala @@ -22,7 +22,7 @@ import java.math.BigDecimal import scala.collection.mutable.ArrayBuffer import org.apache.spark.sql.Row -import org.scalatest.BeforeAndAfterAll +import org.scalatest.BeforeAndAfterEach import org.apache.carbondata.core.util.path.{CarbonStorePath, CarbonTablePath} import org.apache.carbondata.core.datastore.impl.FileFactory @@ -32,16 +32,15 @@ import org.apache.spark.sql.test.util.QueryTest import org.apache.carbondata.core.constants.CarbonCommonConstants import org.apache.carbondata.core.util.CarbonProperties -class TestLoadDataGeneral extends QueryTest with BeforeAndAfterAll { +class TestLoadDataGeneral extends QueryTest with BeforeAndAfterEach { - override def beforeAll { + override def beforeEach { sql("DROP TABLE IF EXISTS loadtest") sql( """ | CREATE TABLE loadtest(id int, name string, city string, age int) | STORED BY 'org.apache.carbondata.format' """.stripMargin) - } private def checkSegmentExists( @@ -74,7 +73,7 @@ class TestLoadDataGeneral extends QueryTest with BeforeAndAfterAll { sql(s"LOAD DATA LOCAL INPATH '$testData' into table loadtest") checkAnswer( sql("SELECT COUNT(*) FROM loadtest"), - Seq(Row(10)) + Seq(Row(4)) ) } @@ -83,7 +82,7 @@ class TestLoadDataGeneral extends QueryTest with BeforeAndAfterAll { sql(s"LOAD DATA LOCAL INPATH '$testData' into table loadtest") checkAnswer( sql("SELECT COUNT(*) FROM loadtest"), - Seq(Row(14)) + Seq(Row(4)) ) } @@ -92,7 +91,7 @@ class TestLoadDataGeneral extends QueryTest with BeforeAndAfterAll { sql(s"LOAD DATA LOCAL INPATH '$testData' into table loadtest") checkAnswer( sql("SELECT COUNT(*) FROM loadtest"), - Seq(Row(18)) + Seq(Row(4)) ) } @@ -101,7 +100,7 @@ class TestLoadDataGeneral extends QueryTest with BeforeAndAfterAll { sql(s"LOAD DATA LOCAL INPATH '$testData' into table loadtest options ('delimiter'='\\017')") checkAnswer( sql("SELECT COUNT(*) FROM loadtest"), - Seq(Row(22)) + Seq(Row(4)) ) } @@ -243,7 +242,7 @@ class TestLoadDataGeneral extends QueryTest with BeforeAndAfterAll { checkAnswer(sql("select * from stale"), Row("k")) } - override def afterAll { + override def afterEach { sql("DROP TABLE if exists loadtest") sql("drop table if exists invalidMeasures") CarbonProperties.getInstance()
