You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@toree.apache.org by lb...@apache.org on 2016/05/16 21:56:04 UTC

[1/2] incubator-toree git commit: Added test coverage using Jupyter Kernel Test

Repository: incubator-toree
Updated Branches:
  refs/heads/master 44d913719 -> 4b2b2c7a5


Added test coverage using Jupyter Kernel Test


Project: http://git-wip-us.apache.org/repos/asf/incubator-toree/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-toree/commit/9df6ce95
Tree: http://git-wip-us.apache.org/repos/asf/incubator-toree/tree/9df6ce95
Diff: http://git-wip-us.apache.org/repos/asf/incubator-toree/diff/9df6ce95

Branch: refs/heads/master
Commit: 9df6ce95ca674a3c150e419c319cbe9050781e22
Parents: 44d9137
Author: Michael Poplavski <mi...@gmail.com>
Authored: Mon May 9 10:49:09 2016 -0500
Committer: Michael Poplavski <mi...@gmail.com>
Committed: Tue May 10 11:08:42 2016 -0500

----------------------------------------------------------------------
 .travis.yml                     |  7 ++++--
 Dockerfile.jupyter_kernel_tests | 32 +++++++++++++++++++++++
 Makefile                        | 15 +++++++++--
 test_toree.py                   | 49 ++++++++++++++++++++++++++++++++++++
 4 files changed, 99 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9df6ce95/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index 7553424..217b284 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -24,7 +24,10 @@ env:
         - TOREE_RESOLUTION_VERBOSITY=0
         - TEST_DILATION=3
 jdk:
-    - openjdk7
+    - oraclejdk7
+
+services:
+    - docker
 
 script:
     - make all-travis
@@ -32,7 +35,7 @@ script:
 before_cache:
     - make clean-travis
 
-sudo: false
+sudo: required
 
 cache:
     directories:

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9df6ce95/Dockerfile.jupyter_kernel_tests
----------------------------------------------------------------------
diff --git a/Dockerfile.jupyter_kernel_tests b/Dockerfile.jupyter_kernel_tests
new file mode 100644
index 0000000..89cf136
--- /dev/null
+++ b/Dockerfile.jupyter_kernel_tests
@@ -0,0 +1,32 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License
+#
+
+FROM jupyter/pyspark-notebook
+
+# Apache Toree kernel install
+ADD dist/toree-pip /srv/toree-pip
+RUN pip install /srv/toree-pip/toree*.tar.gz
+RUN jupyter toree install --user --kernel_name='Apache_Toree'
+
+#jupyter kernel tests install
+RUN pip install nose
+RUN pip install jupyter_kernel_test
+
+ADD test_toree.py /srv/test_toree.py
+
+# run jupyter kernel test script
+CMD ["python", "/srv/test_toree.py"]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9df6ce95/Makefile
----------------------------------------------------------------------
diff --git a/Makefile b/Makefile
index 439ed41..e4fa842 100644
--- a/Makefile
+++ b/Makefile
@@ -117,7 +117,7 @@ dev: .example-image dist
 			&& jupyter notebook --ip=* --no-browser"
 
 test: VM_WORKDIR=/src/toree-kernel
-test:
+test: jupyter-tests
 	$(call RUN,$(ENV_OPTS) sbt compile test)
 
 sbt-%:
@@ -174,6 +174,17 @@ jupyter: .example-image pip-release
 	@$(DOCKER) -p 8888:8888  -e SPARK_OPTS="--master=local[4]" --user=root  $(EXAMPLE_IMAGE) bash -c "$$JUPYTER_COMMAND"
 
 ################################################################################
+# System Tests Using Jupyter Kernel Test (https://github.com/jupyter/jupyter_kernel_test)
+################################################################################
+jupyter-tests: pip-release
+	@echo '-- Building jupyter kernel test image'
+	@docker build -f Dockerfile.jupyter_kernel_tests -t toree/jupyter-kernel-test .
+	@echo '-- Running jupyter kernel tests'
+	@docker run --rm -ti \
+		--name jupyter_kernel_tests \
+		toree/jupyter-kernel-test
+
+################################################################################
 # Jars
 ################################################################################
 publish-jars:
