Merged
Conversation
Add a thin wrapper around the 'systemd-analyze calendar` command: The CalendarSpec() class accepts a calendarspec string formatted according to systemd.time(8):CALENDAR EVENTS. Resolves: #121
This triggers false positives for many of out functions and methods: disable it to avoid noise and unnecessary failures in CI. Related: #121
Add unit tests for the CalendarSpec class, based on the systemd calendarspec tests at: https://github.com/systemd/systemd/blob/main/src/test/test-calendarspec.c Resolves: #122
There are two test cases in CalendarSpecTests that each have a large (~50 entries) table of individual calls to either the _test_one() or _test_next() methods. Refactor this so that instead of individual calls we iterate over a list of tuples comprising the input data and expected output, and call the test methods under the context manager 'with self.subTest()'. This generates a unique index for each subtest which is reported with any failures, as well as a custom message that includes the input data to the test. This makes debugging easier since it makes it explicitly clear which test case has failed. Related: #122
c5dc40a to
9f11fb8
Compare
The libfaketime package is not available in CentOS or RHEL: build require the libfaketime package only if building on Fedora. Related: #122
The _test_next() method relies on patching CalendarSpec to call systemd-analyze under the faketime command to set the starting time of the test. Skip this test if the faketime command is unavailable at runtime. Related: #122
|
Congratulations! One of the builds has completed. 🍾 You can install the built RPMs by following these steps:
Please note that the RPMs should be used only in a testing environment. |
1 similar comment
|
Congratulations! One of the builds has completed. 🍾 You can install the built RPMs by following these steps:
Please note that the RPMs should be used only in a testing environment. |
Ubuntu ships the /usr/bin/faketime binary in a separate 'faketime' package: add this to the dependencies in snapm.yaml. Without this package the test_calendar_spec_next test is skipped: tests/test_calendar.py::CalendarSpecTests::test_calendar_spec_next SKIPPED [ 5%] Related: #122.
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 unit tests for the CalendarSpec class, based on the systemd
calendarspec tests at:
https://github.com/systemd/systemd/blob/main/src/test/test-calendarspec.c
Resolves: #122