Skip to content
Snippets Groups Projects
Commit 23940473 authored by Shixiong Zhu's avatar Shixiong Zhu
Browse files

[SPARK-19050][SS][TESTS] Fix EventTimeWatermarkSuite 'delay in months and years handled correctly'

## What changes were proposed in this pull request?

`monthsSinceEpoch` in this test is like `math.floor(num)`, so `monthDiff` has two possible values.

## How was this patch tested?

Jenkins.

Author: Shixiong Zhu <shixiong@databricks.com>

Closes #16449 from zsxwing/watermark-test-hotfix.
parent 35e97407
No related branches found
No related tags found
No related merge requests found
......@@ -190,7 +190,10 @@ class EventTimeWatermarkSuite extends StreamTest with BeforeAndAfter with Loggin
assertEventStats { e =>
assert(timestampFormat.parse(e.get("max")).getTime === (currentTimeMs / 1000) * 1000)
val watermarkTime = timestampFormat.parse(e.get("watermark"))
assert(monthsSinceEpoch(currentTime) - monthsSinceEpoch(watermarkTime) === 29)
val monthDiff = monthsSinceEpoch(currentTime) - monthsSinceEpoch(watermarkTime)
// monthsSinceEpoch is like `math.floor(num)`, so monthDiff has two possible values.
assert(monthDiff === 29 || monthDiff === 30,
s"currentTime: $currentTime, watermarkTime: $watermarkTime")
}
)
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment