dccspeed / fractal

Apache License 2.0
28 stars 8 forks source link

VFilter or EFilter filtering results keeped through experiments #14

Closed ceciliassis closed 8 months ago

ceciliassis commented 4 years ago

Problem

Even that each test case should clean the contexts, it doesn't, making filtering rules persist. NOTE: I don't know if it is the expected result, but doesn't feel like it should be.

Environment

Steps to reproduce

  1. Change br.ufmg.cs.systems.fractal.BasicTestSuite.scala
    
    // BasicTestSuite.scala

class BasicTestSuite extends FunSuite with BeforeAndAfterAll { private val numPartitions: Int = 8 private val appName: String = "fractal-test" private val logLevel: String = "error"

private var master: String = private var sc: SparkContext = private var fc: FractalContext = private var fgraph: FractalGraph = private var fgraphEdgeLabel: FractalGraph = _

/* set up spark context / override def beforeAll: Unit = { master = s"local[${numPartitions}]" // spark conf and context val conf = new SparkConf(). setMaster(master). setAppName(appName)

sc = new SparkContext(conf)
sc.setLogLevel(logLevel)
fc = new FractalContext(sc, logLevel)

fgraph = fc.textFile("../data/cube.graph")

fgraphEdgeLabel = fc.textFile("../data/cube-edge-label.graph")

}

/* stop spark context / override def afterAll: Unit = { if (sc != null) { sc.stop() fc.stop() } }

test("[cube,vfilter]", Tag("cube.vfilter")) { val numSubgraph = List(3) for (k <- 0 to (numSubgraph.size - 1)) { val frac = fgraph.vfractoidAndExpand. vfilter[String](v => v.getVertexLabel() == 1). set("num_partitions", numPartitions) val subgraphs = frac.subgraphs assert(subgraphs.count == numSubgraph(k)) } }

test("[cube,cliques]", Tag("cube.cliques")) { val numSubgraph = List(8, 12, 0)

for (k <- 0 to (numSubgraph.size - 1)) {
  val cliqueRes = fgraph.cliques.
    set("num_partitions", numPartitions).
    explore(k)

  val subgraphs = cliqueRes.subgraphs
  assert(subgraphs.count == numSubgraph(k))
}

}

}

2. Run tests
```bash
export FRACTAL_HOME=`pwd` && ./gradlew test

Output

- [cube,vfilter]
- [cube,cliques] *** FAILED ***14s]
  7 did not equal 12 (BasicTestSuite.scala:148)
Run completed in 7 seconds, 366 milliseconds.
Total number of tests run: 2
Suites: completed 2, aborted 0
Tests: succeeded 1, failed 1, canceled 0, ignored 0, pending 0
*** 1 TEST FAILED ***

Expected Output

- [cube,vfilter]
- [cube,cliques]
Run completed in 4 seconds, 207 milliseconds.
Total number of tests run: 2
Suites: completed 2, aborted 0
Tests: succeeded 2, failed 0, canceled 0, ignored 0, pending 0
All tests passed.