From aafed70cb2f12382823ee7d5adc78fec35048002 Mon Sep 17 00:00:00 2001 From: Christian Breunig Date: Mon, 29 May 2023 21:47:22 +0200 Subject: smoketest: adjust to new process_named_running() implementation After commit 9c677c81b ("vyos.util: extend process_named_running() signature with cmdline") we need an exact match for the process name. In the past we used a in b and now we test for a == b. --- smoketest/scripts/cli/test_service_dns_dynamic.py | 19 ++++++++----------- smoketest/scripts/cli/test_vpn_ipsec.py | 2 +- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/smoketest/scripts/cli/test_service_dns_dynamic.py b/smoketest/scripts/cli/test_service_dns_dynamic.py index a3aa41f94..4a3c05a36 100755 --- a/smoketest/scripts/cli/test_service_dns_dynamic.py +++ b/smoketest/scripts/cli/test_service_dns_dynamic.py @@ -22,11 +22,11 @@ from base_vyostest_shim import VyOSUnitTestSHIM from vyos.configsession import ConfigSessionError from vyos.util import cmd -from vyos.util import process_named_running +from vyos.util import process_running from vyos.util import read_file -PROCESS_NAME = 'ddclient' DDCLIENT_CONF = '/run/ddclient/ddclient.conf' +DDCLIENT_PID = '/run/ddclient/ddclient.pid' base_path = ['service', 'dns', 'dynamic'] hostname = 'test.ddns.vyos.io' @@ -40,10 +40,16 @@ def get_config_value(key): class TestServiceDDNS(VyOSUnitTestSHIM.TestCase): def tearDown(self): + # Check for running process + self.assertTrue(process_running(DDCLIENT_PID)) + # Delete DDNS configuration self.cli_delete(base_path) self.cli_commit() + # PID file must no londer exist after process exited + self.assertFalse(os.path.exists(DDCLIENT_PID)) + def test_dyndns_service(self): from itertools import product ddns = ['interface', interface, 'service'] @@ -101,9 +107,6 @@ class TestServiceDDNS(VyOSUnitTestSHIM.TestCase): self.assertTrue(login == user) self.assertTrue(pwd == "'" + password + "'") - # Check for running process - self.assertTrue(process_named_running(PROCESS_NAME)) - def test_dyndns_rfc2136(self): # Check if DDNS service can be configured and runs ddns = ['interface', interface, 'rfc2136', 'vyos'] @@ -131,9 +134,6 @@ class TestServiceDDNS(VyOSUnitTestSHIM.TestCase): # TODO: inspect generated configuration file - # Check for running process - self.assertTrue(process_named_running(PROCESS_NAME)) - def test_dyndns_ipv6(self): ddns = ['interface', interface, 'service', 'dynv6'] proto = 'dyndns2' @@ -151,9 +151,6 @@ class TestServiceDDNS(VyOSUnitTestSHIM.TestCase): # commit changes self.cli_commit() - # Check for running process - self.assertTrue(process_named_running(PROCESS_NAME)) - protocol = get_config_value('protocol') login = get_config_value('login') pwd = get_config_value('password') diff --git a/smoketest/scripts/cli/test_vpn_ipsec.py b/smoketest/scripts/cli/test_vpn_ipsec.py index b677f0e45..acb41e410 100755 --- a/smoketest/scripts/cli/test_vpn_ipsec.py +++ b/smoketest/scripts/cli/test_vpn_ipsec.py @@ -41,7 +41,7 @@ vif = '100' esp_group = 'MyESPGroup' ike_group = 'MyIKEGroup' secret = 'MYSECRETKEY' -PROCESS_NAME = 'charon' +PROCESS_NAME = 'charon-systemd' regex_uuid4 = '[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}' ca_pem = """ -- cgit v1.2.3