Skip to content

Commit 8fe33c4

Browse files
committed
Fix invalid test cases
1 parent e2fd4bf commit 8fe33c4

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

shell/src/test/java/org/apache/zeppelin/shell/ShellInterpreterTest.java

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
import java.util.Properties;
2424

25-
import org.apache.commons.exec.ExecuteException;
2625
import org.apache.zeppelin.interpreter.InterpreterContext;
2726
import org.apache.zeppelin.interpreter.InterpreterResult;
2827
import org.apache.zeppelin.interpreter.InterpreterResult.Code;
@@ -33,13 +32,16 @@
3332
public class ShellInterpreterTest {
3433

3534
private ShellInterpreter shell;
35+
private InterpreterContext context;
36+
private InterpreterResult result;
3637

3738
@Before
3839
public void setUp() throws Exception {
3940
Properties p = new Properties();
4041
p.setProperty("shell.command.timeout.millisecs", "60000");
4142
shell = new ShellInterpreter(p);
4243

44+
context = new InterpreterContext("", "1", null, "", "", null, null, null, null, null, null, null);
4345
shell.open();
4446
}
4547

@@ -49,8 +51,6 @@ public void tearDown() throws Exception {
4951

5052
@Test
5153
public void test() {
52-
InterpreterContext context = new InterpreterContext("", "1", null, "", "", null, null, null, null, null, null, null);
53-
InterpreterResult result;
5454
if (System.getProperty("os.name").startsWith("Windows")) {
5555
result = shell.interpret("dir", context);
5656
} else {
@@ -65,29 +65,23 @@ public void test() {
6565

6666
@Test
6767
public void testInvalidCommand(){
68-
InterpreterContext context = new InterpreterContext("", "1", null, "", "", null, null, null, null, null, null, null);
69-
InterpreterResult result;
7068
if (System.getProperty("os.name").startsWith("Windows")) {
7169
result = shell.interpret("invalid_command\ndir", context);
7270
} else {
7371
result = shell.interpret("invalid_command\nls", context);
7472
}
75-
assertEquals(InterpreterResult.Code.SUCCESS, result.code());
76-
assertTrue(result.message().get(0).getData().contains("invalid_command"));
73+
assertEquals(Code.SUCCESS, result.code());
74+
assertTrue(shell.executors.isEmpty());
7775
}
7876

7977
@Test
8078
public void testShellTimeout() {
81-
InterpreterContext context = new InterpreterContext("", "1", null, "", "", null, null, null, null, null, null, null);
82-
InterpreterResult result;
83-
8479
if (System.getProperty("os.name").startsWith("Windows")) {
8580
result = shell.interpret("timeout 61", context);
8681
} else {
8782
result = shell.interpret("sleep 61", context);
8883
}
8984

90-
assertEquals(InterpreterResult.Code.SUCCESS, result.code());
9185
assertEquals(Code.INCOMPLETE, result.code());
9286
assertTrue(result.message().get(0).getData().contains("Paragraph received a SIGTERM"));
9387
}

0 commit comments

Comments
 (0)