pacemaker
2.1.8-3980678f03
Scalable High-Availability cluster resource manager
lib
common
tests
health
pcmk__parse_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
static
void
15
valid(
void
**state) {
16
assert_int_equal(
pcmk__parse_health_strategy
(NULL),
17
pcmk__health_strategy_none
);
18
19
assert_int_equal(
pcmk__parse_health_strategy
(
PCMK_VALUE_NONE
),
20
pcmk__health_strategy_none
);
21
22
assert_int_equal(
pcmk__parse_health_strategy
(
"NONE"
),
23
pcmk__health_strategy_none
);
24
25
assert_int_equal(
pcmk__parse_health_strategy
(
"None"
),
26
pcmk__health_strategy_none
);
27
28
assert_int_equal(
pcmk__parse_health_strategy
(
"nOnE"
),
29
pcmk__health_strategy_none
);
30
31
assert_int_equal(
pcmk__parse_health_strategy
(
"migrate-on-red"
),
32
pcmk__health_strategy_no_red
);
33
34
assert_int_equal(
pcmk__parse_health_strategy
(
"only-green"
),
35
pcmk__health_strategy_only_green
);
36
37
assert_int_equal(
pcmk__parse_health_strategy
(
"progressive"
),
38
pcmk__health_strategy_progressive
);
39
40
assert_int_equal(
pcmk__parse_health_strategy
(
"custom"
),
41
pcmk__health_strategy_custom
);
42
}
43
44
static
void
45
invalid(
void
**state) {
46
assert_int_equal(
pcmk__parse_health_strategy
(
"foo"
),
47
pcmk__health_strategy_none
);
48
assert_int_equal(
pcmk__parse_health_strategy
(
"custom1"
),
49
pcmk__health_strategy_none
);
50
assert_int_equal(
pcmk__parse_health_strategy
(
"not-only-green-here"
),
51
pcmk__health_strategy_none
);
52
}
53
54
PCMK__UNIT_TEST
(NULL, NULL,
55
cmocka_unit_test(valid),
56
cmocka_unit_test(invalid))
PCMK__UNIT_TEST
#define PCMK__UNIT_TEST(group_setup, group_teardown,...)
Definition:
unittest_internal.h:196
pcmk__parse_health_strategy
enum pcmk__health_strategy pcmk__parse_health_strategy(const char *value)
Definition:
health.c:41
pcmk__health_strategy_no_red
Definition:
health_internal.h:26
crm_internal.h
PCMK_VALUE_NONE
#define PCMK_VALUE_NONE
Definition:
options.h:178
pcmk__health_strategy_progressive
Definition:
health_internal.h:28
pcmk__health_strategy_none
Definition:
health_internal.h:25
unittest_internal.h
pcmk__health_strategy_only_green
Definition:
health_internal.h:27
pcmk__health_strategy_custom
Definition:
health_internal.h:29
Generated on Thu Aug 8 2024 18:08:10 for pacemaker by
1.8.14