Skip to content

Commit

Permalink
test suites unset custom config when test failure
Browse files Browse the repository at this point in the history
Signed-off-by: Sean Kao <[email protected]>
  • Loading branch information
seankao-az committed Oct 4, 2024
1 parent ab13935 commit 90cb8f9
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ class FlintSparkIndexBuilderSuite extends FlintSuite {
super.afterAll()
}

override def afterEach(): Unit = {
super.afterEach()
conf.unsetConf(FlintSparkConf.EXTERNAL_SCHEDULER_ENABLED.key)
conf.unsetConf(FlintSparkConf.EXTERNAL_SCHEDULER_INTERVAL_THRESHOLD.key)
conf.unsetConf(FlintSparkConf.CHECKPOINT_LOCATION_ROOT_DIR.key)
}

test("indexOptions should not have checkpoint location when no conf") {
assert(!conf.contains(FlintSparkConf.CHECKPOINT_LOCATION_ROOT_DIR.key))

Expand Down Expand Up @@ -210,13 +217,6 @@ class FlintSparkIndexBuilderSuite extends FlintSuite {
"External scheduler mode is not enabled in the configuration")
}

override def afterEach(): Unit = {
super.afterEach()
conf.unsetConf(FlintSparkConf.EXTERNAL_SCHEDULER_ENABLED.key)
conf.unsetConf(FlintSparkConf.EXTERNAL_SCHEDULER_INTERVAL_THRESHOLD.key)
conf.unsetConf(FlintSparkConf.CHECKPOINT_LOCATION_ROOT_DIR.key)
}

private def builder(): FakeFlintSparkIndexBuilder = {
new FakeFlintSparkIndexBuilder
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ class FlintSparkCoveringIndexITSuite extends FlintSparkSuite {

override def afterEach(): Unit = {
super.afterEach()

conf.unsetConf(FlintSparkConf.CHECKPOINT_LOCATION_ROOT_DIR.key)
conf.unsetConf(FlintSparkConf.EXTERNAL_SCHEDULER_ENABLED.key)
// Delete all test indices
deleteTestIndex(testFlintIndex)
}
Expand Down Expand Up @@ -162,8 +163,6 @@ class FlintSparkCoveringIndexITSuite extends FlintSparkSuite {
assert(
checkpointLocation.get.contains(testFlintIndex),
s"Checkpoint location dir should contain ${testFlintIndex}")

conf.unsetConf(FlintSparkConf.CHECKPOINT_LOCATION_ROOT_DIR.key)
}
}

Expand Down Expand Up @@ -209,7 +208,6 @@ class FlintSparkCoveringIndexITSuite extends FlintSparkSuite {

val indexData = flint.queryIndex(testFlintIndex)
checkAnswer(indexData, Seq(Row("Hello", 30), Row("World", 25)))
conf.unsetConf(FlintSparkConf.EXTERNAL_SCHEDULER_ENABLED.key)
}
}

