mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
add unit test
This commit is contained in:
parent
296c63fdf4
commit
4fe033d3e7
2 changed files with 26 additions and 1 deletions
|
|
@ -171,7 +171,12 @@ public abstract class AbstractTestRestApi {
|
|||
|
||||
String sparkHome = getSparkHome();
|
||||
if (sparkHome != null) {
|
||||
sparkIntpSetting.getProperties().setProperty("master", "spark://" + getHostname() + ":7071");
|
||||
if (System.getenv("SPARK_MASTER") != null) {
|
||||
sparkIntpSetting.getProperties().setProperty("master", System.getenv("SPARK_MASTER"));
|
||||
} else {
|
||||
sparkIntpSetting.getProperties()
|
||||
.setProperty("master", "spark://" + getHostname() + ":7071");
|
||||
}
|
||||
sparkIntpSetting.getProperties().setProperty("spark.cores.max", "2");
|
||||
// set spark home for pyspark
|
||||
sparkIntpSetting.getProperties().setProperty("spark.home", sparkHome);
|
||||
|
|
|
|||
|
|
@ -140,6 +140,26 @@ public class ZeppelinSparkClusterTest extends AbstractTestRestApi {
|
|||
waitForFinish(p);
|
||||
assertEquals(Status.FINISHED, p.getStatus());
|
||||
assertEquals("55\n", p.getResult().message());
|
||||
|
||||
// run sqlContext test
|
||||
p.setText("%pyspark from pyspark.sql import Row\n" +
|
||||
"df=sqlContext.createDataFrame([Row(name='Alice', age=20)])\n" +
|
||||
"df.count()");
|
||||
note.run(p.getId());
|
||||
waitForFinish(p);
|
||||
assertEquals(Status.FINISHED, p.getStatus());
|
||||
assertEquals("1\n", p.getResult().message());
|
||||
|
||||
if (sparkVersion >= 20) {
|
||||
// run SparkSession test
|
||||
p.setText("%pyspark from pyspark.sql import Row\n" +
|
||||
"df=sqlContext.createDataFrame([Row(name='Alice', age=20)])\n" +
|
||||
"df.count()");
|
||||
note.run(p.getId());
|
||||
waitForFinish(p);
|
||||
assertEquals(Status.FINISHED, p.getStatus());
|
||||
assertEquals("1\n", p.getResult().message());
|
||||
}
|
||||
}
|
||||
ZeppelinServer.notebook.removeNote(note.getId(), null);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue