@@ -1306,3 +1306,76 @@ func (s *mutableStateSuite) TestWrapTimeSourceWithTimeSkipping() {
13061306 s .Equal (fixedBase .Add (skipped ), event .GetEventTime ().AsTime ())
13071307 })
13081308}
1309+
1310+ func (s * mutableStateSuite ) TestTimeSkippingInfoUtil () {
1311+ s .Run ("NilTSISafe" , func () {
1312+ util := NewTimeSkippingInfoUtil (nil )
1313+ s .False (util .HasPendingFastForward ())
1314+ s .False (util .IsEnabled ())
1315+ })
1316+
1317+ s .Run ("NilFFISafe" , func () {
1318+ s .mutableState .executionInfo .TimeSkippingInfo = & persistencespb.TimeSkippingInfo {
1319+ Config : & commonpb.TimeSkippingConfig {Enabled : true },
1320+ FastForwardInfo : nil ,
1321+ }
1322+ util := NewTimeSkippingInfoUtil (s .mutableState .executionInfo .TimeSkippingInfo )
1323+ s .False (util .HasPendingFastForward ())
1324+ })
1325+
1326+ s .Run ("NoPendingFastForwardWhenHasReached" , func () {
1327+ s .mutableState .executionInfo .TimeSkippingInfo = & persistencespb.TimeSkippingInfo {
1328+ Config : & commonpb.TimeSkippingConfig {Enabled : true },
1329+ FastForwardInfo : & persistencespb.FastForwardInfo {
1330+ HasReached : true ,
1331+ TargetTime : timestamppb .New (time .Now ()),
1332+ LastUpdateVersionedTransition : & persistencespb.VersionedTransition {
1333+ TransitionCount : 1 ,
1334+ NamespaceFailoverVersion : 1 ,
1335+ },
1336+ },
1337+ }
1338+ util := NewTimeSkippingInfoUtil (s .mutableState .executionInfo .TimeSkippingInfo )
1339+ s .False (util .HasPendingFastForward ())
1340+ })
1341+
1342+ s .Run ("NoPendingFastForwardWhenDisabled" , func () {
1343+ s .mutableState .executionInfo .TimeSkippingInfo = & persistencespb.TimeSkippingInfo {
1344+ Config : & commonpb.TimeSkippingConfig {Enabled : false },
1345+ FastForwardInfo : & persistencespb.FastForwardInfo {
1346+ HasReached : false ,
1347+ TargetTime : timestamppb .New (time .Now ()),
1348+ LastUpdateVersionedTransition : & persistencespb.VersionedTransition {
1349+ TransitionCount : 1 ,
1350+ NamespaceFailoverVersion : 1 ,
1351+ },
1352+ },
1353+ }
1354+ util := NewTimeSkippingInfoUtil (s .mutableState .executionInfo .TimeSkippingInfo )
1355+ s .False (util .HasPendingFastForward ())
1356+ })
1357+
1358+ s .Run ("HasPendingFastForward" , func () {
1359+ s .mutableState .executionInfo .TimeSkippingInfo = & persistencespb.TimeSkippingInfo {
1360+ Config : & commonpb.TimeSkippingConfig {Enabled : true },
1361+ FastForwardInfo : & persistencespb.FastForwardInfo {
1362+ HasReached : false ,
1363+ TargetTime : timestamppb .New (time .Now ()),
1364+ LastUpdateVersionedTransition : & persistencespb.VersionedTransition {
1365+ TransitionCount : 1 ,
1366+ NamespaceFailoverVersion : 1 ,
1367+ },
1368+ },
1369+ }
1370+ util := NewTimeSkippingInfoUtil (s .mutableState .executionInfo .TimeSkippingInfo )
1371+ s .True (util .HasPendingFastForward ())
1372+ })
1373+
1374+ s .Run ("IsEnabled" , func () {
1375+ s .mutableState .executionInfo .TimeSkippingInfo = & persistencespb.TimeSkippingInfo {
1376+ Config : & commonpb.TimeSkippingConfig {Enabled : true },
1377+ }
1378+ util := NewTimeSkippingInfoUtil (s .mutableState .executionInfo .TimeSkippingInfo )
1379+ s .True (util .IsEnabled ())
1380+ })
1381+ }
0 commit comments