Allow expiration date for downtime#426
Merged
jose-caballero merged 2 commits intomainfrom Jan 26, 2026
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #426 +/- ##
==========================================
- Coverage 99.88% 99.81% -0.08%
==========================================
Files 109 109
Lines 2598 2638 +40
Branches 320 329 +9
==========================================
+ Hits 2595 2633 +38
- Misses 3 4 +1
- Partials 0 1 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
DavidFair
requested changes
Jan 13, 2026
3c21d0a to
037091c
Compare
1b77ab9 to
65f41ce
Compare
65f41ce to
0c9f768
Compare
88deae8 to
231bfd6
Compare
DavidFair
requested changes
Jan 26, 2026
231bfd6 to
88f8ec1
Compare
In this task we address the request from this JIRA ticket: https://stfc.atlassian.net/browse/CLDSCRM-2737 We want to allow to specify not only the number of hours that a given hypervisor is going to be down, but also: - the number of days - the number of days and hours - the exact end time In this commit we make the following changes: - we add a new field to the YAML file for the user form, and improve the description sentences - we implement the necessary code to allow those new input formats The new code has been implemented almost entirely as separate functions called by the old one. These new functions return the final total number of hours for the donwtime interval. It is true that, doing things this way, for some cases the datetime object for the endtime is calculated twice. The changes have been implemented this way for two reasons: - modify the original code a little as possible, avoiding the need to refactor too much existing unittest code - the new logic is implemented in separate small functions that return outputs. This way, we can unittest them in "black box" mode -checking only the inputs, outputs, and excpetions, but not the implementation- and still covering the entire logic A potential refactoring in the future could be to implement the time calculations we are introducing in this change inside the Dowmtime classes. But I would suggest to do that, if so, only when we do not need icinga downtimes anymore and this st2 Action requires some cleanup and simplification
88f8ec1 to
2abf219
Compare
DavidFair
previously approved these changes
Jan 26, 2026
Collaborator
DavidFair
left a comment
There was a problem hiding this comment.
LGTM, there's a load of duplication in the tests (mainly around get_number_of_hours_from_duration being tested after get_number_of_hours also tests the same thing) but it isn't worth holding this PR up for
Sorry it went through several iterations, but (IMO) it's in a much nicer form for future developers
Fix the old unittest as the signature for the original function has changed a little bit. Add tests for the new functions introduced in this task.
2abf219 to
dee169d
Compare
DavidFair
approved these changes
Jan 26, 2026
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.
Description:
Special Notes:
Submitter:
Have you (where applicable):
Reviewer
Does this PR:
libdirectory?liblayers?