try to avoid race condition in other service updater test

This commit is contained in:
Thomas Waldmann 2014-08-31 17:36:47 +02:00
parent 8bf7474b67
commit 26c48ea93b

View File

@ -2,6 +2,8 @@
Tests for api package. Tests for api package.
""" """
import time
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from nsupdate.main.dnstools import query_ns, FQDN from nsupdate.main.dnstools import query_ns, FQDN
@ -123,6 +125,8 @@ def test_nic_update_authorized_update_other_services(client):
assert response.status_code == 200 assert response.status_code == 200
# must be good (was different IP) # must be good (was different IP)
assert response.content == b'good 1.2.3.4' assert response.content == b'good 1.2.3.4'
# test below was sometimes failing, give other service n seconds to process the update:
time.sleep(1.0)
# now check if it updated the other service also: # now check if it updated the other service also:
assert query_ns(TEST_HOST_OTHER, 'A') == '1.2.3.4' assert query_ns(TEST_HOST_OTHER, 'A') == '1.2.3.4'
response = client.get(reverse('nic_update') + '?myip=2.3.4.5', response = client.get(reverse('nic_update') + '?myip=2.3.4.5',