summaryrefslogtreecommitdiff
path: root/src/tests/test_utils_network.py
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@vyos.io>2025-05-06 15:18:45 +0100
committerGitHub <noreply@github.com>2025-05-06 15:18:45 +0100
commita0805e37e1f3935cb1cb016082797b4e664bb920 (patch)
tree04596a066353084bc8920cf6a1e99a5bf830698a /src/tests/test_utils_network.py
parent1142072141a73596fc8aa0822e8893274632f202 (diff)
parentf40cf6064a02fbb6baae924e94b9183d6bd87474 (diff)
downloadvyos-1x-a0805e37e1f3935cb1cb016082797b4e664bb920.tar.gz
vyos-1x-a0805e37e1f3935cb1cb016082797b4e664bb920.zip
Merge pull request #4480 from c-po/T7122-pki
T7122: pki: unable to switch from custom cert to ACME when HAProxy service is running with 'redirect-http-to-https' option
Diffstat (limited to 'src/tests/test_utils_network.py')
-rw-r--r--src/tests/test_utils_network.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/tests/test_utils_network.py b/src/tests/test_utils_network.py
index d68dec16f..92fde447d 100644
--- a/src/tests/test_utils_network.py
+++ b/src/tests/test_utils_network.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2020-2024 VyOS maintainers and contributors
+# Copyright (C) 2020-2025 VyOS maintainers and contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
@@ -43,3 +43,12 @@ class TestVyOSUtilsNetwork(TestCase):
self.assertFalse(vyos.utils.network.is_loopback_addr('::2'))
self.assertFalse(vyos.utils.network.is_loopback_addr('192.0.2.1'))
+
+ def test_check_port_availability(self):
+ self.assertTrue(vyos.utils.network.check_port_availability('::1', 8080))
+ self.assertTrue(vyos.utils.network.check_port_availability('127.0.0.1', 8080))
+ self.assertTrue(vyos.utils.network.check_port_availability(None, 8080, protocol='udp'))
+ # We do not have 192.0.2.1 configured on this system
+ self.assertFalse(vyos.utils.network.check_port_availability('192.0.2.1', 443))
+ # We do not have 2001:db8::1 configured on this system
+ self.assertFalse(vyos.utils.network.check_port_availability('2001:db8::1', 80, protocol='udp'))