summaryrefslogtreecommitdiff
path: root/smoketest/scripts/cli/test_service_ssh.py
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-04-06 12:44:01 +0200
committerChristian Breunig <christian@breunig.cc>2024-04-06 12:51:18 +0200
commitd9d2e9c8ead29c173fefd1b565d191a85baaa071 (patch)
tree3d9f16a071e0a7f3367952783ad47a5a7ff4e482 /smoketest/scripts/cli/test_service_ssh.py
parent71786307eed6a0ebb42755f24c19dfd46b1b9696 (diff)
downloadvyos-1x-d9d2e9c8ead29c173fefd1b565d191a85baaa071.tar.gz
vyos-1x-d9d2e9c8ead29c173fefd1b565d191a85baaa071.zip
T6199: start validating smoketests against real CLI defaultValues
Use vyos.xml_ref.default_value to query XML default values and take them into account when validating properly applied defaults in individual smoketests instead of using hardcoded values like 443 for https port.
Diffstat (limited to 'smoketest/scripts/cli/test_service_ssh.py')
-rwxr-xr-xsmoketest/scripts/cli/test_service_ssh.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/smoketest/scripts/cli/test_service_ssh.py b/smoketest/scripts/cli/test_service_ssh.py
index 031897c26..b09990c92 100755
--- a/smoketest/scripts/cli/test_service_ssh.py
+++ b/smoketest/scripts/cli/test_service_ssh.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright (C) 2019-2022 VyOS maintainers and contributors
+# Copyright (C) 2019-2024 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
@@ -28,6 +28,7 @@ from vyos.utils.process import cmd
from vyos.utils.process import is_systemd_service_running
from vyos.utils.process import process_named_running
from vyos.utils.file import read_file
+from vyos.xml_ref import default_value
PROCESS_NAME = 'sshd'
SSHD_CONF = '/run/sshd/sshd_config'
@@ -78,9 +79,10 @@ class TestServiceSSH(VyOSUnitTestSHIM.TestCase):
# commit changes
self.cli_commit()
- # Check configured port
- port = get_config_value('Port')[0]
- self.assertEqual('22', port) # default value
+ # Check configured port agains CLI default value
+ port = get_config_value('Port')
+ cli_default = default_value(base_path + ['port'])
+ self.assertEqual(port, cli_default)
def test_ssh_single_listen_address(self):
# Check if SSH service can be configured and runs