pacemaker
2.1.7-0f7f88312f
Scalable High-Availability cluster resource manager
lib
common
tests
health
pcmk__validate_health_strategy_test.c
Go to the documentation of this file.
1
/*
2
* Copyright 2022 the Pacemaker project contributors
3
*
4
* The version control history for this file may have further details.
5
*
6
* This source code is licensed under the GNU General Public License version 2
7
* or later (GPLv2+) WITHOUT ANY WARRANTY.
8
*/
9
10
#include <
crm_internal.h
>
11
12
#include <
crm/common/unittest_internal.h
>
13
14
// Test functions
15
16
static
void
17
valid_strategy(
void
**state) {
18
assert_true(
pcmk__validate_health_strategy
(
"none"
));
19
assert_true(
pcmk__validate_health_strategy
(
"None"
));
20
assert_true(
pcmk__validate_health_strategy
(
"NONE"
));
21
assert_true(
pcmk__validate_health_strategy
(
"NoNe"
));
22
assert_true(
pcmk__validate_health_strategy
(
"migrate-on-red"
));
23
assert_true(
pcmk__validate_health_strategy
(
"only-green"
));
24
assert_true(
pcmk__validate_health_strategy
(
"progressive"
));
25
assert_true(
pcmk__validate_health_strategy
(
"custom"
));
26
}
27
28
static
void
29
invalid_strategy(
void
**state) {
30
assert_false(
pcmk__validate_health_strategy
(NULL));
31
assert_false(
pcmk__validate_health_strategy
(
""
));
32
assert_false(
pcmk__validate_health_strategy
(
"none to speak of"
));
33
assert_false(
pcmk__validate_health_strategy
(
"customized"
));
34
}
35
36
PCMK__UNIT_TEST
(NULL, NULL,
37
cmocka_unit_test(valid_strategy),
38
cmocka_unit_test(invalid_strategy))
PCMK__UNIT_TEST
PCMK__UNIT_TEST(NULL, NULL, cmocka_unit_test(bad_input), cmocka_unit_test(not_found), cmocka_unit_test(find_attrB), cmocka_unit_test(find_attrA_matching))
crm_internal.h
unittest_internal.h
pcmk__validate_health_strategy
bool pcmk__validate_health_strategy(const char *value)
Definition:
health.c:21
Generated on Tue Dec 19 2023 17:32:56 for pacemaker by
1.8.14