diff --git a/microsoft/testsuites/core/timesync.py b/microsoft/testsuites/core/timesync.py index 3a5c93021b..e751558501 100644 --- a/microsoft/testsuites/core/timesync.py +++ b/microsoft/testsuites/core/timesync.py @@ -24,8 +24,10 @@ from lisa.operating_system import BSD, CpuArchitecture, Redhat, Suse, Windows from lisa.tools import ( Cat, + Chmod, Chrony, Dmesg, + Echo, Hwclock, Ls, Lscpu, @@ -414,6 +416,17 @@ def verify_timesync_ntp(self, node: Node) -> None: priority=2, ) def verify_timesync_chrony(self, node: Node) -> None: + # On FreeBSD images, Chrony is not enabled by default after installation. + # To enabled it the line chronyd_enable=YES must be added to /etc/rc.conf. + if isinstance(node.os, BSD): + chmod = node.tools[Chmod] + echo = node.tools[Echo] + chmod.chmod("/etc/rc.conf", "+x", sudo=True) + echo.write_to_file( + value="chronyd_enable=YES", + file=PurePosixPath("/etc/rc.conf"), + sudo=True, + ) chrony = node.tools[Chrony] # 1. Restart chrony service. chrony.restart()