@pytest.mark.execute_serially
@CustomClusterTestSuite.with_args()
def test_webserver_interface(self):
    addrs = psutil.net_if_addrs()
    print(('net_if_addrs returned: %s' % addrs))
    ip_matcher = re.compile('\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}')
    ip_addrs = []
    for addr in addrs:
        for snic in addrs[addr]:
            if ip_matcher.match(snic.address):
                ip_addrs.append(snic.address)
    assert (len(ip_addrs) > 0), addrs
    ports = ['25000', '25010', '25020']
    for ip in ip_addrs:
        for port in ports:
            response = requests.get(('http://%s:%s/' % (ip, port)))
            assert (response.status_code == requests.codes.ok), ip
    interface = random.choice(ip_addrs)
    self._start_impala_cluster([('--impalad_args=--webserver_interface=%s' % interface)])
    for ip in ip_addrs:
        try:
            response = requests.get(('http://%s:25000/' % ip))
            assert (ip == interface)
            assert (response.status_code == requests.codes.ok), ip
        except requests.exceptions.ConnectionError:
            assert (ip != interface)
@pytest.mark.execute_serially
@CustomClusterTestSuite.with_args()
def test_webserver_interface(self):
    addrs = psutil.net_if_addrs()
    print(('net_if_addrs returned: %s' % addrs))
    ip_matcher = re.compile('\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}')
    ip_addrs = []
    for addr in addrs:
        for snic in addrs[addr]:
            if ip_matcher.match(snic.address):
                ip_addrs.append(snic.address)
    assert (len(ip_addrs) > 0), addrs
    ports = ['25000', '25010', '25020']
    for ip in ip_addrs:
        for port in ports:
            response = requests.get(('http://%s:%s/' % (ip, port)))
            assert (response.status_code == requests.codes.ok), ip
    interface = random.choice(ip_addrs)
    self._start_impala_cluster([('--impalad_args=--webserver_interface=%s' % interface)])
    for ip in ip_addrs:
        try:
            response = requests.get(('http://%s:25000/' % ip))
            assert (ip == interface)
            assert (response.status_code == requests.codes.ok), ip
        except requests.exceptions.ConnectionError:
            assert (ip != interface)