-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Chen Dai <[email protected]>
- Loading branch information
Showing
2 changed files
with
49 additions
and
2 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
spark/src/test/java/org/opensearch/sql/spark/config/SparkExecutionEngineConfigTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.sql.spark.config; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertNull; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
public class SparkExecutionEngineConfigTest { | ||
|
||
@Test | ||
public void testToSparkExecutionEngineConfigWithoutAllFields() { | ||
String json = | ||
"{" | ||
+ "\"applicationId\": \"app-1\"," | ||
+ "\"executionRoleARN\": \"role-1\"," | ||
+ "\"region\": \"us-west-1\"" | ||
+ "}"; | ||
SparkExecutionEngineConfig config = | ||
SparkExecutionEngineConfig.toSparkExecutionEngineConfig(json); | ||
|
||
assertEquals("app-1", config.getApplicationId()); | ||
assertEquals("role-1", config.getExecutionRoleARN()); | ||
assertEquals("us-west-1", config.getRegion()); | ||
assertNull(config.getSparkSubmitParameters()); | ||
} | ||
|
||
@Test | ||
public void testToSparkExecutionEngineConfigWithAllFields() { | ||
String json = | ||
"{" | ||
+ "\"applicationId\": \"app-1\"," | ||
+ "\"executionRoleARN\": \"role-1\"," | ||
+ "\"region\": \"us-west-1\"," | ||
+ "\"sparkSubmitParameters\": \"--conf A=1\"" | ||
+ "}"; | ||
SparkExecutionEngineConfig config = | ||
SparkExecutionEngineConfig.toSparkExecutionEngineConfig(json); | ||
|
||
assertEquals("app-1", config.getApplicationId()); | ||
assertEquals("role-1", config.getExecutionRoleARN()); | ||
assertEquals("us-west-1", config.getRegion()); | ||
assertEquals("--conf A=1", config.getSparkSubmitParameters()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters