Fixed issue with ports checks
OSTF tests don't have direct access to VMs ports, we need to check availability of these ports from OpenStack controller nodes instead of Fuel master node. Change-Id: I90c4980cefb8fc650d1c2d2f4f92e98815bda98f Closes-Bug: #1495699
This commit is contained in:
parent
de91fb1611
commit
3b158d74b7
|
@ -16,7 +16,6 @@
|
|||
import contextlib
|
||||
import logging
|
||||
import os
|
||||
import socket
|
||||
import time
|
||||
import traceback
|
||||
import zipfile
|
||||
|
@ -359,16 +358,16 @@ class MuranoTest(fuel_health.nmanager.PlatformServicesBaseClass):
|
|||
return 'OK'
|
||||
|
||||
def check_port_access(self, ip, port):
|
||||
result = 1
|
||||
output = ''
|
||||
start_time = time.time()
|
||||
while time.time() - start_time < 600:
|
||||
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
result = sock.connect_ex((str(ip), port))
|
||||
sock.close()
|
||||
if result == 0:
|
||||
# Check VM port availability from controller node:
|
||||
output, err = self._run_ssh_cmd("nc -z {0} {1}; echo $?"
|
||||
.format(ip, port))
|
||||
if '0' in output:
|
||||
break
|
||||
time.sleep(5)
|
||||
self.assertEqual(0, result, '%s port is closed on instance' % port)
|
||||
self.assertIn('0', output, '%s port is closed on instance' % port)
|
||||
|
||||
def port_status_check(self, environment, configurations):
|
||||
"""Function which gives opportunity to check multiple instances
|
||||
|
@ -467,8 +466,8 @@ class MuranoTest(fuel_health.nmanager.PlatformServicesBaseClass):
|
|||
ip = self.get_ip_by_instance_name(environment, inst_name)
|
||||
else:
|
||||
ip = environment.services[0]['instance']['floatingIpAddress']
|
||||
resp = requests.get('http://{0}/{1}'.format(ip, path), verify=False)
|
||||
if resp.status_code == 200:
|
||||
pass
|
||||
else:
|
||||
uri = 'http://{0}/{1}'.format(ip, path)
|
||||
cmd = "curl --connect-timeout 1 --head {0}".format(uri)
|
||||
stdout, stderr = self._run_ssh_cmd(cmd)
|
||||
if '404' in stdout:
|
||||
self.fail("Service path unavailable")
|
||||
|
|
Loading…
Reference in New Issue