Skip to content

Add chrony NTP synchronization test (New) - #2811

Open
JasonLeonnn wants to merge 5 commits into
mainfrom
add_chrony_ntp_test
Open

Add chrony NTP synchronization test (New)#2811
JasonLeonnn wants to merge 5 commits into
mainfrom
add_chrony_ntp_test

Conversation

@JasonLeonnn

@JasonLeonnn JasonLeonnn commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Description

The previous networking/ntp test depends on ntpdate which was deprecated in Ubuntu 15.10 and replaced by systemd-timesyncd. Starting with Ubuntu 25.10, chrony has replaced systemd-timesyncd.
Because of this, a new test case for NTP synchronization with chrony.

Resolved issues

  • Created a new chrony-based script, implement one hour skew, sync using configured NTP sources, and verify.
  • Updated networking and dock jobs

Documentation

N/A

Tests

networking/ntp-chrony runs on version 25.10 and later versions, falls back to networking/ntp on earlier versions.
Result on 26.04
Result on 24.04

WARNING: This modifies com.canonical.certification::sru-server

@JasonLeonnn
JasonLeonnn requested review from a team and a lite review from Copilot September 1, 2026 05:32
@codecov

codecov Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 61.34%. Comparing base (b1a785f) to head (2b91703).
⚠️ Report is 6 commits behind head on main.

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              
Flag Coverage Δ
provider-base 39.85% <100.00%> (+0.21%) ⬆️
provider-certification-client 57.14% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/ntp job command to use a new network_ntp_chrony_test.py chrony-driven implementation.
  • Update networking + dock job requirements to require the chrony package.
  • 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.

Comment thread providers/base/units/networking/packaging.pxu Outdated
Comment thread providers/base/units/networking/jobs.pxu
Comment thread providers/base/units/dock/jobs.pxu Outdated
@JasonLeonnn
JasonLeonnn removed the request for review from a team September 1, 2026 06:08
@JasonLeonnn
JasonLeonnn marked this pull request as draft September 1, 2026 06:08
Comment thread providers/base/units/networking/jobs.pxu
Comment thread providers/base/units/networking/packaging.pxu Outdated
Comment thread providers/base/bin/network_ntp_chrony_test.py Outdated
Comment thread providers/base/bin/network_ntp_chrony_test.py Outdated
Comment thread providers/base/bin/network_ntp_chrony_test.py Outdated
Comment thread providers/base/bin/network_ntp_chrony_test.py Outdated
Comment thread providers/base/bin/network_ntp_chrony_test.py Outdated
Comment thread providers/base/bin/network_ntp_chrony_test.py Outdated
Comment thread providers/base/bin/network_ntp_chrony_test.py Outdated
@clairlin53

Copy link
Copy Markdown
Contributor

@JasonLeonnn Please provide the submission test result

@JasonLeonnn
JasonLeonnn marked this pull request as ready for review September 2, 2026 03:24

@tomli380576 tomli380576 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sry just 1 more small comment

Comment thread providers/base/units/networking/jobs.pxu Outdated
Comment thread providers/base/units/networking/jobs.pxu Outdated
Comment on lines +217 to +218
networking/ntp-chrony
after-suspend-networking/ntp-chrony

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. I understand that there may be a reason why networking/ntp and after-suspend-networking/ntp are excluded from the Ubuntu Core 26 test plan, but I don’t think that alone is sufficient justification for excluding networking/ntp-chrony as well.

  2. What I’d like to clarify is whether the current Ubuntu Core 26 environment has also deprecated systemd-timesyncd and switched to chrony, 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 using systemd-timesyncd.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UC26 has not switched to chrony and still uses systemd-timesyncd by default. Ubuntu Core Docs.

  • systemd-timesyncd is integrated directly into systemd within immutable base snap and operates strictly as a lightweight SNTP client, avoiding the need for a separate daemon like chrony.
  • 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants