vanzin commented on a change in pull request #25631: [SPARK-28928][SS] Take 
over Kafka delegation token protocol on sources/sinks
URL: https://github.com/apache/spark/pull/25631#discussion_r320988702
 
 

 ##########
 File path: 
external/kafka-0-10-token-provider/src/test/scala/org/apache/spark/kafka010/KafkaConfigUpdaterSuite.scala
 ##########
 @@ -76,6 +79,27 @@ class KafkaConfigUpdaterSuite extends SparkFunSuite with 
KafkaDelegationTokenTes
     val params = Map(
       CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG -> bootStrapServers
     )
+    testWithTokenSetValues(params, updatedParams => {
+      assert(updatedParams.get(CommonClientConfigs.SECURITY_PROTOCOL_CONFIG) 
===
+        KafkaTokenSparkConf.DEFAULT_SECURITY_PROTOCOL_CONFIG)
+    })
+  }
+
+  test("setAuthenticationConfigIfNeeded with token should set values but 
override protocol") {
+    val overrideProtocolName = SASL_PLAINTEXT.name
+    val params = Map(
+      CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG -> bootStrapServers,
+      CommonClientConfigs.SECURITY_PROTOCOL_CONFIG -> overrideProtocolName
+    )
+    testWithTokenSetValues(params, updatedParams => {
+      assert(updatedParams.get(CommonClientConfigs.SECURITY_PROTOCOL_CONFIG) 
===
+        overrideProtocolName)
+    })
+  }
+
+  def testWithTokenSetValues(
 
 Review comment:
   This is nicer with a curried function.
   
   ```
   testWithTokenSetValues(params) { updatedParams =>
      ...
   }
   ```
   
   Lots of examples in Spark's code.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to