summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjose.lausuch <jose.lausuch@ericsson.com>2017-02-24 13:08:57 +0100
committerJose Lausuch <jose.lausuch@ericsson.com>2017-02-24 17:14:41 +0000
commit7368f5c372d47169f63704fa75f070e62e8a0a81 (patch)
treeb5809b83f2dcecf7538e0f50e12ac86cb1a04258
parentc613af85630307c1c50ccd109d8c4efae5f0265b (diff)
Improve way to check instances getting an IP
JIRA: SNAPS-33 Change-Id: I7f8e0ff80da97f6be6df21b20e0a878f2fc18636 Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
-rw-r--r--snaps/openstack/tests/create_instance_tests.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/snaps/openstack/tests/create_instance_tests.py b/snaps/openstack/tests/create_instance_tests.py
index 756b45f..ccdf45e 100644
--- 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
+import re
import time
import unittest
import uuid
@@ -311,15 +312,22 @@ class SimpleHealthCheck(OSIntegrationTestCase):
self.assertTrue(self.inst_creator.vm_active(block=True))
found = False
- timeout = 100
+ timeout = 160
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()
- 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
+
self.assertTrue(found)