Skip to content

Commit

Permalink
Add test for ZEPPELIN-5962
Browse files Browse the repository at this point in the history
  • Loading branch information
mrzhao committed Sep 16, 2023
1 parent 8b6c233 commit 101954f
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions livy/src/test/java/org/apache/zeppelin/livy/LivyInterpreterIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,42 @@ public void run() {
}
}

@Test
public void testLivyParams() throws InterpreterException {
if (!checkPreCondition()) {
return;
}
InterpreterGroup interpreterGroup = new InterpreterGroup("group_1");
interpreterGroup.put("session_1", new ArrayList<Interpreter>());
Properties props = new Properties(properties);
props.setProperty("livy.spark.executor.cores", "4");
props.setProperty("livy.name", "zeppelin-livy");
LivySparkInterpreter sparkInterpreter = new LivySparkInterpreter(props);
sparkInterpreter.setInterpreterGroup(interpreterGroup);
interpreterGroup.get("session_1").add(sparkInterpreter);
AuthenticationInfo authInfo = new AuthenticationInfo("user1");
MyInterpreterOutputListener outputListener = new MyInterpreterOutputListener();
InterpreterOutput output = new InterpreterOutput(outputListener);
InterpreterContext context = InterpreterContext.builder()
.setNoteId("noteId")
.setParagraphId("paragraphId")
.setAuthenticationInfo(authInfo)
.setInterpreterOut(output)
.build();
sparkInterpreter.open();

try {
InterpreterResult result = sparkInterpreter.interpret("sc.version\n" +
"assert(sc.getConf.get(\"spark.executor.cores\") == \"4\" && " +
"sc.getConf.get(\"spark.app.name\") == \"zeppelin-livy\")"
, context);
assertEquals(InterpreterResult.Code.SUCCESS, result.code(), result.toString());
assertEquals(1, result.message().size());
} finally {
sparkInterpreter.close();
}
}

@Test
void testLivyTutorialNote() throws IOException, InterpreterException {
if (!checkPreCondition()) {
Expand Down

0 comments on commit 101954f

Please sign in to comment.