@@ -194,7 +205,7 @@ dist/toree-pip/toree-$(BASE_VERSION).tar.gz: dist/toree
 	@cp -R dist/toree/licenses dist/toree-pip/licenses
 	@cp -rf etc/pip_install/* dist/toree-pip/.
 	@$(GEN_PIP_PACKAGE_INFO)
-	@$(DOCKER) $(IMAGE) python setup.py sdist --dist-dir=.
+	@$(DOCKER) --user=root $(IMAGE) python setup.py sdist --dist-dir=.
 	@$(DOCKER) -p 8888:8888 --user=root  $(IMAGE) bash -c	'pip install toree-$(BASE_VERSION).tar.gz && jupyter toree install'
 #	-@(cd dist/toree-pip; find . -not -name 'toree-$(VERSION).tar.gz' -maxdepth 1 | xargs rm -r )
 

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/9df6ce95/test_toree.py
----------------------------------------------------------------------
diff --git a/test_toree.py b/test_toree.py
new file mode 100644
index 0000000..b8f1bfc
--- /dev/null
+++ b/test_toree.py
@@ -0,0 +1,49 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License
+#
+
+import unittest
+import jupyter_kernel_test
+
+class ToreeKernelTests(jupyter_kernel_test.KernelTests):
+    # Required --------------------------------------
+
+    # The name identifying an installed kernel to run the tests against
+    kernel_name = "apache_toree_scala"
+
+    # language_info.name in a kernel_info_reply should match this
+    language_name = "scala"
+
+    # Optional --------------------------------------
+
+    # the normal file extension (including the leading dot) for this language
+    # checked against language_info.file_extension in kernel_info_reply
+    file_extension = ".scala"
+
+    # Code in the kernel's language to write "hello, world" to stdout
+    code_hello_world = "println(\"hello, world\")"
+
+    # Samples of code which generate a result value (ie, some text
+    # displayed as Out[n])
+    code_execute_result = [
+        {'code': '6*7', 'result': '42'},
+        {'code': 'sc.parallelize(List(1, 2, 3, 4)).map(_*2).reduce(_+_)', 'result': '20'},
+        {'code': '%showtypes on\n1', 'result': 'Int = 1'},
+        {'code': '%showtypes off\n1', 'result': '1'}
+    ]
+
+if __name__ == '__main__':
+    unittest.main()
\ No newline at end of file


[2/2] incubator-toree git commit: Rename to system tests, run unit before system tests, and run operations in container instead of building it

Posted by lb...@apache.org.
Rename to system tests, run unit before system tests,
 and run operations in container instead of building it


Project: http://git-wip-us.apache.org/repos/asf/incubator-toree/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-toree/commit/4b2b2c7a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-toree/tree/4b2b2c7a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-toree/diff/4b2b2c7a

Branch: refs/heads/master
Commit: 4b2b2c7a55239ed707b699ec836dae58ef2a00e8
Parents: 9df6ce9
Author: Michael Poplavski <mi...@gmail.com>
Authored: Tue May 10 16:24:15 2016 -0500
Committer: Michael Poplavski <mi...@gmail.com>
Committed: Wed May 11 09:18:55 2016 -0500

----------------------------------------------------------------------
 Dockerfile.jupyter_kernel_tests | 32 --------------------------------
 Makefile                        | 18 ++++++++++--------
 2 files changed, 10 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/4b2b2c7a/Dockerfile.jupyter_kernel_tests
----------------------------------------------------------------------
diff --git a/Dockerfile.jupyter_kernel_tests b/Dockerfile.jupyter_kernel_tests
deleted file mode 100644
index 89cf136..0000000
--- a/Dockerfile.jupyter_kernel_tests
+++ /dev/null
@@ -1,32 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License
-#
-
-FROM jupyter/pyspark-notebook
-
-# Apache Toree kernel install
-ADD dist/toree-pip /srv/toree-pip
-RUN pip install /srv/toree-pip/toree*.tar.gz
-RUN jupyter toree install --user --kernel_name='Apache_Toree'
-
-#jupyter kernel tests install
-RUN pip install nose
-RUN pip install jupyter_kernel_test
-
-ADD test_toree.py /srv/test_toree.py
-
-# run jupyter kernel test script
-CMD ["python", "/srv/test_toree.py"]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/4b2b2c7a/Makefile
----------------------------------------------------------------------
diff --git a/Makefile b/Makefile
index e4fa842..3024948 100644
--- a/Makefile
+++ b/Makefile
@@ -15,7 +15,7 @@
 # limitations under the License
 #
 
-.PHONY: help clean clean-dist build dev test test-travis release pip-release bin-release dev-binder .binder-image audit audit-licenses
+.PHONY: help clean clean-dist build dev test system-test test-travis release pip-release bin-release dev-binder .binder-image audit audit-licenses
 
 BASE_VERSION=0.1.0.dev8
 VERSION=$(BASE_VERSION)-incubating
@@ -117,7 +117,7 @@ dev: .example-image dist
 			&& jupyter notebook --ip=* --no-browser"
 
 test: VM_WORKDIR=/src/toree-kernel
-test: jupyter-tests
+test:
 	$(call RUN,$(ENV_OPTS) sbt compile test)
 
 sbt-%:
@@ -176,13 +176,15 @@ jupyter: .example-image pip-release
 ################################################################################
 # System Tests Using Jupyter Kernel Test (https://github.com/jupyter/jupyter_kernel_test)
 ################################################################################
-jupyter-tests: pip-release
-	@echo '-- Building jupyter kernel test image'
-	@docker build -f Dockerfile.jupyter_kernel_tests -t toree/jupyter-kernel-test .
+system-test: pip-release
 	@echo '-- Running jupyter kernel tests'
 	@docker run --rm -ti \
 		--name jupyter_kernel_tests \
-		toree/jupyter-kernel-test
+		-v `pwd`/dist/toree-pip:/srv/toree-pip \
+		-v `pwd`/test_toree.py:/srv/test_toree.py \
+		$(IMAGE) \
+		bash -c "pip install /srv/toree-pip/toree*.tar.gz ; jupyter toree install --user --kernel_name='Apache_Toree' ; \
+		pip install nose jupyter_kernel_test ; python /srv/test_toree.py"
 
 ################################################################################
 # Jars
@@ -273,9 +275,9 @@ audit: sign audit-licenses
 
 publish: audit publish-bin publish-pip publish-src publish-jars
 
-all: clean test audit
+all: clean test system-test audit
 
-all-travis: clean test audit-licenses
+all-travis: clean test system-test audit-licenses
 
 clean-travis:
 	find $(HOME)/.sbt -name "*.lock" | xargs rm