dongjoon-hyun commented on a change in pull request #35509:
URL: https://github.com/apache/spark/pull/35509#discussion_r806553995



##########
File path: 
resource-managers/kubernetes/core/src/test/scala/org/apache/spark/deploy/k8s/KubernetesUtilsSuite.scala
##########
@@ -65,4 +73,49 @@ class KubernetesUtilsSuite extends SparkFunSuite {
     assert(sparkPodWithNoContainerName.pod.getSpec.getHostname == HOST)
     assert(sparkPodWithNoContainerName.container.getName == null)
   }
+
+  test("SPARK-38201: check uploadFileToHadoopCompatibleFS with different 
delSrc and overwrite") {
+    val uploadFileToHadoopCompatibleFSMethod =
+      PrivateMethod[Unit](Symbol("uploadFileToHadoopCompatibleFS"))
+    withTempDir { srcDir =>
+      val fileName = "test.txt"
+      val srcFile = new File(srcDir, fileName)
+      FileUtils.write(srcFile, "test", Charset.defaultCharset())
+      withTempDir { destDir =>
+        import org.apache.spark.SparkException
+        val src = new Path(srcFile.getAbsolutePath)
+        val dest = new Path(destDir.getAbsolutePath, fileName)
+        val fs = src.getFileSystem(new Configuration())
+        // Scenario 1: delSrc = false and overwrite = true, upload successful
+        KubernetesUtils
+          .invokePrivate(uploadFileToHadoopCompatibleFSMethod(src, dest, fs, 
false, true))
+        val firstUploadTime = fs.getFileStatus(dest).getModificationTime
+        // sleep 1s to ensure that the `ModificationTime` changes.
+        TimeUnit.SECONDS.sleep(1)

Review comment:
       Please use `FileUtils.readFileToString`.




-- 
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]

Reply via email to