Skip to content

Commit 9432f48

Browse files
authored
Fixing test flakyness by switching to mocked time (#6503)
TestContextSuite/TestTimerMaxReadLevel is extremely flaky in github. Unfortunately we can't switch to mocker timer as lots of tests rely on it.
1 parent 040713d commit 9432f48

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

service/history/shard/context_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import (
3838

3939
"github.com/uber/cadence/common"
4040
"github.com/uber/cadence/common/cache"
41+
"github.com/uber/cadence/common/clock"
4142
"github.com/uber/cadence/common/cluster"
4243
"github.com/uber/cadence/common/log"
4344
"github.com/uber/cadence/common/log/testlogger"
@@ -287,6 +288,9 @@ func (s *contextTestSuite) TestDomainNotificationVersion() {
287288
}
288289

289290
func (s *contextTestSuite) TestTimerMaxReadLevel() {
291+
// this test requires mocked time since we're comparing timestamps
292+
s.mockResource.TimeSource = clock.NewMockedTimeSource()
293+
290294
// get current cluster's level
291295
gotLevel := s.context.UpdateTimerMaxReadLevel(cluster.TestCurrentClusterName)
292296
wantLevel := s.mockResource.TimeSource.Now().Add(s.context.config.TimerProcessorMaxTimeShift()).Truncate(time.Millisecond)

0 commit comments

Comments
 (0)