Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Commit

Permalink
test: fix timing issue in last connect test
Browse files Browse the repository at this point in the history
Occasionally a timing issue will prevent the last_connect test
from updating in time. Wait a more reasonable duration for the
database to update.
  • Loading branch information
bbangert committed Mar 10, 2016
1 parent a8e463a commit c4039df
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion autopush/tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,9 @@ def ack(self, channel, version):
def disconnect(self):
self.ws.close()

def sleep(self, duration):
time.sleep(duration)


class IntegrationBase(unittest.TestCase):
track_objects = True
Expand Down Expand Up @@ -539,7 +542,15 @@ def test_basic_last_connect(self):
yield client.connect()
yield client.hello()
yield client.disconnect()
c = yield deferToThread(self._settings.router.get_uaid, client.uaid)
times = 0
while times < 10:
c = yield deferToThread(self._settings.router.get_uaid,
client.uaid)
if has_connected_this_month(c):
break
else: # pragma: nocover
times += 1
yield client.sleep(1)
log.debug("Last connected time: %s", c.get("last_connect", "None"))
eq_(True, has_connected_this_month(c))

Expand Down

0 comments on commit c4039df

Please sign in to comment.