Skip to content

Commit

Permalink
Fixes skupperproject#1409: port remaining non-TLS TCP tests to tcp-li…
Browse files Browse the repository at this point in the history
…te adaptor

Closes skupperproject#1409
  • Loading branch information
kgiusti committed Feb 12, 2024
1 parent a2561cf commit c6ecc0a
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 19 deletions.
8 changes: 4 additions & 4 deletions src/adaptors/tcp_lite/tcp_lite.c
Original file line number Diff line number Diff line change
Expand Up @@ -781,13 +781,13 @@ static void link_setup_LSIDE_IO(tcplite_connection_t *conn)
static void link_setup_CSIDE_IO(tcplite_connection_t *conn, qdr_delivery_t *delivery)
{
ASSERT_RAW_IO;
qdr_terminus_t *target = qdr_terminus(0);
char host[64]; // for numeric remote server IP:port address

qdr_terminus_t *target = qdr_terminus(0);
qdr_terminus_set_address(target, conn->reply_to);

qd_raw_conn_get_address_buf(conn->raw_conn, host, sizeof(host));
conn->core_conn = TL_open_core_connection(conn->conn_id, false, host);
assert(conn->common.parent->context_type == TL_CONNECTOR);
const char *host = ((tcplite_connector_t *)conn->common.parent)->adaptor_config->host_port;
conn->core_conn = TL_open_core_connection(conn->conn_id, false, host);
qdr_connection_set_context(conn->core_conn, conn);

conn->inbound_link = qdr_link_first_attach(conn->core_conn, QD_INCOMING, qdr_terminus(0), target, "tcp.cside.in", 0, false, 0, &conn->inbound_link_id);
Expand Down
48 changes: 33 additions & 15 deletions tests/system_tests_tcp_adaptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1513,9 +1513,6 @@ class TcpAdaptorLite(TcpAdaptorBase, CommonTcpTests):
def setUpClass(cls):
super(TcpAdaptorLite, cls).setUpClass(test_ssl=False, encap="lite")

def test_90_stats(self):
self.skipTest("Temporarily disabling test_90_stats on TcpAdaptorLite")


class TcpAdaptorStuckDeliveryTest(TestCase):
"""
Expand Down Expand Up @@ -1958,9 +1955,10 @@ class TcpAdaptorListenerConnectTest(TestCase):
Test client connecting to TcpListeners in various scenarios
"""
@classmethod
def setUpClass(cls):
def setUpClass(cls, encap='legacy', test_name='TCPListenConnTest'):
super(TcpAdaptorListenerConnectTest, cls).setUpClass()

cls.encapsulation = encap
cls.test_name = 'TCPListenConnTest'

# 4 router linear deployment:
Expand Down Expand Up @@ -2029,14 +2027,16 @@ def test_01_no_service(self):
a_mgmt.create(type=TCP_LISTENER_TYPE,
name="ClientListener01",
attributes={'address': van_address,
'port': listener_port})
'port': listener_port,
'encapsulation': self.encapsulation})

b_mgmt = self.INTB.management
b_mgmt.create(type=TCP_CONNECTOR_TYPE,
name="ServerConnector01",
attributes={'address': van_address,
'host': '127.0.0.1',
'port': connector_port})
'port': connector_port,
'encapsulation': self.encapsulation})

self.INTA.wait_address(van_address, remotes=1)

Expand Down Expand Up @@ -2102,7 +2102,8 @@ def _test_listener_socket_lifecycle(self,
l_mgmt.create(type=TCP_LISTENER_TYPE,
name=listener_name,
attributes={'address': van_address,
'port': listener_port})
'port': listener_port,
'encapsulation': self.encapsulation})

# since there is no connector present, the operational state must be
# down and connection attempts must be refused
Expand All @@ -2129,7 +2130,8 @@ def _test_listener_socket_lifecycle(self,
name=connector_name,
attributes={'address': van_address,
'host': '127.0.0.1',
'port': connector_port})
'port': connector_port,
'encapsulation': self.encapsulation})

# let the connectors address propagate to listener router

Expand Down Expand Up @@ -2215,17 +2217,26 @@ def test_05_listener_edge_edge(self):
self._test_listener_socket_lifecycle(self.EdgeA, self.EdgeB, "test_05_listener_edge_edge")


class TcpDeleteConnectionTest(TestCase):
class TcpAdaptorListenerConnectLiteTest(TestCase):
"""
Test client connecting to TcpListeners in various scenarios
"""
@classmethod
def setUpClass(cls):
super(TcpAdaptorListenerConnectLiteTest, cls).setUpClass(encap='lite', test_name='TCPListenConnLiteTest')


class TcpDeleteConnectionTest(TestCase):
@classmethod
def setUpClass(cls, encap='legacy', test_name="TcpDeleteConnectionTest"):
super(TcpDeleteConnectionTest, cls).setUpClass()
cls.good_listener_port = cls.tester.get_port()
cls.server_logger = Logger(title="TcpDeleteConnectionTest",
cls.server_logger = Logger(title=test_name,
print_to_console=True,
save_for_dump=False,
ofilename=os.path.join(os.path.dirname(os.getcwd()),
"setUpClass/TcpAdaptor_echo_server_INTA.log"))
server_prefix = "ECHO_SERVER_TcpDeleteConnectionTest_INTA"
server_prefix = f"ECHO_SERVER_{test_name}_INTA"
cls.echo_server = TcpEchoServer(prefix=server_prefix,
port=0,
logger=cls.server_logger)
Expand All @@ -2242,20 +2253,21 @@ def setUpClass(cls):
'host': "localhost",
'port': cls.good_listener_port,
'address': 'ES_GOOD_CONNECTOR_CERT_INTA',
'siteId': "mySite"}),
'siteId': "mySite",
'encapsulation': encap}),

('tcpConnector',
{'name': "good-connector",
'host': "localhost",
'port': cls.echo_server.port,
'address': 'ES_GOOD_CONNECTOR_CERT_INTA',
'siteId': "mySite"}),
'siteId': "mySite",
'encapsulation': encap}),
('address', {'prefix': 'closest', 'distribution': 'closest'}),
('address', {'prefix': 'multicast', 'distribution': 'multicast'}),
]

cls.router = cls.tester.qdrouterd('TcpDeleteConnectionTest',
Qdrouterd.Config(config), wait=True)
cls.router = cls.tester.qdrouterd(test_name, Qdrouterd.Config(config), wait=True)
cls.address = cls.router.addresses[0]
wait_tcp_listeners_up(cls.router.addresses[0])

Expand Down Expand Up @@ -2290,6 +2302,12 @@ def check_connection_deleted():
client_conn.close()


class TcpDeleteConnectionLiteTest(TestCase):
@classmethod
def setUpClass(cls):
super(TcpDeleteConnectionLiteTest, cls).setUpClass(encap='lite', test_name="TcpDeleteConnectionLiteTest")


class TcpLegacyInvalidEncodingTest(TestCase):
"""
Ensure that the TCP adaptor can recover from receiving an improperly
Expand Down

0 comments on commit c6ecc0a

Please sign in to comment.