Github user tdas commented on a diff in the pull request:
https://github.com/apache/spark/pull/9143#discussion_r43972721
--- Diff:
streaming/src/test/scala/org/apache/spark/streaming/util/WriteAheadLogSuite.scala
---
@@ -19,59 +19,57 @@ package org.apache.spark.streaming.util
import java.io._
import java.nio.ByteBuffer
import java.util
+import java.util.concurrent.atomic.AtomicInteger
import scala.collection.JavaConverters._
import scala.collection.mutable.ArrayBuffer
+import scala.concurrent.{Await, Promise, Future, ExecutionContext}
import scala.concurrent.duration._
import scala.language.{implicitConversions, postfixOps}
import scala.reflect.ClassTag
import org.apache.hadoop.conf.Configuration
import org.apache.hadoop.fs.Path
+import org.mockito.Matchers._
+import org.mockito.Matchers.{eq => meq}
+import org.mockito.Mockito._
+import org.mockito.invocation.InvocationOnMock
+import org.mockito.stubbing.Answer
+import org.scalatest.concurrent.Eventually
import org.scalatest.concurrent.Eventually._
import org.scalatest.BeforeAndAfter
+import org.scalatest.mock.MockitoSugar.{mock => mmock}
-import org.apache.spark.util.{ManualClock, Utils}
+import org.apache.spark.streaming.scheduler._
+import org.apache.spark.util.{ThreadUtils, ManualClock, Utils}
import org.apache.spark.{SparkConf, SparkException, SparkFunSuite}
-class WriteAheadLogSuite extends SparkFunSuite with BeforeAndAfter {
-
+class WriteAheadLogUtilsSuite extends SparkFunSuite {
import WriteAheadLogSuite._
- val hadoopConf = new Configuration()
- var tempDir: File = null
- var testDir: String = null
- var testFile: String = null
- var writeAheadLog: FileBasedWriteAheadLog = null
+ val logDir = Utils.createTempDir().getAbsolutePath()
- before {
- tempDir = Utils.createTempDir()
- testDir = tempDir.toString
- testFile = new File(tempDir, "testFile").toString
- if (writeAheadLog != null) {
- writeAheadLog.close()
- writeAheadLog = null
+ def assertDriverLogClass[T <: WriteAheadLog: ClassTag](
+ conf: SparkConf,
+ isBatched: Boolean = false): WriteAheadLog = {
+ val log = WriteAheadLogUtils.createLogForDriver(conf, logDir,
hadoopConf)
+ if (isBatched) {
+ assert(log.isInstanceOf[BatchedWriteAheadLog])
+ val parentLog = log.asInstanceOf[BatchedWriteAheadLog].parent
+ assert(parentLog.getClass === implicitly[ClassTag[T]].runtimeClass)
+ } else {
+ assert(log.getClass === implicitly[ClassTag[T]].runtimeClass)
}
+ log
}
- after {
- Utils.deleteRecursively(tempDir)
+ def assertReceiverLogClass[T: ClassTag](conf: SparkConf): WriteAheadLog
= {
--- End diff --
This was a bug from earlier, but could you update `T: ClassTag` to match
the one in `assertDriverLogClass`
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]