Skip to content

Commit 98e01ae

Browse files
committed
Ensure assertions in Graph.apply are asserted.
The Graph.apply test in GraphSuite had some assertions in a closure in a graph transformation. This caused two problems: 1. because assert() was called, test classes were reachable from the closures, which made them not serializable, and 2. (more importantly) these assertions never actually executed, since they occurred within a lazy map() This commit simply changes the Graph.apply test to collects the graph triplets so it can assert about each triplet from a map method.
1 parent 6cb9218 commit 98e01ae

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

graphx/src/test/scala/org/apache/spark/graphx/GraphSuite.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class GraphSuite extends FunSuite with LocalSparkContext {
6262
assert( graph.edges.count() === rawEdges.size )
6363
// Vertices not explicitly provided but referenced by edges should be created automatically
6464
assert( graph.vertices.count() === 100)
65-
graph.triplets.map { et =>
65+
graph.triplets.collect.map { et =>
6666
assert((et.srcId < 10 && et.srcAttr) || (et.srcId >= 10 && !et.srcAttr))
6767
assert((et.dstId < 10 && et.dstAttr) || (et.dstId >= 10 && !et.dstAttr))
6868
}

0 commit comments

Comments
 (0)