Add chrony NTP synchronization test (New) - #2811
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2811 +/- ##
==========================================
+ Coverage 61.29% 61.34% +0.04%
==========================================
Files 498 499 +1
Lines 50275 50338 +63
Branches 8834 8838 +4
==========================================
+ Hits 30817 30880 +63
Misses 18616 18616
Partials 842 842
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds a chrony-based replacement for the existing NTP synchronization test in the base provider, updating job definitions so the networking/ntp coverage can work on Ubuntu releases where chrony has replaced systemd-timesyncd.
Changes:
- Replace
networking/ntpjob command to use a newnetwork_ntp_chrony_test.pychrony-driven implementation. - Update networking + dock job requirements to require the
chronypackage. - Adjust packaging metadata to add chrony as the Ubuntu dependency for networking tests (currently only for
>= 25.10).
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| providers/base/units/networking/packaging.pxu | Switch Ubuntu packaging dependency from ntpdate/ntpsec-ntpdate to chrony for >= 25.10. |
| providers/base/units/networking/jobs.pxu | Update networking/ntp job to require chrony and run the new chrony-based script. |
| providers/base/units/dock/jobs.pxu | Update dock NTP jobs to require chrony and run the new chrony-based script. |
| providers/base/bin/network_ntp_chrony_test.py | New chrony-driven implementation that skews time by 1 hour, resyncs via configured sources, and verifies recovery. |
Suppressed comments (1)
providers/base/units/dock/jobs.pxu:2686
- This dock NTP job still declares estimated_duration: 10s, but the new chrony script’s default --timeout is 60s (and can legitimately take close to that). The estimate should be updated to avoid misleading scheduling/UX for long-running tests.
package.name == 'chrony'
user: root
command: network_ntp_chrony_test.py
estimated_duration: 10.00
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
@JasonLeonnn Please provide the submission test result |
tomli380576
left a comment
There was a problem hiding this comment.
sry just 1 more small comment
| networking/ntp-chrony | ||
| after-suspend-networking/ntp-chrony |
There was a problem hiding this comment.
-
I understand that there may be a reason why
networking/ntpandafter-suspend-networking/ntpare excluded from the Ubuntu Core 26 test plan, but I don’t think that alone is sufficient justification for excludingnetworking/ntp-chronyas well. -
What I’d like to clarify is whether the current Ubuntu Core 26 environment has also deprecated
systemd-timesyncdand switched tochrony, as described in your issue. If so, I think this test case would also be applicable to the Core 26 environment, and the requirements would need to be updated accordingly. If not, we need to understand why UC26 is still usingsystemd-timesyncd.
There was a problem hiding this comment.
UC26 has not switched to chrony and still uses systemd-timesyncd by default. Ubuntu Core Docs.
systemd-timesyncdis integrated directly intosystemdwithin immutable base snap and operates strictly as a lightweight SNTP client, avoiding the need for a separate daemon likechrony.- System time process is tightly coupled to the boots process.
Since the Core and Classic are assembled differently and require different approaches, the chrony job is appropriate for Classic, but not for Core environment.
If the NTP test coverage is required for Ubuntu Core in the future, I think creating a separate Core-specific job and script using systemd-timesyncd would be the better approach.
Description
The previous
networking/ntptest depends onntpdatewhich was deprecated in Ubuntu 15.10 and replaced by systemd-timesyncd. Starting with Ubuntu 25.10,chronyhas replacedsystemd-timesyncd.Because of this, a new test case for NTP synchronization with
chrony.Resolved issues
Documentation
N/A
Tests
networking/ntp-chronyruns on version 25.10 and later versions, falls back tonetworking/ntpon earlier versions.Result on 26.04
Result on 24.04
WARNING: This modifies com.canonical.certification::sru-server