CI: fix ipv6 test failed on some runners

This commit is contained in:
Chen Yudong
2022-12-14 15:58:49 +08:00
parent 627d03182a
commit df92048180
3 changed files with 37 additions and 13 deletions

View File

@@ -11,9 +11,9 @@ import socket
import sys
from threading import Event, Thread
import netifaces
import ttfw_idf
from common_test_methods import get_env_config_variable, get_host_ip_by_interface, get_my_interface_by_dest_ip
from common_test_methods import (get_env_config_variable, get_host_ip4_by_dest_ip, get_host_ip6_by_dest_ip,
get_my_interface_by_dest_ip)
# ----------- Config ----------
PORT = 3333
@@ -107,13 +107,13 @@ def test_examples_protocol_socket_tcpclient(env, extra_data):
my_interface = get_my_interface_by_dest_ip(ipv4)
# test IPv4
with TcpServer(PORT, socket.AF_INET):
server_ip = get_host_ip_by_interface(my_interface, netifaces.AF_INET)
server_ip = get_host_ip4_by_dest_ip(ipv4)
print('Connect tcp client to server IP={}'.format(server_ip))
dut1.write(server_ip)
dut1.expect(re.compile(r'OK: Message from ESP32'))
# test IPv6
with TcpServer(PORT, socket.AF_INET6):
server_ip = get_host_ip_by_interface(my_interface, netifaces.AF_INET6)
server_ip = get_host_ip6_by_dest_ip(ipv6, my_interface)
print('Connect tcp client to server IP={}'.format(server_ip))
dut1.write(server_ip)
dut1.expect(re.compile(r'OK: Message from ESP32'))