Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-51030][CORE][TESTS] Add a check before Utils.deleteRecursively(tempDir) to ensure tempDir won't be cleaned up by the ShutdownHook in afterEach of LocalRootDirsTest #49723

13 changes: 13 additions & 0 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
@@ -1291,3 +1291,16 @@ jobs:
cd ui-test
npm install --save-dev
node --experimental-vm-modules node_modules/.bin/jest

maven-test:
name: "Run Maven Test on macos"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

permissions:
packages: write
uses: ./.github/workflows/maven_test.yml
with:
java: 21
os: macos-15
envs: >-
{
"OBJC_DISABLE_INITIALIZE_FORK_SAFETY": "YES"
}
6 changes: 4 additions & 2 deletions core/src/test/scala/org/apache/spark/LocalRootDirsTest.scala
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ package org.apache.spark
import java.io.File
import java.util.UUID

import org.apache.spark.util.Utils
import org.apache.spark.util.{ShutdownHookManager, Utils}


trait LocalRootDirsTest extends SparkFunSuite with LocalSparkContext {
@@ -46,7 +46,9 @@ trait LocalRootDirsTest extends SparkFunSuite with LocalSparkContext {

override def afterEach(): Unit = {
try {
Utils.deleteRecursively(tempDir)
if (!ShutdownHookManager.hasRootAsShutdownDeleteDir(tempDir)) {
Utils.deleteRecursively(tempDir)
}
Utils.clearLocalRootDirs()
} finally {
super.afterEach()