当我为了测试利用spark-testing-base
火花检测基地奇怪校验失败
Map("result" -> Array(3, 6, 9, 12, 15, 18, 21, 24, 27, 0)) did not equal Map("result" -> Array(3, 6, 9, 12, 15, 18, 21, 24, 27, 0))
为一个测试情况下,火花应用执行sbt test
val input: Map[String, Any] = Map("digits" -> Seq(1, 2, 3, 4, 5, 6, 7, 8, 9, 0))
val expectedOutput: Map[String, Any] = Map("result" -> Array(3, 6, 9, 12, 15, 18, 21, 24, 27, 0))
val result = SimpleContext.runTheJOb(session, input)
最小例子可以发现https://github.com/geoHeil/apache-spark-restAPI-example
编辑
w孔测试用例直接
class SimpleTest extends FunSuite with SharedSparkContext with DatasetSuiteBase {
test("SimpleContext should multiply input numbers by 3") {
val session = spark
val input: Map[String, Any] = Map("digits" -> Seq(1, 2, 3, 4, 5, 6, 7, 8, 9, 0))
val expectedOutput: Map[String, Any] = Map("result" -> Array(3, 6, 9, 12, 15, 18, 21, 24, 27, 0))
val result = SimpleContext.runTheJOb(session, input)
assert(expectedOutput === result)
}
}
@LostInOverflow最小的“代码”已包含在内。但是如果你喜欢整个代码,我会编辑这个问题。 –
谢谢!你的要点可能会在任何时候失效,这个问题不仅适用于你。 – 2016-11-30 20:47:42