Commit 866a6e8
[SPARK-55290][NETWORK][TESTS] Fix testReloadMissingTrustStore cross-device link error with JDK 21
### What changes were proposed in this pull request?
Replace hardcoded filename with `File.createTempFile()` in `testReloadMissingTrustStore` to ensure the temporary `trustStore` file is created in the same filesystem as the test working directory.
### Why are the changes needed?
This change fixes a unit test bug.
JDK 21's `UnixFileSystem.move()` uses atomic rename operations that fail when moving files across different mounted filesystems. The test creates a temporary file in `/tmp` and attempts to move it to the current directory. When these locations are on different partitions, the atomic move fails with a `testmissing.jks: Cross-device link` error because the `rename()` system call cannot move files across different filesystems.
The fix ensures both temporary and target files are created in the same filesystem by eliminating the cross-filesystem move operation.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
Verified `ReloadingX509TrustManagerSuite` passes with both JDK 21 and JDK 17:
`build/mvn -pl common/network-common -Dtest=ReloadingX509TrustManagerSuite test`
### Was this patch authored or co-authored using generative AI tooling?
No.
Closes #54073 from efaracci018/fix-testReloadMissingTrustStore.
Authored-by: Emilie Faracci <efaracci@amazon.com>
Signed-off-by: Kousuke Saruta <sarutak@apache.org>1 parent 65a6a55 commit 866a6e8
File tree
1 file changed
+3
-1
lines changed- common/network-common/src/test/java/org/apache/spark/network/ssl
1 file changed
+3
-1
lines changedLines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
192 | | - | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
193 | 195 | | |
194 | 196 | | |
195 | 197 | | |
| |||
0 commit comments