Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP7:GA
salt.25403
fix-crash-when-calling-manage.not_alive-runners...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File fix-crash-when-calling-manage.not_alive-runners.patch of Package salt.25403
From 3ecb98a9bd7a8d35cff6d0a5f34b7fea96f89da7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Su=C3=A1rez=20Hern=C3=A1ndez?= <psuarezhernandez@suse.com> Date: Fri, 8 Oct 2021 12:47:53 +0100 Subject: [PATCH] Fix crash when calling manage.not_alive runners Fix unit tests for netlink_tool_remote_on Drop wrong test --- salt/utils/network.py | 1 + tests/unit/utils/test_network.py | 17 ++++------------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/salt/utils/network.py b/salt/utils/network.py index 0dd20c5599..f0f5f1e8ce 100644 --- a/salt/utils/network.py +++ b/salt/utils/network.py @@ -1701,6 +1701,7 @@ def _netlink_tool_remote_on(port, which_end): elif "ESTAB" not in line: continue chunks = line.split() + local_host, local_port = chunks[3].rsplit(":", 1) remote_host, remote_port = chunks[4].rsplit(":", 1) if which_end == "remote_port" and int(remote_port) != int(port): diff --git a/tests/unit/utils/test_network.py b/tests/unit/utils/test_network.py index 637d5e9811..3060aba0aa 100644 --- a/tests/unit/utils/test_network.py +++ b/tests/unit/utils/test_network.py @@ -110,18 +110,14 @@ USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDRESS salt-master python2.781106 35 tcp4 127.0.0.1:61115 127.0.0.1:4506 """ -NETLINK_SS = """ -State Recv-Q Send-Q Local Address:Port Peer Address:Port -ESTAB 0 0 127.0.0.1:56726 127.0.0.1:4505 -ESTAB 0 0 ::ffff:1.2.3.4:5678 ::ffff:1.2.3.4:4505 -""" - LINUX_NETLINK_SS_OUTPUT = """\ State Recv-Q Send-Q Local Address:Port Peer Address:Port TIME-WAIT 0 0 [::1]:8009 [::1]:40368 LISTEN 0 128 127.0.0.1:5903 0.0.0.0:* ESTAB 0 0 [::ffff:127.0.0.1]:4506 [::ffff:127.0.0.1]:32315 ESTAB 0 0 192.168.122.1:4506 192.168.122.177:24545 +ESTAB 0 0 127.0.0.1:56726 127.0.0.1:4505 +ESTAB 0 0 ::ffff:1.2.3.4:5678 ::ffff:1.2.3.4:4505 """ IPV4_SUBNETS = { @@ -633,11 +629,11 @@ class NetworkTestCase(TestCase): with patch( "subprocess.check_output", return_value=LINUX_NETLINK_SS_OUTPUT ): - remotes = network._netlink_tool_remote_on("4506", "local") + remotes = network._netlink_tool_remote_on("4506", "local_port") self.assertEqual(remotes, {"192.168.122.177", "::ffff:127.0.0.1"}) def test_netlink_tool_remote_on_b(self): - with patch("subprocess.check_output", return_value=NETLINK_SS): + with patch("subprocess.check_output", return_value=LINUX_NETLINK_SS_OUTPUT): remotes = network._netlink_tool_remote_on("4505", "remote_port") self.assertEqual(remotes, {"127.0.0.1", "::ffff:1.2.3.4"}) @@ -1274,11 +1270,6 @@ class NetworkTestCase(TestCase): ): self.assertEqual(network.get_fqhostname(), host) - def test_netlink_tool_remote_on(self): - with patch("subprocess.check_output", return_value=NETLINK_SS): - remotes = network._netlink_tool_remote_on("4505", "remote") - self.assertEqual(remotes, {"127.0.0.1", "::ffff:1.2.3.4"}) - def test_is_fqdn(self): """ Test is_fqdn function passes possible FQDN names. -- 2.33.0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor