Code Review
/
snaps.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Improve way to check instances getting an IP
[snaps.git]
/
snaps
/
openstack
/
tests
/
create_instance_tests.py
diff --git
a/snaps/openstack/tests/create_instance_tests.py
b/snaps/openstack/tests/create_instance_tests.py
index
756b45f
..
ccdf45e
100644
(file)
--- a/
snaps/openstack/tests/create_instance_tests.py
+++ b/
snaps/openstack/tests/create_instance_tests.py
@@
-14,6
+14,7
@@
# limitations under the License.
import logging
import os
# limitations under the License.
import logging
import os
+import re
import time
import unittest
import uuid
import time
import unittest
import uuid
@@
-311,15
+312,22
@@
class SimpleHealthCheck(OSIntegrationTestCase):
self.assertTrue(self.inst_creator.vm_active(block=True))
found = False
self.assertTrue(self.inst_creator.vm_active(block=True))
found = False
- timeout = 1
0
0
+ timeout = 1
6
0
start_time = time.time()
start_time = time.time()
- match_value = 'Lease of
' + ip + ' obtained,
'
+ match_value = 'Lease of
.*obtained
'
+ logger.info("Looking for expression %s in the console log" % match_value)
while timeout > time.time() - start_time:
output = vm.get_console_output()
while timeout > time.time() - start_time:
output = vm.get_console_output()
- if match_value in output:
- found = True
+ if re.search(match_value, output):
+ logger.info('DHCP lease obtained logged in console')
+ if ip in output:
+ logger.info('With correct IP address')
+ found = True
+ else:
+ logger.error('With incorrect IP address')
break
break
+
self.assertTrue(found)
self.assertTrue(found)