dongjoon-hyun commented on code in PR #53539:
URL: https://github.com/apache/spark/pull/53539#discussion_r2644298677


##########
core/src/test/scala/org/apache/spark/deploy/SparkSubmitSuite.scala:
##########
@@ -1631,6 +1631,22 @@ class SparkSubmitSuite
     assertResult(3)(runSparkSubmit(args, expectFailure = true))
   }
 
+  test("SPARK-54774: k8s submit failed should keep same exit code with user 
code") {
+    val unusedJar = TestUtils.createJarWithClasses(Seq.empty)
+    val args = Seq(
+      "--class", K8sExitCodeTestApplication.getClass.getName.stripSuffix("$"),
+      "--name", "testApp",
+      "--master", "k8s://host:port",
+      "--conf", "spark.ui.enabled=false",
+      "--conf", "spark.master.rest.enabled=false",
+      "--conf", 
"spark.kubernetes.authenticate.driver.serviceAccountName=default",
+      unusedJar.toString
+    )
+    // The test application throws SparkUserAppException with exit code 42,
+    // so SparkContext.stop(42) should be called in k8s mode
+    assertResult(42)(runSparkSubmit(args, expectFailure = true))

Review Comment:
   This test case seems to pass without your patch, @AngersZhuuuu . Could you 
double-check this test case?
   
   ```
   $ git diff master --stat
    core/src/test/scala/org/apache/spark/deploy/SparkSubmitSuite.scala | 36 
++++++++++++++++++++++++++++++++++++
    1 file changed, 36 insertions(+)
   
   $ build/sbt "core/testOnly *.SparkSubmitSuite -- -z SPARK-54774"
   [info] SparkSubmitSuite:
   [info] - SPARK-54774: k8s submit failed should keep same exit code with user 
code (2 seconds, 926 milliseconds)
   [info] Run completed in 3 seconds, 795 milliseconds.
   [info] Total number of tests run: 1
   [info] Suites: completed 1, aborted 0
   [info] Tests: succeeded 1, failed 0, canceled 0, ignored 0, pending 0
   [info] All tests passed.
   [success] Total time: 59 s, completed Dec 24, 2025, 6:29:30 AM
   ```



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