Skip to content
Next Next commit
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.
  • Loading branch information
willb committed Mar 20, 2014
commit d5947b33f8e22ee498473abd59795d4f15a7b198
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand Down