Skip to content

Commit 2d8d0a1

Browse files
committed
Remove thread pool in IT
Signed-off-by: Chen Dai <daichen@amazon.com>
1 parent 92882b4 commit 2d8d0a1

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

integ-test/src/test/scala/org/opensearch/flint/spark/FlintSparkIndexSqlITSuite.scala

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@
55

66
package org.opensearch.flint.spark
77

8-
import java.util.concurrent.Executors
9-
108
import scala.collection.JavaConverters._
11-
import scala.concurrent.{ExecutionContext, Future}
129

1310
import org.opensearch.action.admin.indices.settings.put.UpdateSettingsRequest
1411
import org.opensearch.client.RequestOptions
@@ -21,7 +18,6 @@ import org.opensearch.flint.spark.skipping.FlintSparkSkippingIndex
2118
import org.scalatest.matchers.should.Matchers
2219

2320
import org.apache.spark.sql.Row
24-
import org.apache.spark.sql.functions.col
2521

2622
class FlintSparkIndexSqlITSuite extends FlintSparkSuite with Matchers {
2723

@@ -38,13 +34,6 @@ class FlintSparkIndexSqlITSuite extends FlintSparkSuite with Matchers {
3834
private val testMvIndex = s"spark_catalog.default.$testMvIndexShortName"
3935
private val testMvFlintIndex = FlintSparkMaterializedView.getFlintIndexName(testMvIndex)
4036

41-
/**
42-
* Creates a custom `ExecutionContext` with a fixed thread pool for handling asynchronous
43-
* operations in tests. TODO: move to base class if more tests require this.
44-
*/
45-
implicit val executionContext: ExecutionContext =
46-
ExecutionContext.fromExecutor(Executors.newFixedThreadPool(1))
47-
4837
override def beforeAll(): Unit = {
4938
super.beforeAll()
5039
createTimeSeriesTable(testTableQualifiedName)
@@ -135,7 +124,7 @@ class FlintSparkIndexSqlITSuite extends FlintSparkSuite with Matchers {
135124
outputError shouldBe empty
136125

137126
// Trigger next micro batch after 5 seconds with index readonly
138-
Future {
127+
new Thread(() => {
139128
Thread.sleep(5000)
140129
openSearchClient
141130
.indices()
@@ -145,7 +134,7 @@ class FlintSparkIndexSqlITSuite extends FlintSparkSuite with Matchers {
145134
RequestOptions.DEFAULT)
146135
sql(
147136
s"INSERT INTO $testTableQualifiedName VALUES (TIMESTAMP '2023-10-01 04:00:00', 'F', 25, 'Vancouver')")
148-
}
137+
}).start()
149138

150139
// Await to store exception and verify if it's as expected
151140
flint.flintIndexMonitor.awaitMonitor(Some(testSkippingFlintIndex))

0 commit comments

Comments
 (0)