Repository: spark Updated Branches: refs/heads/branch-1.0 1491b2a0d -> 692dd6936
SPARK-1501: Ensure assertions in Graph.apply are asserted. The Graph.apply test in GraphSuite had some assertions in a closure in a graph transformation. As a consequence, these assertions never actually executed. Furthermore, these closures had a reference to (non-serializable) test harness classes because they called assert(), which could be a problem if we proactively check closure serializability in the future. This commit simply changes the Graph.apply test to collect the graph triplets so it can assert about each triplet from a map method. Author: William Benton <wi...@redhat.com> Closes #415 from willb/graphsuite-nop-fix and squashes the following commits: 0b63658 [William Benton] Ensure assertions in Graph.apply are asserted. (cherry picked from commit 2580a3b1a06188fa97d9440d793c8835ef7384b0) Signed-off-by: Reynold Xin <r...@apache.org> Project: http://git-wip-us.apache.org/repos/asf/spark/repo Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/692dd693 Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/692dd693 Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/692dd693 Branch: refs/heads/branch-1.0 Commit: 692dd6936aa3a13aa498bfa87f0c8e3fba7302da Parents: 1491b2a Author: William Benton <wi...@redhat.com> Authored: Tue Apr 15 10:38:42 2014 -0700 Committer: Reynold Xin <r...@apache.org> Committed: Tue Apr 15 10:39:01 2014 -0700 ---------------------------------------------------------------------- graphx/src/test/scala/org/apache/spark/graphx/GraphSuite.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/spark/blob/692dd693/graphx/src/test/scala/org/apache/spark/graphx/GraphSuite.scala ---------------------------------------------------------------------- diff --git a/graphx/src/test/scala/org/apache/spark/graphx/GraphSuite.scala b/graphx/src/test/scala/org/apache/spark/graphx/GraphSuite.scala index 28d34dd..c65e366 100644 --- a/graphx/src/test/scala/org/apache/spark/graphx/GraphSuite.scala +++ b/graphx/src/test/scala/org/apache/spark/graphx/GraphSuite.scala @@ -62,7 +62,7 @@ class GraphSuite extends FunSuite with LocalSparkContext { assert( graph.edges.count() === rawEdges.size ) // Vertices not explicitly provided but referenced by edges should be created automatically assert( graph.vertices.count() === 100) - graph.triplets.map { et => + graph.triplets.collect.map { et => assert((et.srcId < 10 && et.srcAttr) || (et.srcId >= 10 && !et.srcAttr)) assert((et.dstId < 10 && et.dstAttr) || (et.dstId >= 10 && !et.dstAttr)) }