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
Alexander A. Klimov
9345caacec
Test IsCertUptodate() and IsCaUptodate()
2023-12-18 17:07:44 +01:00
Yonas Habteab
b6ba09e479
Test: Add multiline PerfData test case
2023-07-04 11:10:38 +02:00
Julian Brost
ccb18a04ec
Checkable: Add test for state notifications after a suppression ends
2022-03-09 17:06:09 +01:00
Julian Brost
d4b9d7e51b
Add tests for LegacyTimePeriod::ScriptFunc when used by TimePeriod::IsInside
2022-02-21 15:24:15 +01:00
Noah Hilverling
6ddac83d81
Dictionary: Make sure underlaying map is ordered
2021-11-12 17:55:47 +01:00
Alexander A. Klimov
c666f81361
De-couple package and stage name validation
2021-08-02 15:40:14 +02:00
Julian Brost
d07d48b169
Add tests for DST handling in TimePeriods and ScheduledDowntimes
2021-07-26 16:09:20 +02:00
Alexander A. Klimov
ea5411a6e0
PluginUtility::FormatPerfdata(): normalize UoMs if desired
2021-07-05 19:05:32 +02:00
Alexander Aleksandrovič Klimov
6048d0e800
Merge pull request #8373 from Icinga/feature/improve-crashlog
...
Improve crashlog
2021-06-29 17:52:25 +02:00
Alexander Aleksandrovič Klimov
9f24107a08
Merge pull request #8748 from Icinga/bugfix/icingadb-cv-function
...
JsonEncode(): encode non-[]/{} objects as strings, not null
2021-06-23 18:01:21 +02:00
Alexander Aleksandrovič Klimov
2cd9c1d902
Merge pull request #8835 from Icinga/bugfix/api-filename-truncation
...
Fix/restrict truncation of filenames for API-created objects
2021-06-23 12:06:31 +02:00
Julian Brost
02f761798c
Merge pull request #8825 from Icinga/bugfix/validate-config-package-name
...
ConfigPackageUtility::ValidateName: replace broken regex
2021-06-22 15:45:38 +02:00
Julian Brost
97d6876803
Utility: add a function to truncate strings while avoiding collisions
2021-06-17 16:21:01 +02:00
Julian Brost
005fac0a23
Merge pull request #8742 from Icinga/bugfix/double-to-string
...
Convert::ToString(double): handle integral values too large for long long correctly
2021-06-15 12:28:15 +02:00
Julian Brost
c40b18ef61
ConfigPackageUtility::ValidateName: replace broken regex
...
The old validation regex matched if the name consists only of invalid
character, not that it does not contain them, i.e. something like "foo/bar" was
considered valid.
This commit replaces the regex with a check that all characters in the name are
allowed characters.
2021-06-15 12:16:54 +02:00
Julian Brost
06999faf25
Allow using E in perfdata both as exponent and unit prefix
2021-06-08 12:37:13 +02:00
Julian Brost
62cbe72cdb
Merge pull request #8492 from Icinga/bugfix/perfdata-scientific-notation
...
Fix perfdata parser not recognize scientific notation
2021-06-07 15:29:52 +02:00
Alexander A. Klimov
fa2666fecf
JsonEncode(): encode non-[]/{} objects as strings, not null
...
... to represent function custom vars as such in Icinga DB.
2021-04-30 15:49:52 +02:00
Julian Brost
2d6d87d10f
Convert::ToString(double): handle integral values too large for long long correctly
...
Even if a double represents an integer value, it might not be safe to cast it
to long long as it may overflow the type. Instead just use print the double
value with 0 decimals using std::setprecision.
Before:
<1> => 18446744073709551616.to_string()
"-9223372036854775808"
After:
<1> => 18446744073709551616.to_string()
"18446744073709551616"
2021-04-27 17:31:50 +02:00
Julian Brost
af05a50740
Avoid dependency on Visual C++ ATL in tests on Windows
...
Better not have dependencies on Visual C++ if you can do without.
2021-04-09 15:28:40 +02:00
Alexander A. Klimov
9531de3835
JsonEncode(): serialize integers w/o trailing .0
...
... so Icinga DB can parse them as integers.
2021-03-23 17:52:37 +01:00
Julian Brost
49cfda833e
Add tests for SHA1 function
2021-03-19 10:31:01 +01:00
Alexander Aleksandrovič Klimov
ef8619f76b
Merge pull request #8601 from Icinga/feature/replace-std-boost-bind-with-lambdas-7006
...
Feature: Replace std/boost::bind() with lambdas
2021-03-18 17:56:13 +01:00
Yonas Habteab
43ba2da39c
Replace std/boost::bind() function with lambda expression
2021-03-10 16:29:40 +01:00
Julian Brost
c5626cb793
Stacktrace test: try to prevent inlining even harder
...
- Explicitly disable optimizations for MSVC
- Make stack_test_func_a bigger
2021-03-01 16:08:06 +01:00
Julian Brost
1742e31225
Add comments to stack trace formatter and test case
2021-03-01 14:07:11 +01:00
Julian Brost
24f6283362
Add a test case for the stack trace formatter
2021-03-01 14:07:11 +01:00
Julian Brost
5cb7c7cc09
Replace icinga::StackTrace with boost::stacktrace::stacktrace
...
Provides roughly the same functionality but works better on certain
platforms (especially Windows) and is less code to maintain.
2021-03-01 14:06:44 +01:00
Alexander Aleksandrovič Klimov
dbdfe189c0
Merge pull request #7092 from Icinga/bugfix/command-escape-windows-4849
...
Fix Windows command escape for \"
2021-02-01 11:20:44 +01:00
Julian Brost
56095b29f4
Add tests for Utility::EscapeCreateProcessArg
2021-01-29 15:15:43 +01:00
Alexander Aleksandrovič Klimov
6b04ef6e5d
Merge pull request #7871 from Icinga/feature/more-uoms-for-perfdata-7225
...
PerfdataValue: add UoMs
2020-12-14 18:42:49 +01:00
Michael Insel
e070651203
Add test-case for perfdata scientific notation
2020-11-27 11:40:10 +01:00
Alexander A. Klimov
3adba5c542
JsonEncode(): suffix pretty JSON w/ \n
...
refs #8194
2020-09-02 16:11:43 +02:00
Alexander A. Klimov
720a88c29a
PerfdataValue: add UoMs
...
* {,{K,M,G,T,P,E,Z,Y}{,i}}B
=> bytes
* {,{k,m,g,t,p,e,z,y}{,i}}b
=> bits
* packets
* {n,u,m,}s m h d
=> seconds
* {n,u,m,,k,M,G,T,P,E,Z,Y}{{A,O,V,W},{A,W}{s,m,h}}
=> amperes, ohms, volts, watts, ampere-seconds, watt-hours
* lm dBm
=> lumens decibel-milliwatts
* {n,u,m,,k}g t
=> grams
* C F K
=> degrees-celsius, degrees-fahrenheit, degrees-kelvin
* {m,,h}l
=> liters
refs #7225
2020-04-03 12:47:36 +02:00
Michael Friedrich
3a4fb840d4
Tests: Add multi parent dependency test case
2020-02-11 15:13:25 +01:00
Michael Friedrich
76d531b4f0
Unit tests: Also test reachability in icinga_checkresult/* tests
2020-02-11 15:13:25 +01:00
Alexander A. Klimov
28f708bb7c
LegacyTimePeriod: support specifying seconds
2019-08-22 18:50:37 +02:00
Michael Friedrich
da982c256b
Add unit test for Utility::CompareVersion
2019-08-14 13:14:43 +02:00
Michael Friedrich
96f62d2d34
Add Utility::ParseVersion() and unit tests
...
This now uses a regex to extract the short version
similar to how Icinga Web 2 does it.
Additional unit tests prove the rule.
2019-08-14 11:22:55 +02:00
Alexander A. Klimov
95e90e99d4
Tests: _Exit() in main()
...
refs #7334
2019-07-23 12:14:06 +02:00
Michael Friedrich
9c5f280a85
Tests: Add Notification state/type to string cases
2019-07-16 13:46:22 +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
Elias Ohm
52e3db279a
Fix for double-free (and possibly other memory-corruption related) crashes at logrotate time
...
this is a direct fix of the issue revealing the problem that leads to crash
verification done with a patched icinga2 where the execution-order of the code lines of counter-parts involved in re-incrementing/decrementing Timer:Ptr is forced to be the one that leads to the obeserverd segfaults
refs #6737
2019-04-24 11:42:54 +02:00