renechoi commented on code in PR #5000: URL: https://github.com/apache/zeppelin/pull/5000#discussion_r2264670076
########## zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/launcher/SparkInterpreterLauncherTest.java: ########## @@ -325,4 +328,53 @@ void testYarnClusterMode_3() throws IOException { } FileUtils.deleteDirectory(localRepoPath.toFile()); } + + @Test + void testDetectSparkScalaVersionDirectStreamCapture() throws Exception { + SparkInterpreterLauncher launcher = new SparkInterpreterLauncher(zConf, null); + + // Use reflection to access private method + Method detectSparkScalaVersionMethod = SparkInterpreterLauncher.class.getDeclaredMethod( + "detectSparkScalaVersion", String.class, Map.class); + detectSparkScalaVersionMethod.setAccessible(true); + + Map<String, String> env = new HashMap<>(); + + // Call the method + String scalaVersion = (String) detectSparkScalaVersionMethod.invoke(launcher, sparkHome, env); + + // Verify we got a valid result + assertTrue(scalaVersion.equals("2.12") || scalaVersion.equals("2.13"), + "Expected scala version 2.12 or 2.13 but got: " + scalaVersion); + + // Since we're no longer using temp files, verify no temp files were created + File tempDir = new File(System.getProperty("java.io.tmpdir")); + File[] sparkTempFiles = tempDir.listFiles((dir, name) -> + name.startsWith("zeppelin-spark") && name.endsWith(".out")); + + // No new temp files should have been created by this method + // (there might be old ones from other tests/processes) + } + + @Test + void testDetectSparkScalaVersionMultipleCalls() throws Exception { Review Comment: Hi, @Reamer Thanks for the follow-up review. I’ve addressed your requests: • Removed the temp-file related assertions (old behavior). • Deleted the redundant multiple-calls test. -- 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: reviews-unsubscr...@zeppelin.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org