Skip to content

Commit 0fc33e0

Browse files
committed
Added explicit backward compatibility test
1 parent 4e52925 commit 0fc33e0

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

core/src/test/scala/org/apache/spark/util/JsonProtocolSuite.scala

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ class JsonProtocolSuite extends FunSuite {
123123
testBlockId(StreamBlockId(1, 2L))
124124
}
125125

126-
test("backward compatibility") {
126+
test("StageInfo.details backward compatibility") {
127127
// StageInfo.details was added after 1.0.0.
128128
val info = makeStageInfo(1, 2, 3, 4L, 5L)
129129
assert(info.details.nonEmpty)
@@ -134,6 +134,16 @@ class JsonProtocolSuite extends FunSuite {
134134
assert("" === newInfo.details)
135135
}
136136

137+
test("InputMetrics backward compatibility") {
138+
// InputMetrics were added after 1.0.1.
139+
val metrics = makeTaskMetrics(1L, 2L, 3L, 4L, 5, 6, hasHdfsInput = true)
140+
assert(metrics.inputMetrics.nonEmpty)
141+
val newJson = JsonProtocol.taskMetricsToJson(metrics)
142+
val oldJson = newJson.removeField { case (field, _) => field == "Input Metrics" }
143+
val newMetrics = JsonProtocol.taskMetricsFromJson(oldJson)
144+
assert(newMetrics.inputMetrics.isEmpty)
145+
}
146+
137147

138148
/** -------------------------- *
139149
| Helper test running methods |

0 commit comments

Comments
 (0)