mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
[ZEPPELIN-2216] added tests
This commit is contained in:
parent
5a482a0221
commit
e4cf72f135
1 changed files with 74 additions and 1 deletions
|
|
@ -58,7 +58,7 @@ public class RemoteInterpreterTest {
|
|||
private static final String INTERPRETER_SCRIPT =
|
||||
System.getProperty("os.name").startsWith("Windows") ?
|
||||
"../bin/interpreter.cmd" :
|
||||
"../bin/interpreter.sh";
|
||||
"bin/interpreter.sh";
|
||||
|
||||
private InterpreterGroup intpGroup;
|
||||
private HashMap<String, String> env;
|
||||
|
|
@ -170,6 +170,79 @@ public class RemoteInterpreterTest {
|
|||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExecuteIncorrectPrecode() throws TTransportException, IOException {
|
||||
Properties p = new Properties();
|
||||
p.put("zeppelin.MockInterpreterA.precode", "fail test");
|
||||
intpGroup.put("note", new LinkedList<Interpreter>());
|
||||
|
||||
RemoteInterpreter intpA = createMockInterpreterA(p);
|
||||
|
||||
intpGroup.get("note").add(intpA);
|
||||
|
||||
intpA.setInterpreterGroup(intpGroup);
|
||||
|
||||
RemoteInterpreterProcess process = intpA.getInterpreterProcess();
|
||||
|
||||
intpA.open();
|
||||
|
||||
InterpreterResult result = intpA.interpret("1",
|
||||
new InterpreterContext(
|
||||
"note",
|
||||
"id",
|
||||
null,
|
||||
"title",
|
||||
"text",
|
||||
new AuthenticationInfo(),
|
||||
new HashMap<String, Object>(),
|
||||
new GUI(),
|
||||
new AngularObjectRegistry(intpGroup.getId(), null),
|
||||
new LocalResourcePool("pool1"),
|
||||
new LinkedList<InterpreterContextRunner>(), null));
|
||||
|
||||
|
||||
|
||||
intpA.close();
|
||||
assertEquals(Code.ERROR, result.code());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExecuteCorrectPrecode() throws TTransportException, IOException {
|
||||
Properties p = new Properties();
|
||||
p.put("zeppelin.MockInterpreterA.precode", "2");
|
||||
intpGroup.put("note", new LinkedList<Interpreter>());
|
||||
|
||||
RemoteInterpreter intpA = createMockInterpreterA(p);
|
||||
|
||||
intpGroup.get("note").add(intpA);
|
||||
|
||||
intpA.setInterpreterGroup(intpGroup);
|
||||
|
||||
RemoteInterpreterProcess process = intpA.getInterpreterProcess();
|
||||
|
||||
intpA.open();
|
||||
|
||||
InterpreterResult result = intpA.interpret("1",
|
||||
new InterpreterContext(
|
||||
"note",
|
||||
"id",
|
||||
null,
|
||||
"title",
|
||||
"text",
|
||||
new AuthenticationInfo(),
|
||||
new HashMap<String, Object>(),
|
||||
new GUI(),
|
||||
new AngularObjectRegistry(intpGroup.getId(), null),
|
||||
new LocalResourcePool("pool1"),
|
||||
new LinkedList<InterpreterContextRunner>(), null));
|
||||
|
||||
|
||||
|
||||
intpA.close();
|
||||
assertEquals(Code.SUCCESS, result.code());
|
||||
assertEquals("1", result.message().get(0).getData());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoteInterperterErrorStatus() throws TTransportException, IOException {
|
||||
Properties p = new Properties();
|
||||
|
|
|
|||
Loading…
Reference in a new issue