File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
spark-submission-worker/src/test/java/org/apache/spark/k8s/operator Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -219,4 +219,20 @@ void generatedSparkAppIdShouldComplyLengthLimit() {
219219 String appId = SparkAppSubmissionWorker .generateSparkAppId (mockApp );
220220 assertTrue (appId .length () <= DEFAULT_ID_LENGTH_LIMIT );
221221 }
222+
223+ @ Test
224+ void checkAppIdWhenUserSpecifiedInSparkConf () {
225+ SparkApplication mockApp = mock (SparkApplication .class );
226+ ApplicationSpec mockSpec = mock (ApplicationSpec .class );
227+ Map <String , String > appProps = new HashMap <>();
228+ appProps .put ("spark.app.id" , "foo" );
229+ ObjectMeta appMeta = new ObjectMetaBuilder ().withName ("app1" ).withNamespace ("ns1" ).build ();
230+ when (mockSpec .getSparkConf ()).thenReturn (appProps );
231+ when (mockApp .getSpec ()).thenReturn (mockSpec );
232+ when (mockApp .getMetadata ()).thenReturn (appMeta );
233+
234+ SparkAppSubmissionWorker submissionWorker = new SparkAppSubmissionWorker ();
235+ SparkAppDriverConf conf = submissionWorker .buildDriverConf (mockApp , Collections .emptyMap ());
236+ assertEquals (conf .appId (), "foo" );
237+ }
222238}
You can’t perform that action at this time.
0 commit comments