chaoqin-li1123 commented on code in PR #41099:
URL: https://github.com/apache/spark/pull/41099#discussion_r1211106604
##########
sql/core/src/test/scala/org/apache/spark/sql/execution/streaming/state/RocksDBSuite.scala:
##########
@@ -24,14 +24,275 @@ import scala.language.implicitConversions
import org.apache.commons.io.FileUtils
import org.apache.hadoop.conf.Configuration
+import org.scalactic.source.Position
+import org.scalatest.Tag
import org.apache.spark._
import org.apache.spark.sql.catalyst.util.quietly
import org.apache.spark.sql.execution.streaming.CreateAtomicTestManager
import org.apache.spark.sql.internal.SQLConf
+import org.apache.spark.sql.test.{SharedSparkSession, SQLTestUtils}
import org.apache.spark.util.{ThreadUtils, Utils}
-class RocksDBSuite extends SparkFunSuite {
+
+trait AlsoTestWithChangelogCheckpointingEnabled extends SQLTestUtils {
+ override protected def test(testName: String, testTags: Tag*)(testBody: =>
Any)
+ (implicit pos: Position): Unit = {
+ super.test(testName, testTags: _*) {
+ withSQLConf(rocksdbChangelogCheckpointingConfKey -> "false",
+ SQLConf.STATE_STORE_PROVIDER_CLASS.key ->
classOf[RocksDBStateStoreProvider].getName) {
+ testBody
+ }
+ // in case tests have any code that needs to execute after every test
+ super.afterEach()
+ }
+
+ super.test(testName + " (with changelog checkpointing)", testTags: _*) {
+ // in case tests have any code that needs to execute before every test
+ super.beforeEach()
+ withSQLConf(rocksdbChangelogCheckpointingConfKey -> "true",
+ SQLConf.STATE_STORE_PROVIDER_CLASS.key ->
classOf[RocksDBStateStoreProvider].getName) {
+ testBody
+ }
+ }
+ }
+
+ def rocksdbChangelogCheckpointingConfKey: String =
RocksDBConf.ROCKSDB_SQL_CONF_NAME_PREFIX +
+ ".changelogCheckpointing.enabled"
+
+ def isChangelogCheckpointingEnabled: Boolean =
+ SQLConf.get.getConfString(rocksdbChangelogCheckpointingConfKey) == "true"
+}
+
+class RocksDBSuite extends AlsoTestWithChangelogCheckpointingEnabled with
SharedSparkSession {
Review Comment:
Add testWithChangelogCheckpointingEnabled and
testWithChangelogCheckpointingDisabled for tests that don't need to be
duplicated.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]