Repository navigation
[rgw][lc][rgw_lifecycle_work_time] adjust timing if the configured end time is less than the start time - #54622
Conversation
00a9bd1 to
f8a7d22
Compare
mattbenjamin
left a comment
There was a problem hiding this comment.
wow, great work--one comment requesting some annotations in the test vectors
There was a problem hiding this comment.
I don't think I've seen this; ASSERT* yield an outputstream?
There was a problem hiding this comment.
Ahh yes, this is a nice little feature gtest has: https://github.com/google/googletest/blob/main/docs/reference/assertions.md. Assertion macros support streaming custom messages into them. The nice thing is the custom message is printed only when assertion fails. For example, just changed a testcase to fail to see the custom output:
[ RUN ] LCWorkTimeTests.ShouldWorkCustomWorkTimeStartEndSameHour
[ OK ] LCWorkTimeTests.ShouldWorkCustomWorkTimeStartEndSameHour (3 ms)
[ RUN ] LCWorkTimeTests.ScheduleNextStartTime
../src/test/rgw/test_rgw_lc.cc:148: Failure
Expected equality of these values:
wait_secs_till_next_start
Which is: 75713
expected_value
Which is: 75700
work_started_at: 2023-01-01T22:15:05.000000-0500 work_completed_at: 2023-01-01T01:13:07.000000-0500 expected: 75700 wait_secs_till_next_start: 75713 work-time-window: 22:15-03:33
[ FAILED ] LCWorkTimeTests.ScheduleNextStartTime (3 ms)
[----------] 8 tests from LCWorkTimeTests (22 ms total)
[----------] Global test environment tear-down
[==========] 11 tests from 3 test suites ran. (23 ms total)
[ PASSED ] 10 tests.
[ FAILED ] 1 test, listed below:
[ FAILED ] LCWorkTimeTests.ScheduleNextStartTime
1 FAILED TEST
Here, work_started_at: 2023-01-01T22:15:05.000000-0500 work_completed_at: 2023-01-01T01:13:07.000000-0500 expected: 75700 wait_secs_till_next_start: 75713 work-time-window: 22:15-03:33 is the custom log line streamed into assertion. The cases that pass hide this extra data.
There was a problem hiding this comment.
hmm, this is sneaky; if it works...
There was a problem hiding this comment.
Indeed :) It works nicely with unittesting. I believe it gets the default values for options from the common shared lib. There's a couple of other existing tests that use this trick.
There was a problem hiding this comment.
in all of the following, it would help to annotate the cases that used to fail and now don't
There was a problem hiding this comment.
Good point. In the new evidence, I moved the commit 2446c01 that introduces the unittests before the time-adjusment commit. Ran the tests and annotated the ones that fail with should have been true, expected to fail due to tracker issue #63613. Then, amended the commit that adds the time-adjustment fix(48e189f) such that it re-annotates the failed cases with // used-to-fail.
Please have a look.
…ude statement Signed-off-by: Oguzhan Ozmen <[email protected]>
…ule_next_start_time Signed-off-by: Oguzhan Ozmen <[email protected]>
…n a day Signed-off-by: Oguzhan Ozmen <[email protected]>
…e start-time LC work time is given in the form of "HH:MM-HH:MM"; the first part represents the "start_time" and the next "end_time". "should_work" function decides, given the current time, whether the LC worker can resume. It essentially checks whether the current time is within start and end times. Since there's no "date" (month/day/year) notion taken into account, a work time whose end_time (i.e., hour field) is less than start_time is not properly handled by "should_work". For example, "14:00-13:59" would normally mean to start LC processing at 2PM local time and allowing it to run for 24 hours. So, given such a work time range, "should_work" must return true for any given current_time. However, without this adjustment, it always returns false. The fix simply adds a "next day" adjustment if the end_time is configured to be less than the configured start_time. Fixes https://tracker.ceph.com/issues/63613 Signed-off-by: Oguzhan Ozmen <[email protected]>
Signed-off-by: Oguzhan Ozmen <[email protected]>
f8a7d22 to
ea25085
Compare
Fixes https://tracker.ceph.com/issues/63613
Unittesting
Contribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins retest this pleasejenkins test classic perfjenkins test crimson perfjenkins test signedjenkins test make checkjenkins test make check arm64jenkins test submodulesjenkins test dashboardjenkins test dashboard cephadmjenkins test apijenkins test docsjenkins render docsjenkins test ceph-volume alljenkins test ceph-volume toxjenkins test windowsjenkins test rook e2e