pacemaker
2.1.7-0f7f88312f
Scalable High-Availability cluster resource manager
lib
common
tests
agents
pcmk__effective_rc_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
#include <
crm/common/agents.h
>
14
15
static
void
16
pcmk__effective_rc_test(
void
**state) {
17
/* All other PCMK_OCF_* values after UNKNOWN are deprecated and no longer used,
18
* so probably not worth testing them.
19
*/
20
assert_int_equal(
PCMK_OCF_OK
,
pcmk__effective_rc
(
PCMK_OCF_OK
));
21
assert_int_equal(
PCMK_OCF_OK
,
pcmk__effective_rc
(
PCMK_OCF_DEGRADED
));
22
assert_int_equal(
PCMK_OCF_RUNNING_PROMOTED
,
pcmk__effective_rc
(
PCMK_OCF_DEGRADED_PROMOTED
));
23
assert_int_equal(
PCMK_OCF_UNKNOWN
,
pcmk__effective_rc
(
PCMK_OCF_UNKNOWN
));
24
25
/* There's nothing that says pcmk__effective_rc is restricted to PCMK_OCF_*
26
* values. That's just how it's used. Let's check some values outside
27
* that range just to be sure.
28
*/
29
assert_int_equal(-1,
pcmk__effective_rc
(-1));
30
assert_int_equal(255,
pcmk__effective_rc
(255));
31
assert_int_equal(INT_MAX,
pcmk__effective_rc
(INT_MAX));
32
assert_int_equal(INT_MIN,
pcmk__effective_rc
(INT_MIN));
33
}
34
35
PCMK__UNIT_TEST
(NULL, NULL,
36
cmocka_unit_test(pcmk__effective_rc_test))
agents.h
API related to resource agents.
PCMK_OCF_RUNNING_PROMOTED
Service active and promoted.
Definition:
results.h:178
PCMK_OCF_DEGRADED_PROMOTED
Service promoted but more likely to fail soon.
Definition:
results.h:181
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))
pcmk__effective_rc
int pcmk__effective_rc(int rc)
Definition:
agents.c:71
crm_internal.h
PCMK_OCF_DEGRADED
Service active but more likely to fail soon.
Definition:
results.h:180
PCMK_OCF_OK
Success.
Definition:
results.h:170
PCMK_OCF_UNKNOWN
Action is pending.
Definition:
results.h:189
unittest_internal.h
Generated on Tue Dec 19 2023 17:32:56 for pacemaker by
1.8.14