More attempts to fix testing of ipv6 too

Still failing on rawhide however.
This commit is contained in:
Petr Menšík 2023-07-24 01:11:59 +02:00
parent 6d0c796dd2
commit a63a0cc85d
3 changed files with 25 additions and 16 deletions

View File

@ -59,6 +59,10 @@ class GenericUtilities():
log_file=DHCPCD_LOG_FILE + '.' + conf
subprocess.check_output(['dhcpcd', '-4', '-M', '-d', '--logfile', log_file, '-f', conf_file, 'veth-test'])
def StopDhcpcd(self, conf):
""" Stop dhcpcd """
subprocess.check_output(['dhcpcd', '-x', 'veth-test'])
def StopDaemon(self, pid_file):
with open(pid_file, 'r') as f:
@ -123,6 +127,7 @@ class DhcpcdTests(unittest.TestCase, GenericUtilities):
self.pid_file = subprocess.check_output(['dhcpcd', '--printpidfile']).rstrip().decode('utf-8')
def tearDown(self):
#self.StopDhcpcd()
self.StopDaemon(self.pid_file)
self.StopDaemon(DNSMASQ_PID_FILE)
@ -184,10 +189,11 @@ class DhcpcdTests(unittest.TestCase, GenericUtilities):
output=subprocess.check_output(['dhcpcd','-U', '-4', 'veth-test'], stderr=subprocess.STDOUT).rstrip().decode('utf-8')
self.assertRegex(output, 'interface_mtu=1492')
@unittest.skip("Known to be failing")
def test_dhcpcd_clientid_vendorclassid_userclass(self):
""" verify dhcpcd sends custom clientid vendor class id and userclass """
self.skipTest('Known to be failing')
self.debug()
self.StartDnsMasq('dnsmasq-vendorclass.conf')
time.sleep(1)

View File

@ -20,7 +20,7 @@ import socket
from pyroute2 import IPRoute
DHCPCD_CI_DIR="/var/run/dhcpcd-ci"
DHCPCD_LOG_FILE='/var/run/dhcpcd-ci/dhcpcd-test-log'
DHCPCD_LOG_FILE='/var/run/dhcpcd-ci/dhcpcd-test.log'
DHCPCD_CONF_FILE='/var/run/dhcpcd-ci/dhcpcd-test.conf'
DHCPCD_PID_FILE='/var/run/dhcpcd.pid'
@ -38,12 +38,9 @@ RESOLVE_CONF='/etc/resolv.conf'
def setUpModule():
"""Initialize the environment, and perform sanity checks on it."""
if shutil.which('dhcpcd') is None:
raise OSError(errno.ENOENT, 'dhcpcd not found')
if shutil.which('dhcp6s') is None:
raise OSError(errno.ENOENT, 'dhcdp6s not found')
if shutil.which('radvd') is None:
raise OSError(errno.ENOENT, 'radvd not found')
for tool in ['dhcpcd', 'dhcp6s', 'radvd']:
if shutil.which(tool) is None:
raise OSError(errno.ENOENT, tool+' not found')
def tearDownModule():
pass
@ -72,6 +69,12 @@ class GenericUtilities():
os.remove(pid_file)
def StopDaemonOptional(self, pid_file):
try:
self.StopDaemon(pid_file)
except FileNotFoundError:
pass
def WriteConfigFile(self, path, contents):
"""Write a config file, and queue it to be removed."""
@ -116,12 +119,13 @@ class DhcpcdTests(unittest.TestCase, GenericUtilities):
def setUp(self):
""" setup veth and write radvd and dhcpv6configs """
self.pid_file = subprocess.check_output(['dhcpcd', '--printpidfile']).rstrip().decode('utf-8')
self.SetupVethInterface()
def tearDown(self):
self.StopDaemon(DHCPCD_PID_FILE)
self.StopDaemon(RADVD_PID_FILE)
self.StopDaemon(DHCP6S_PID_FILE)
self.StopDaemon(self.pid_file)
self.StopDaemonOptional(RADVD_PID_FILE)
self.StopDaemonOptional(DHCP6S_PID_FILE)
self.TearDownVethInterface()

View File

@ -28,27 +28,26 @@ rlJournalStart
rlFileBackup "$RESOLVE_CONF"
rlFileBackup "$DHCPCD_DUID_FILE"
rlRun "[ -e /sys/class/net/veth-test ] && ip link del veth-test" 0,1
rlRun "TESTDIR=$(pwd)"
rlLog "Create work dir ..."
rlRun "mkdir -p $DHCPCD_CI_DIR"
rlRun "cp *.conf $DHCPCD_CI_DIR"
rlRun "cp dhcpcd-tests.py /usr/bin/"
rlPhaseEnd
rlPhaseStartTest
rlLog "Starting dhcpcd tests ..."
rlRun "/usr/bin/python3 /usr/bin/dhcpcd-tests.py"
rlRun "/usr/bin/python3 ${TESTDIR}/dhcpcd-tests.py"
rlPhaseEnd
rlPhaseStartCleanup
rlRun "rm /usr/bin/dhcpcd-tests.py"
rlRun "[ -e /sys/class/net/veth-test ] && ip link del veth-test" 0,1
rlFileRestore
rlBundleLogs dhcpcd-ci ${DHCPCD_CI_DIR}/*log*
rlLog "remove work dir"
rlRun "rm -rf $DHCPCD_CI_DIR"
#rlRun "rm -rf $DHCPCD_CI_DIR"
rlRun "setenforce 1" 0,1
rlLog "dhcpcd tests done"