Yonas Habteab
91c7e60df8
Replace all existing copyright headers with SPDX headers
...
I've used the following command to replace the original copyright header
lines in a C-style comment block:
```
$ find . \( -type d \( -name '\..*' -o -name third-party -o -name scripts -o -name prefix -o -name malloc -o -name server -o -name docker -o -name build -o -name doc \) -prune \) -o -type f -exec perl -pi -e 's{/\*[^*]*\(\s*c\s*\)\s*(\d{4})\s*Icinga\s+GmbH[^*]*\*/}{// SPDX-FileCopyrightText: \1 Icinga GmbH <https://icinga.com >\n// SPDX-License-Identifier: GPL-2.0-or-later}gi' {} +
```
For files that use shell-style comments (#) like CMakeLists.txt, I've
used this command:
```
$ find . \( -type d \( -name '\..*' -o -name third-party -o -name scripts -o -name prefix -o -name malloc -o -name server -o -name docker -o -name build -o -name doc \) -prune \) -o -type f -exec perl -pi -e 's{#.*\(\s*c\s*\)\s(\d{4})\sIcinga\s+GmbH.*}{# SPDX-FileCopyrightText: \1 Icinga GmbH <https://icinga.com >\n# SPDX-License-Identifier: GPL-2.0-or-later}gi' {} +
```
And for SQL files:
```
$ find . \( -type d \( -name '\..*' -o -name third-party -o -name scripts -o -name prefix -o -name malloc -o -name server -o -name docker -o -name build -o -name doc \) -prune \) -o -type f \( -name '*.sql' \) -exec perl -pi -e 's{--.*\(c\)\s(\d{4})\sIcinga\sGmbH.*}{-- SPDX-FileCopyrightText: \1 Icinga GmbH <https://icinga.com >\n-- SPDX-License-Identifier: GPL-2.0-or-later}gi' {} +
$ find . \( -type d \( -name '\..*' -o -name third-party -o -name scripts -o -name prefix -o -name malloc -o -name server -o -name docker -o -name build -o -name doc \) -prune \) -o -type f \( -name '*.sql' \) -exec perl -pi -e 's{-- Copyright \(c\)\s(\d{4})\sIcinga\s+Development\sTeam.*}{-- SPDX-FileCopyrightText: \1 Icinga GmbH <https://icinga.com >\n-- SPDX-License-Identifier: GPL-2.0-or-later}gi' {} +
```
2026-02-04 14:00:05 +01:00
Johannes Schmidt
a2e0ce426f
Fix -Wunused-variable warnings
2025-11-19 12:00:58 +01:00
Alexander A. Klimov
3d69a31043
Fix compiler warnings by removing unused variables
2025-10-17 09:56:46 +02:00
Alexander Aleksandrovič Klimov
ec2080dcc1
Merge pull request #9731 from Icinga/fix-compiler-warnings-by-copy-constructing-loop-variables-explicitly
...
Fix compiler warnings by (copy-)constructing loop variables explicitly or not at all
2025-05-21 14:26:47 +02:00
Julian Brost
379d7638ed
tests: Remove special cases for Windows in icinga_legacytimeperiod/dst
...
Ideally, Icinga 2 should behave consistenly across platforms. These special
cases only existed because mktime() on Windows behaved differently than the
implementation in glibc. With the introduction of Utility::NormalizeTm(),
there's now consistent behavior and the other expected results for windows are
no longer necessary (ideally, they shouldn't have existed in the first place).
2025-04-28 13:48:00 +02:00
Julian Brost
17c96783cf
tests: Move GlobalTimezoneFixture to utils file
...
Prepare for adding test cases for DST changes in other files as well.
2025-04-28 13:38:38 +02:00
Julian Brost
de4b58a04f
tests: Move make_tm helper function to utils file
...
Preparation to be able to use the function from different test files later on.
2025-04-28 13:38:32 +02:00
Alexander A. Klimov
c2ddd20ef3
Fix compiler warnings by (copy-)constructing loop variables explicitly
...
for (const T& needle : haystack) creates the illusion that haystack is a
container of T and we're just borrowing needle. In these cases that's not true.
2025-04-22 13:55:49 +02:00
Julian Brost
39ae2e8ca4
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-08-23 12:48:50 +02:00
Julian Brost
4c83d793a6
Merge pull request #9983 from Icinga/broken-timeperiod
...
Fix broken `TimePeriod/ScheduledDowntime`s
2024-08-20 10:05:59 +02:00
Julian Brost
c45829b59f
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-08-07 12:06:05 +02:00
Yonas Habteab
4f94891b52
Add advanced timeperiod range,include/exclude test cases
2024-08-02 11:12:51 +02:00
Yonas Habteab
ddf7143777
tests: Add some basic tests cases for LegacyTimePeriod::IsInTimeRange()
2024-08-02 11:12:51 +02:00
Julian Brost
7b2667400b
Add tests for LegacyTimePeriod::ScriptFunc when used by TimePeriod::IsInside
2021-11-17 13:09:10 +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 1246d7dda3 .
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