client/tests: drop unnecessary socket.set_inheritable() call from "test-client.py"

This seems unnecessary, because we spawn the child process via subprocess.Popen and
set "pass_fds". That already ensures to pass on the FD.

Worse, socket.set_inheritable() is only added in Python 3.4, that means the
test is gonna break for Python 3.2 and 3.3. Just avoid that by not using the
unnecessary function. For the same reason, drop "inheritable=True" from
os.dup2(). "inheritable=True" is already the default, but only exists
since Python 3.4.

Fixes: d89d42bf23 ('tests/client: test nm-cloud-setup')
This commit is contained in:
Thomas Haller
2023-03-30 14:55:36 +02:00
parent 15c25e91f5
commit a9558231cf

View File

@@ -2151,7 +2151,6 @@ class TestNmCloudSetup(TestNmClient):
raise unittest.SkipTest("This test requires at least Python 3.2")
s = socket.socket()
s.set_inheritable(True)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)
s.bind(("localhost", 0))
@@ -2162,7 +2161,7 @@ class TestNmCloudSetup(TestNmClient):
s.listen(5)
def pass_socket():
os.dup2(s.fileno(), 3, inheritable=True)
os.dup2(s.fileno(), 3)
service_path = PathConfiguration.test_cloud_meta_mock_path()
env = os.environ.copy()