You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by do...@apache.org on 2026/05/15 21:53:20 UTC

(spark) branch branch-4.x updated: [SPARK-56879][CORE][TESTS] Improve `JavaUtilsSuite` to be more robust

This is an automated email from the ASF dual-hosted git repository.

dongjoon-hyun pushed a commit to branch branch-4.x
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/branch-4.x by this push:
     new c338f9ecd29c [SPARK-56879][CORE][TESTS] Improve `JavaUtilsSuite` to be more robust
c338f9ecd29c is described below

commit c338f9ecd29cf60f4475cdfe3e0cafa7b8231d60
Author: Dongjoon Hyun <do...@apache.org>
AuthorDate: Fri May 15 14:52:56 2026 -0700

    [SPARK-56879][CORE][TESTS] Improve `JavaUtilsSuite` to be more robust
    
    ### What changes were proposed in this pull request?
    
    Make `JavaUtilsSuite.testCreateDirectory` scenario 4 skip the `IOException` assertion when running as `root`.
    
    ### Why are the changes needed?
    
    `root` bypasses filesystem permission checks, so `setWritable(false)` does not prevent directory creation and the test fails under root (e.g., Docker-based CI).
    
    ### Does this PR introduce _any_ user-facing change?
    
    No.
    
    ### How was this patch tested?
    
    Pass the CIs.
    
    ### Was this patch authored or co-authored using generative AI tooling?
    
    Generated-by: Claude Opus 4.7 (1M context)
    
    Closes #55907 from dongjoon-hyun/SPARK-56879.
    
    Authored-by: Dongjoon Hyun <do...@apache.org>
    Signed-off-by: Dongjoon Hyun <do...@apache.org>
    (cherry picked from commit 87ed4183ec0ecd118bb51c7ef10143b7a7336199)
    Signed-off-by: Dongjoon Hyun <do...@apache.org>
---
 .../src/test/java/org/apache/spark/network/util/JavaUtilsSuite.java  | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/common/network-common/src/test/java/org/apache/spark/network/util/JavaUtilsSuite.java b/common/network-common/src/test/java/org/apache/spark/network/util/JavaUtilsSuite.java
index 2edeb3f05c9b..64edc0edae6f 100644
--- a/common/network-common/src/test/java/org/apache/spark/network/util/JavaUtilsSuite.java
+++ b/common/network-common/src/test/java/org/apache/spark/network/util/JavaUtilsSuite.java
@@ -23,6 +23,7 @@ import java.nio.file.Files;
 import org.junit.jupiter.api.Test;
 
 import static org.junit.jupiter.api.Assertions.*;
+import static org.junit.jupiter.api.Assumptions.assumeFalse;
 
 public class JavaUtilsSuite {
 
@@ -52,6 +53,10 @@ public class JavaUtilsSuite {
     // 4. The parent directory cannot write
     assertTrue(testDir.canWrite());
     assertTrue(testDir.setWritable(false));
+    // Skip when setWritable(false) has no effect (e.g. running as root,
+    // or on a filesystem that ignores POSIX write bits).
+    assumeFalse(testDir.canWrite(),
+      "setWritable(false) had no effect; skipping write-denied scenario");
     assertThrows(IOException.class,
       () -> JavaUtils.createDirectory(testDirPath, "scenario4"));
     assertTrue(testDir.setWritable(true));


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