Skip to content

Commit

Permalink
Fixing test flakyness by switching to mocked time (cadence-workflow#6503
Browse files Browse the repository at this point in the history
)

TestContextSuite/TestTimerMaxReadLevel is extremely flaky in github.
Unfortunately we can't switch to mocker timer as lots of tests rely on
it.
  • Loading branch information
dkrotx authored Nov 18, 2024
1 parent 040713d commit 9432f48
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions service/history/shard/context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import (

"github.com/uber/cadence/common"
"github.com/uber/cadence/common/cache"
"github.com/uber/cadence/common/clock"
"github.com/uber/cadence/common/cluster"
"github.com/uber/cadence/common/log"
"github.com/uber/cadence/common/log/testlogger"
Expand Down Expand Up @@ -287,6 +288,9 @@ func (s *contextTestSuite) TestDomainNotificationVersion() {
}

func (s *contextTestSuite) TestTimerMaxReadLevel() {
// this test requires mocked time since we're comparing timestamps
s.mockResource.TimeSource = clock.NewMockedTimeSource()

// get current cluster's level
gotLevel := s.context.UpdateTimerMaxReadLevel(cluster.TestCurrentClusterName)
wantLevel := s.mockResource.TimeSource.Now().Add(s.context.config.TimerProcessorMaxTimeShift()).Truncate(time.Millisecond)
Expand Down

0 comments on commit 9432f48

Please sign in to comment.