add ntp test - #19
Draft
Yoda-Yothada wants to merge 1 commit into
Draft
Conversation
Yoda-Yothada
force-pushed
the
yoda_ntp_test
branch
from
August 25, 2026 15:36
403c0ad to
f503bfe
Compare
Author
|
NTP_SOURCES variable updated to match stackhpc/stackhpc-kayobe-config |
Alex-Welsh
reviewed
Aug 26, 2026
| MAX_OFFSET_SECONDS = 0.5 # 500 ms limit | ||
|
|
||
|
|
||
| def test_ntp_configuration_and_sync(): |
Member
There was a problem hiding this comment.
At the moment, everything here is in one test function. Could you refactor it a bit so each test is a different function? See the docker tests for an example of what that looks like.
You could divide it into four functions:
- Prechecks to ensure that NTP_SOURCES is set and formatted correctly
- Check that chrony is running, and that something is syncing properly
- Check that the sources match what are expected
- Check time offset
Alex-Welsh
requested changes
Aug 26, 2026
| assert ntp_sources, "NTP_SOURCES contains no valid source entries." | ||
|
|
||
| # 2. Basic service check via timedatectl | ||
| timedate_res = subprocess.run( |
Member
There was a problem hiding this comment.
The existing tests (like Docker and SELinux) use the host fixture from pytest-testinfra to run commands (host.check_output(...)) could we switch to that here for consistency?
Yoda-Yothada
marked this pull request as draft
August 26, 2026 09:35
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
add test_ntp.py and format with black