Fix timestamp race occurring on fast systems

Since the subprocess is started before the reference timestamp is
created, it can happen that the check for the expiration field fails.

Traceback (most recent call last):
  File "/tmp/zuul/tests/unit/test_client.py", line 151, in test_token_generation
    (token['exp'], now))
  File "/tmp/zuul/.tox/py36/lib/python3.6/site-packages/unittest2/case.py", line 702, in assertTrue
    raise self.failureException(msg)
AssertionError: False is not true : (1568016146.9831738, 1568015546.1448617)

Change-Id: I9ef56c12ed1be2a6ec168c4a9363125919be44e9
This commit is contained in:
Simon Westphahl 2019-09-09 10:01:14 +02:00
parent fd09f6b479
commit 81dcf35e68
1 changed files with 1 additions and 1 deletions

View File

@ -147,5 +147,5 @@ class TestWebTokenClient(BaseClientTestCase):
admin_tenants = token.get('zuul', {}).get('admin', [])
self.assertTrue('tenant_one' in admin_tenants, admin_tenants)
# allow one minute for the process to run
self.assertTrue(600 <= int(token['exp']) - now < 660,
self.assertTrue(580 <= int(token['exp']) - now < 660,
(token['exp'], now))