20 Commits

Author SHA1 Message Date
Julian Brost
396ce871ec Utility::FormatDateTime(): provide an overload for tm*
This allows the function to be used both with a double timestamp or a pointer
to a tm struct. With this, a similar implementation inside the tests can simply
use our regular function.
2024-09-23 10:54:26 +02:00
Yonas Habteab
3d1a2b4e44
Merge pull request #10128 from Icinga/broken-timeperiod-2.13
Fix broken `TimePeriod/ScheduledDowntime`s
2024-09-18 10:36:41 +02:00
Yonas Habteab
fb46d312e5 Add advanced timeperiod range,include/exclude test cases 2024-09-17 16:44:32 +02:00
Yonas Habteab
be775b4baf tests: Add some basic tests cases for LegacyTimePeriod::IsInTimeRange() 2024-09-17 16:44:32 +02:00
Julian Brost
6986417533 Timeperiods: fix off by one when calculating n-th last weekday of the month
A day specification like "monday -1" refers to the last Monday of the month.
However, there was an off by one if the first day of the next month is the same
day of the week, i.e. a Monday in this example.

LegacyTimePeriod::FindNthWeekday() picks a day to start the search for the day
in question. When given a negative n to search for the n-th last day, it
wrongly used the first day of the following month as the start and counted it
as if it was within the current month. This resulted in a 1/7 chance that the
result was one week too late.

This is fixed by using the last day of the current month instead.
2024-09-17 16:44:09 +02:00
Julian Brost
d4b9d7e51b Add tests for LegacyTimePeriod::ScriptFunc when used by TimePeriod::IsInside 2022-02-21 15:24:15 +01:00
Julian Brost
d07d48b169 Add tests for DST handling in TimePeriods and ScheduledDowntimes 2021-07-26 16:09:20 +02:00
Alexander A. Klimov
28f708bb7c LegacyTimePeriod: support specifying seconds 2019-08-22 18:50:37 +02:00
Michael Friedrich
88e5d8c47a TimePeriod: Fully support and test "day -X" notation
Previously no tests would have detected if this really worked or not.
2019-07-09 16:21:07 +02:00
Michael Friedrich
7665143afa Tests: Rewrite TimePeriod tests using Boost::DateTime
fixes #7257
2019-07-09 15:34:07 +02:00
Alexander A. Klimov
2306e0e93f Fix unit test icinga_legacytimeperiod/advanced
refs #5261
2019-06-06 13:11:34 +02:00
Michael Friedrich
5e931fe127 Tests: Add cases for LegacyTimePeriod::ProcessTimeRangeRaw() 2019-06-06 13:11:34 +02:00
Michael Friedrich
d14a88235d Replace Copyright header with a short version, part I
CLion -> replace in path
2019-02-25 14:48:22 +01:00
Michael Friedrich
1a8a2c25f2 icinga.com: Update test and tools 2018-10-18 09:45:36 +02:00
Michael Insel
6eccdff621 Change a bunch more copyright headers for 2018
This changes more copyright headers for 2018.
2018-01-08 18:05:12 +01:00
Gunnar Beutner
ac155d1dda Apply clang-tidy fix 'modernize-redundant-void-arg' 2018-01-04 12:24:57 +01:00
Jean Flach
629c502ca9 Fix build errors 2017-12-20 08:08:02 +01:00
Adam James
37d100ddef Implement unit tests for the time period parser
fixes #11146
2017-12-20 08:08:02 +01:00
Gunnar Beutner
fc889eb9ad Revert "Implement unit tests for the time period parser"
This reverts commit 1246d7dda334859ee136198b8285f5f4f9504b59.

refs #11146
2016-05-11 18:12:20 +02:00
Adam James
1246d7dda3 Implement unit tests for the time period parser
fixes #11146
2016-05-11 09:23:39 +02:00