mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
Add %dep z.load integration test
This commit is contained in:
parent
e3ae4c8554
commit
b604c4ce52
2 changed files with 53 additions and 15 deletions
|
|
@ -231,16 +231,6 @@ public class SparkInterpreterTest {
|
|||
assertEquals(Code.ERROR, result.code());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testZContextDependencyLoading() {
|
||||
// try to import library does not exist on classpath. it'll fail
|
||||
assertEquals(InterpreterResult.Code.ERROR, repl.interpret("import org.apache.commons.csv.CSVFormat", context).code());
|
||||
|
||||
// load library from maven repository and try to import again
|
||||
repl.interpret("z.load(\"org.apache.commons:commons-csv:1.1\")", context);
|
||||
assertEquals(InterpreterResult.Code.SUCCESS, repl.interpret("import org.apache.commons.csv.CSVFormat", context).code());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void emptyConfigurationVariablesOnlyForNonSparkProperties() {
|
||||
Properties intpProperty = repl.getProperty();
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ import org.slf4j.LoggerFactory;
|
|||
public class SparkParagraphIT extends AbstractZeppelinIT {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(SparkParagraphIT.class);
|
||||
|
||||
|
||||
@Rule
|
||||
public ErrorCollector collector = new ErrorCollector();
|
||||
|
||||
|
|
@ -142,8 +141,8 @@ public class SparkParagraphIT extends AbstractZeppelinIT {
|
|||
|
||||
// the last statement's evaluation result is printed
|
||||
setTextOfParagraph(2, "%pyspark\\n" +
|
||||
"sc.version\\n" +
|
||||
"1+1");
|
||||
"sc.version\\n" +
|
||||
"1+1");
|
||||
runParagraph(2);
|
||||
try {
|
||||
waitForParagraph(2, "FINISHED");
|
||||
|
|
@ -154,9 +153,9 @@ public class SparkParagraphIT extends AbstractZeppelinIT {
|
|||
);
|
||||
}
|
||||
WebElement paragraph2Result = driver.findElement(By.xpath(
|
||||
getParagraphXPath(2) + "//div[@class=\"tableDisplay\"]"));
|
||||
getParagraphXPath(2) + "//div[@class=\"tableDisplay\"]"));
|
||||
collector.checkThat("Paragraph from SparkParagraphIT of testPySpark result: ",
|
||||
paragraph2Result.getText().toString(), CoreMatchers.equalTo("2")
|
||||
paragraph2Result.getText().toString(), CoreMatchers.equalTo("2")
|
||||
);
|
||||
|
||||
} catch (Exception e) {
|
||||
|
|
@ -192,4 +191,53 @@ public class SparkParagraphIT extends AbstractZeppelinIT {
|
|||
handleException("Exception in SparkParagraphIT while testSqlSpark", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDep() throws Exception {
|
||||
if (!endToEndTestEnabled()) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
// restart spark interpreter before running %dep
|
||||
clickAndWait(By.xpath("//span[@tooltip='Interpreter binding']"));
|
||||
clickAndWait(By.xpath("//div[font[contains(text(), 'spark')]]/preceding-sibling::a[@tooltip='Restart']"));
|
||||
clickAndWait(By.xpath("//button[contains(.,'OK')]"));
|
||||
|
||||
setTextOfParagraph(1,"%dep z.load(\"org.apache.commons:commons-csv:1.1\")");
|
||||
runParagraph(1);
|
||||
|
||||
try {
|
||||
waitForParagraph(1, "FINISHED");
|
||||
WebElement paragraph1Result = driver.findElement(By.xpath(getParagraphXPath(1) +
|
||||
"//div[@class='text']"));
|
||||
collector.checkThat("Paragraph from SparkParagraphIT of testSqlSpark result: ",
|
||||
paragraph1Result.getText(), CoreMatchers.containsString("res0: org.apache.zeppelin.dep.Dependency = org.apache.zeppelin.dep.Dependency"));
|
||||
|
||||
setTextOfParagraph(2, "import org.apache.commons.csv.CSVFormat");
|
||||
runParagraph(2);
|
||||
|
||||
try {
|
||||
waitForParagraph(2, "FINISHED");
|
||||
WebElement paragraph2Result = driver.findElement(By.xpath(getParagraphXPath(2) +
|
||||
"//div[@class='text']"));
|
||||
collector.checkThat("Paragraph from SparkParagraphIT of testSqlSpark result: ",
|
||||
paragraph2Result.getText(), CoreMatchers.equalTo("import org.apache.commons.csv.CSVFormat"));
|
||||
|
||||
} catch (TimeoutException e) {
|
||||
waitForParagraph(2, "ERROR");
|
||||
collector.checkThat("Second paragraph from SparkParagraphIT of testDep status: ",
|
||||
"ERROR", CoreMatchers.equalTo("FINISHED")
|
||||
);
|
||||
}
|
||||
|
||||
} catch (TimeoutException e) {
|
||||
waitForParagraph(1, "ERROR");
|
||||
collector.checkThat("First paragraph from SparkParagraphIT of testDep status: ",
|
||||
"ERROR", CoreMatchers.equalTo("FINISHED")
|
||||
);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
handleException("Exception in SparkParagraphIT while testDep", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue