[SERVER-26662] Mock the current time for network_interface_asio_test Created: 17/Oct/16  Updated: 31/Oct/16  Resolved: 26/Oct/16

Status: Closed
Project: Core Server
Component/s: Networking
Affects Version/s: None
Fix Version/s: 3.4.0-rc2

Type: Bug Priority: Major - P3
Reporter: Matt Cotter Assignee: Matt Cotter
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Platforms 2016-10-31
Participants:
Linked BF Score: 0

 Description   

Right now, NetworkInterfaceASIO::now() relies on Date_t::now(). For our tests, we rely on having a precise control on time (e.g. see AsyncOpTimeout test). However, before we start a timer, NIA alters the timeout to reflect the amount of time that passed since starting the connection. When looking at an unstable wall clock, this can cause a hang when the test expects advancing time by exactly 1001ms to always cancel an operation that had a timeout of 1000ms.

The solution is to add a ::now() method to the async timer factory interface.



 Comments   
Comment by Githook User [ 26/Oct/16 ]

Author:

{u'username': u'Machyne', u'name': u'Matt Cotter', u'email': u'matt.cotter@mongodb.com'}

Message: SERVER-26662 NIA gets time from timer factory

This way when the timer factory is mocked, the network interface's `now`
method can reflect the mocked time. This fixes a hang in the network
interface asio unit test.
Branch: master
https://github.com/mongodb/mongo/commit/66819ed41e3583c3a9cfd495de9040583581290f

Generated at Thu Feb 08 04:12:48 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.