aboutsummaryrefslogtreecommitdiff
path: root/core/src/test
diff options
context:
space:
mode:
authorKay Ousterhout <kayousterhout@gmail.com>2014-06-24 16:54:50 -0700
committerKay Ousterhout <kayousterhout@gmail.com>2014-06-24 16:54:50 -0700
commit1978a9033ea0d47ac0e0a51d97c8515689f84d04 (patch)
treec50574253cd058462cf19657056c824996a7a9dd /core/src/test
parent221909e678bb60e5a3746e64a718600841c5f74f (diff)
downloadspark-1978a9033ea0d47ac0e0a51d97c8515689f84d04.tar.gz
spark-1978a9033ea0d47ac0e0a51d97c8515689f84d04.tar.bz2
spark-1978a9033ea0d47ac0e0a51d97c8515689f84d04.zip
Fix broken Json tests.
The assertJsonStringEquals method was missing an "assert" so did not actually check that the strings were equal. This commit adds the missing assert and fixes subsequently revealed problems with the JsonProtocolSuite. @andrewor14 I changed some of the test functionality to match what it looks like you intended based on the expected strings -- let me know if anything here looks wrong. Author: Kay Ousterhout <kayousterhout@gmail.com> Closes #1198 from kayousterhout/json_test_fix and squashes the following commits: 77f858f [Kay Ousterhout] Fix broken Json tests.
Diffstat (limited to 'core/src/test')
-rw-r--r--core/src/test/scala/org/apache/spark/util/JsonProtocolSuite.scala23
1 files changed, 11 insertions, 12 deletions
diff --git a/core/src/test/scala/org/apache/spark/util/JsonProtocolSuite.scala b/core/src/test/scala/org/apache/spark/util/JsonProtocolSuite.scala
index f72389b6b3..495e1b7a0a 100644
--- a/core/src/test/scala/org/apache/spark/util/JsonProtocolSuite.scala
+++ b/core/src/test/scala/org/apache/spark/util/JsonProtocolSuite.scala
@@ -366,7 +366,7 @@ class JsonProtocolSuite extends FunSuite {
private def assertJsonStringEquals(json1: String, json2: String) {
val formatJsonString = (json: String) => json.replaceAll("[\\s|]", "")
- formatJsonString(json1) === formatJsonString(json2)
+ assert(formatJsonString(json1) === formatJsonString(json2))
}
private def assertSeqEquals[T](seq1: Seq[T], seq2: Seq[T], assertEquals: (T, T) => Unit) {
@@ -449,7 +449,7 @@ class JsonProtocolSuite extends FunSuite {
}
private def makeStageInfo(a: Int, b: Int, c: Int, d: Long, e: Long) = {
- val rddInfos = (1 to a % 5).map { i => makeRddInfo(a % i, b % i, c % i, d % i, e % i) }
+ val rddInfos = (0 until a % 5).map { i => makeRddInfo(a + i, b + i, c + i, d + i, e + i) }
new StageInfo(a, "greetings", b, rddInfos, "details")
}
@@ -493,20 +493,19 @@ class JsonProtocolSuite extends FunSuite {
private val stageSubmittedJsonString =
"""
{"Event":"SparkListenerStageSubmitted","Stage Info":{"Stage ID":100,"Stage Name":
- "greetings","Number of Tasks":200,"RDD Info":{"RDD ID":100,"Name":"mayor","Storage
- Level":{"Use Disk":true,"Use Memory":true,"Use Tachyon":false,"Deserialized":true,
- "Replication":1},"Number of Partitions":200,"Number of Cached Partitions":300,
- "Memory Size":400,"Disk Size":500,"Tachyon Size":0},"Emitted Task Size Warning":false},
- "Properties":{"France":"Paris","Germany":"Berlin","Russia":"Moscow","Ukraine":"Kiev"}}
+ "greetings","Number of Tasks":200,"RDD Info":[],"Details":"details",
+ "Emitted Task Size Warning":false},"Properties":{"France":"Paris","Germany":"Berlin",
+ "Russia":"Moscow","Ukraine":"Kiev"}}
"""
private val stageCompletedJsonString =
"""
{"Event":"SparkListenerStageCompleted","Stage Info":{"Stage ID":101,"Stage Name":
- "greetings","Number of Tasks":201,"RDD Info":{"RDD ID":101,"Name":"mayor","Storage
+ "greetings","Number of Tasks":201,"RDD Info":[{"RDD ID":101,"Name":"mayor","Storage
Level":{"Use Disk":true,"Use Memory":true,"Use Tachyon":false,"Deserialized":true,
"Replication":1},"Number of Partitions":201,"Number of Cached Partitions":301,
- "Memory Size":401,"Disk Size":501,"Tachyon Size":0},"Emitted Task Size Warning":false}}
+ "Memory Size":401,"Tachyon Size":0,"Disk Size":501}],"Details":"details",
+ "Emitted Task Size Warning":false}}
"""
private val taskStartJsonString =
@@ -538,9 +537,9 @@ class JsonProtocolSuite extends FunSuite {
900,"Total Blocks Fetched":1500,"Remote Blocks Fetched":800,"Local Blocks Fetched":
700,"Fetch Wait Time":900,"Remote Bytes Read":1000},"Shuffle Write Metrics":
{"Shuffle Bytes Written":1200,"Shuffle Write Time":1500},"Updated Blocks":
- [{"Block ID":{"Type":"RDDBlockId","RDD ID":0,"Split Index":0},"Status":
- {"Storage Level":{"Use Disk":true,"Use Memory":true,"Use Tachyon":false,
- "Deserialized":false,"Replication":2},"Memory Size":0,"Disk Size":0,"Tachyon Size":0}}]}}
+ [{"Block ID":"rdd_0_0","Status":{"Storage Level":{"Use Disk":true,"Use Memory":true,
+ "Use Tachyon":false,"Deserialized":false,"Replication":2},"Memory Size":0,"Tachyon Size":0,
+ "Disk Size":0}}]}}
"""
private val jobStartJsonString =