Check for None or timestamp in availability zone api sample
test_availability_zone_detail depends on the services not having an updated_at time set in the database. This is set by a periodic task so it's not guaranteed to be set, or not, shortly after the service starts. On a fast system the test reliably passes, but adding a delay causes the test to start failing. Introducing a time.sleep(5) in the test seems to make it reliably fail for me. The test should pass if updated_at is set to None or a timestamp. Change-Id: I976ddf5354a52ca06a6419a92abcacb7d2379a37 Closes-bug: 1300810
This commit is contained in:
parent
3265368d73
commit
a70308a471
@ -266,12 +266,14 @@ class ApiSampleTestBase(integrated_helpers._IntegratedTestBase):
|
||||
text = r'(\\"|[^"])*'
|
||||
else:
|
||||
text = r'[^<]*'
|
||||
# NOTE(treinish): Could result in a false positive, but it
|
||||
# shouldn't be an issue for this case.
|
||||
timestamp_re = ('\d{4}-[0,1]\d-[0-3]\d[ ,T]'
|
||||
'\d{2}:\d{2}:\d{2}'
|
||||
'(Z|(\+|-)\d{2}:\d{2}|\.\d{6}|)')
|
||||
return {
|
||||
# NOTE(treinish): Could result in a false positive, but it
|
||||
# shouldn't be an issue for this case.
|
||||
'timestamp': '\d{4}-[0,1]\d-[0-3]\d[ ,T]'
|
||||
'\d{2}:\d{2}:\d{2}'
|
||||
'(Z|(\+|-)\d{2}:\d{2}|\.\d{6}|)',
|
||||
'timestamp': timestamp_re,
|
||||
'timestamp_or_none': r'None|%s' % timestamp_re,
|
||||
'password': '[0-9a-zA-Z]{1,12}',
|
||||
'ip': '[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}',
|
||||
'ip6': '([0-9a-zA-Z]{1,4}:){1,7}:?[0-9a-zA-Z]{1,4}',
|
||||
|
@ -6,42 +6,42 @@
|
||||
"nova-consoleauth": {
|
||||
"active": true,
|
||||
"available": true,
|
||||
"updated_at": null
|
||||
"updated_at": %(timestamp_or_none)s
|
||||
}
|
||||
},
|
||||
"cert": {
|
||||
"nova-cert": {
|
||||
"active": true,
|
||||
"available": true,
|
||||
"updated_at": null
|
||||
"updated_at": %(timestamp_or_none)s
|
||||
}
|
||||
},
|
||||
"conductor": {
|
||||
"nova-conductor": {
|
||||
"active": true,
|
||||
"available": true,
|
||||
"updated_at": null
|
||||
"updated_at": %(timestamp_or_none)s
|
||||
}
|
||||
},
|
||||
"cells": {
|
||||
"nova-cells": {
|
||||
"active": true,
|
||||
"available": true,
|
||||
"updated_at": null
|
||||
"updated_at": %(timestamp_or_none)s
|
||||
}
|
||||
},
|
||||
"scheduler": {
|
||||
"nova-scheduler": {
|
||||
"active": true,
|
||||
"available": true,
|
||||
"updated_at": null
|
||||
"updated_at": %(timestamp_or_none)s
|
||||
}
|
||||
},
|
||||
"network": {
|
||||
"nova-network": {
|
||||
"active": true,
|
||||
"available": true,
|
||||
"updated_at": null
|
||||
"updated_at": %(timestamp_or_none)s
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -56,7 +56,7 @@
|
||||
"nova-compute": {
|
||||
"active": true,
|
||||
"available": true,
|
||||
"updated_at": null
|
||||
"updated_at": %(timestamp_or_none)s
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -41,7 +41,8 @@ class AvailabilityZoneJsonTest(test_servers.ServersSampleBase):
|
||||
|
||||
def test_availability_zone_detail(self):
|
||||
response = self._do_get('os-availability-zone/detail')
|
||||
self._verify_response('availability-zone-detail-resp', {}, response,
|
||||
subs = self._get_regexes()
|
||||
self._verify_response('availability-zone-detail-resp', subs, response,
|
||||
200)
|
||||
|
||||
def test_availability_zone_post(self):
|
||||
|
Loading…
Reference in New Issue
Block a user