Commit Graph

369 Commits

Author SHA1 Message Date
Maciej Dems 2bb5cc62e2 Fix missing values in PerfData normalization 2024-04-25 17:41:12 +02:00
Maciej Dems 91789b2888 Correct tests checks for icinga_perfdata 2024-04-25 17:41:12 +02:00
Alexander Aleksandrovič Klimov 48eb563ca0
Merge pull request #9736 from Icinga/stream-read-allow_partial
Stream#Read(): remove de facto unused param allow_partial
2024-02-13 13:04:15 +01:00
Alexander Aleksandrovič Klimov 949d983a76
Merge pull request #9895 from Icinga/targeted-api-filter
FilterUtility::GetFilterTargets(): don't run filter for specific object(s) for all objects
2023-12-19 15:18:41 +01:00
Alexander Aleksandrovič Klimov 8b2e28a869
Merge pull request #9891 from Icinga/renew-the-ca-9890
ApiListener#Start(): auto-renew CA on its owner
2023-12-19 14:57:47 +01:00
Alexander A. Klimov 175153ce6a PluginNotificationTask::ScriptFunc(): on Linux truncate output and comment
not to run into an exec(3) error E2BIG due to a too long argument.
This sends a notification with truncated output instead of not sending.
2023-12-19 12:21:03 +01:00
Alexander A. Klimov 4424d57e7a Tests: config_apply/gettargetservices_*: use BOOST_CHECK_EQUAL_COLLECTIONS()
to show the value diff in case of mismatch.

Co-authored-by: Yonas Habteab <yonas.habteab@icinga.com>
2023-12-18 16:01:31 +01:00
Alexander A. Klimov dc338a406a Test IsCertUptodate() and IsCaUptodate() 2023-12-18 15:28:11 +01:00
Alexander A. Klimov 191bf93f2e Test ApplyRule::GetTarget*s() 2023-12-18 13:07:31 +01:00
Alexander A. Klimov 97cd05db7a Notification#BeginExecuteNotification(): on recovery clear last_notified_state_per_user 2023-12-13 13:21:22 +01:00
Alexander A. Klimov 44e9c6f40d Notification#BeginExecuteNotification(): discard likely duplicate problem notifications 2023-12-13 13:21:19 +01:00
Alexander A. Klimov 1308ad62af Stream#Read(): remove de facto unused param allow_partial
The only caller passes true, so no one forbids partial reads (even implicitly).
All usages in the implementation just assert it being true (allowed).
2023-07-13 16:55:48 +02:00
Julian Brost 0e25644151
Merge pull request #8969 from Icinga/bugfix/perfdata-dont-get-parsed-correctly-8912
PluginUtility: Fix PerfData parsing for values separated with multiple spaces
2023-05-22 17:16:31 +02:00
Julian Brost af9d67b262
Merge pull request #9726 from Icinga/43624b
Remove -and notify- expired downtimes immediately, not every 60s II
2023-05-02 11:25:03 +02:00
Yonas Habteab e7c5554d87 Test: Add multiline PerfData test case 2023-04-05 15:44:13 +02:00
Alexander A. Klimov 21b68455ce Use Timer::Create() instead of new Timer()
git ls-files -z |xargs -0 perl -pi -e 's/\bnew Timer\b/Timer::Create/g'

ex. in Timer::Create() itself.
2023-04-04 10:35:20 +02:00
Alexander A. Klimov 396a71c6a0 Repair unit tests 2023-02-21 17:49:26 +01:00
Julian Brost 90848f602b Checkable: Add test for state notifications after a suppression ends 2022-03-03 14:25:23 +01:00
Julian Brost 7b2667400b Add tests for LegacyTimePeriod::ScriptFunc when used by TimePeriod::IsInside 2021-11-17 13:09:10 +01:00
Noah Hilverling 10bde2075a Dictionary: Make sure underlaying map is ordered 2021-11-12 13:34:57 +01:00
Alexander Aleksandrovič Klimov 02db80d6f3
Merge pull request #8815 from Icinga/feature/make-base-value-format-test-easier-to-understand
Make base_value/format test easier to understand
2021-08-03 11:37:09 +02: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
Julian Brost 7012774f57 Make base_value/format test easier to understand
The old test looked really strange where it reads 3 into a Value and then
checks that it's not 3. However, what's going on there is that operator>> for
Value actually always reads a String, so instead check for what v should be,
not what it should not be.
2021-05-31 17:28:35 +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