Expand Down Expand Up @@ -289,8 +287,6 @@ class FlintSparkCoveringIndexITSuite extends FlintSparkSuite {
assert(
checkpointLocation.get.contains(testFlintIndex),
s"Checkpoint location dir should contain ${testFlintIndex}")

conf.unsetConf(FlintSparkConf.CHECKPOINT_LOCATION_ROOT_DIR.key)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ class FlintSparkCoveringIndexSqlITSuite extends FlintSparkSuite {

override def afterEach(): Unit = {
super.afterEach()

conf.unsetConf(FlintSparkConf.CUSTOM_FLINT_SCHEDULER_CLASS.key)
conf.unsetConf(FlintSparkConf.EXTERNAL_SCHEDULER_ENABLED.key)
// Delete all test indices
deleteTestIndex(testFlintIndex)
sql(s"DROP TABLE $testTable")
Expand Down Expand Up @@ -180,8 +181,6 @@ class FlintSparkCoveringIndexSqlITSuite extends FlintSparkSuite {

// Drop index with test scheduler
sql(s"DROP INDEX $testIndex ON $testTable")
conf.unsetConf(FlintSparkConf.CUSTOM_FLINT_SCHEDULER_CLASS.key)
conf.unsetConf(FlintSparkConf.EXTERNAL_SCHEDULER_ENABLED.key)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ class FlintSparkMaterializedViewITSuite extends FlintSparkSuite {

override def afterEach(): Unit = {
super.afterEach()
conf.unsetConf(FlintSparkConf.CHECKPOINT_LOCATION_ROOT_DIR.key)
conf.unsetConf(FlintSparkConf.EXTERNAL_SCHEDULER_ENABLED.key)
deleteTestIndex(testFlintIndex)
}

Expand Down Expand Up @@ -130,8 +132,6 @@ class FlintSparkMaterializedViewITSuite extends FlintSparkSuite {
assert(
checkpointLocation.get.contains(testFlintIndex),
s"Checkpoint location dir should contain ${testFlintIndex}")

conf.unsetConf(FlintSparkConf.CHECKPOINT_LOCATION_ROOT_DIR.key)
}
}

Expand Down Expand Up @@ -333,8 +333,6 @@ class FlintSparkMaterializedViewITSuite extends FlintSparkSuite {
assert(
checkpointLocation.get.contains(testFlintIndex),
s"Checkpoint location dir should contain ${testFlintIndex}")

conf.unsetConf(FlintSparkConf.CHECKPOINT_LOCATION_ROOT_DIR.key)
}
}

Expand Down Expand Up @@ -385,8 +383,6 @@ class FlintSparkMaterializedViewITSuite extends FlintSparkSuite {
Row(timestamp("2023-10-01 00:00:00"), 1),
Row(timestamp("2023-10-01 00:10:00"), 2),
Row(timestamp("2023-10-01 01:00:00"), 1)))

conf.unsetConf(FlintSparkConf.EXTERNAL_SCHEDULER_ENABLED.key)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ class FlintSparkMaterializedViewSqlITSuite extends FlintSparkSuite {

override def afterEach(): Unit = {
super.afterEach()
conf.unsetConf(FlintSparkConf.CUSTOM_FLINT_SCHEDULER_CLASS.key)
conf.unsetConf(FlintSparkConf.EXTERNAL_SCHEDULER_ENABLED.key)
deleteTestIndex(testFlintIndex)
sql(s"DROP TABLE $testTable")
}
Expand Down Expand Up @@ -119,8 +121,6 @@ class FlintSparkMaterializedViewSqlITSuite extends FlintSparkSuite {

// Drop index with test scheduler
sql(s"DROP MATERIALIZED VIEW $testMvName")
conf.unsetConf(FlintSparkConf.CUSTOM_FLINT_SCHEDULER_CLASS.key)
conf.unsetConf(FlintSparkConf.EXTERNAL_SCHEDULER_ENABLED.key)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ class FlintSparkSkippingIndexITSuite extends FlintSparkSuite {
}

override def afterEach(): Unit = {
conf.unsetConf(FlintSparkConf.CHECKPOINT_LOCATION_ROOT_DIR.key)
conf.unsetConf(FlintSparkConf.EXTERNAL_SCHEDULER_ENABLED.key)
// Delete all test indices
deleteTestIndex(testIndex)
sql(s"DROP TABLE $testTable")
Expand Down Expand Up @@ -215,8 +217,6 @@ class FlintSparkSkippingIndexITSuite extends FlintSparkSuite {
assert(
checkpointLocation.get.contains(testIndex),
s"Checkpoint location dir should contain ${testIndex}")

conf.unsetConf(FlintSparkConf.CHECKPOINT_LOCATION_ROOT_DIR.key)
}
}

Expand Down Expand Up @@ -363,7 +363,6 @@ class FlintSparkSkippingIndexITSuite extends FlintSparkSuite {
// Expect to only refresh the new file
flint.refreshIndex(testIndex) shouldBe empty
flint.queryIndex(testIndex).collect().toSet should have size 1
conf.unsetConf(FlintSparkConf.EXTERNAL_SCHEDULER_ENABLED.key)
}
}

Expand Down Expand Up @@ -442,8 +441,6 @@ class FlintSparkSkippingIndexITSuite extends FlintSparkSuite {
assert(
checkpointLocation.get.contains(testIndex),
s"Checkpoint location dir should contain ${testIndex}")

conf.unsetConf(FlintSparkConf.CHECKPOINT_LOCATION_ROOT_DIR.key)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ class FlintSparkSkippingIndexSqlITSuite extends FlintSparkSuite with ExplainSuit

protected override def afterEach(): Unit = {
super.afterEach()

conf.unsetConf(FlintSparkConf.CUSTOM_FLINT_SCHEDULER_CLASS.key)
conf.unsetConf(FlintSparkConf.EXTERNAL_SCHEDULER_ENABLED.key)
deleteTestIndex(testIndex)
sql(s"DROP TABLE $testTable")
}
Expand Down Expand Up @@ -98,8 +99,6 @@ class FlintSparkSkippingIndexSqlITSuite extends FlintSparkSuite with ExplainSuit
flint.queryIndex(testIndex).count() shouldBe 2

sql(s"DROP SKIPPING INDEX ON $testTable")
conf.unsetConf(FlintSparkConf.CUSTOM_FLINT_SCHEDULER_CLASS.key)
conf.unsetConf(FlintSparkConf.EXTERNAL_SCHEDULER_ENABLED.key)
}
}

Expand Down

0 comments on commit 90cb8f9

Please sign in to comment.