spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [spark] gaborgsomogyi commented on a change in pull request #27877: [WIP][SPARK-30541] Implement KafkaDelegationTokenSuite with testRetry
Date Wed, 11 Mar 2020 09:51:31 GMT
gaborgsomogyi commented on a change in pull request #27877: [WIP][SPARK-30541] Implement KafkaDelegationTokenSuite
with testRetry
URL: https://github.com/apache/spark/pull/27877#discussion_r390853889
 
 

 ##########
 File path: external/kafka-0-10-sql/src/test/scala/org/apache/spark/sql/kafka010/KafkaDelegationTokenSuite.scala
 ##########
 @@ -44,75 +46,79 @@ class KafkaDelegationTokenSuite extends StreamTest with SharedSparkSession
with
     .set("spark.kafka.clusters.cluster1.auth.bootstrap.servers", testUtils.brokerAddress)
     .set("spark.kafka.clusters.cluster1.security.protocol", SASL_PLAINTEXT.name)
 
-  override def beforeAll(): Unit = {
-    testUtils = new KafkaTestUtils(Map.empty, true)
-    testUtils.setup()
-    super.beforeAll()
-  }
-
-  override def afterAll(): Unit = {
+  testRetry("Roundtrip", 3) {
     try {
-      if (testUtils != null) {
-        testUtils.teardown()
-        testUtils = null
+      deInitializeSession()
+
+      testUtils = new KafkaTestUtils(Map.empty, true)
+      testUtils.setup()
+
+      initializeSession()
+
+      val hadoopConf = new Configuration()
+      val manager = new HadoopDelegationTokenManager(spark.sparkContext.conf, hadoopConf,
null)
+      val credentials = new Credentials()
+      manager.obtainDelegationTokens(credentials)
+      val serializedCredentials = SparkHadoopUtil.get.serialize(credentials)
+      SparkHadoopUtil.get.addDelegationTokens(serializedCredentials, spark.sparkContext.conf)
+
+      val topic = "topic-" + UUID.randomUUID().toString
+      testUtils.createTopic(topic, partitions = 5)
+
+      withTempDir { checkpointDir =>
+        val input = MemoryStream[String]
+
+        val df = input.toDF()
+        val writer = df.writeStream
+          .outputMode(OutputMode.Append)
+          .format("kafka")
+          .option("checkpointLocation", checkpointDir.getCanonicalPath)
+          .option("kafka.bootstrap.servers", testUtils.brokerAddress)
+          .option("topic", topic)
+          .start()
+
+        try {
+          input.addData("1", "2", "3", "4", "5")
+          failAfter(streamingTimeout) {
+            writer.processAllAvailable()
+          }
+        } finally {
+          writer.stop()
+        }
       }
-      UserGroupInformation.reset()
-    } finally {
-      super.afterAll()
-    }
-  }
-
-  ignore("Roundtrip") {
-    val hadoopConf = new Configuration()
-    val manager = new HadoopDelegationTokenManager(spark.sparkContext.conf, hadoopConf, null)
-    val credentials = new Credentials()
-    manager.obtainDelegationTokens(credentials)
-    val serializedCredentials = SparkHadoopUtil.get.serialize(credentials)
-    SparkHadoopUtil.get.addDelegationTokens(serializedCredentials, spark.sparkContext.conf)
-
-    val topic = "topic-" + UUID.randomUUID().toString
-    testUtils.createTopic(topic, partitions = 5)
 
-    withTempDir { checkpointDir =>
-      val input = MemoryStream[String]
-
-      val df = input.toDF()
-      val writer = df.writeStream
-        .outputMode(OutputMode.Append)
+      if (KafkaDelegationTokenSuite.cnt == 0) {
 
 Review comment:
   This is just to simulate retry. Later it will be deleted.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Mime
View raw message