pacemaker
2.1.7-0f7f88312f
Scalable High-Availability cluster resource manager
lib
pengine
tests
utils
pe__cmp_rsc_priority_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/pengine/internal.h
>
14
15
#include "
pe_status_private.h
"
16
17
pcmk_resource_t
rsc1
;
18
pcmk_resource_t
rsc2
;
19
20
static
void
21
rscs_equal(
void
**state)
22
{
23
rsc1
.
priority
= 0;
24
rsc2
.
priority
= 0;
25
assert_int_equal(
pe__cmp_rsc_priority
(NULL, NULL), 0);
26
assert_int_equal(
pe__cmp_rsc_priority
(&
rsc1
, &
rsc2
), 0);
27
}
28
29
static
void
30
rsc1_first(
void
**state)
31
{
32
rsc1
.
priority
= 1;
33
rsc2
.
priority
= 0;
34
assert_int_equal(
pe__cmp_rsc_priority
(&
rsc1
, NULL), -1);
35
assert_int_equal(
pe__cmp_rsc_priority
(&
rsc1
, &
rsc2
), -1);
36
}
37
38
static
void
39
rsc2_first(
void
**state)
40
{
41
rsc1
.
priority
= 0;
42
rsc2
.
priority
= 1;
43
assert_int_equal(
pe__cmp_rsc_priority
(NULL, &
rsc2
), 1);
44
assert_int_equal(
pe__cmp_rsc_priority
(&
rsc1
, &
rsc2
), 1);
45
}
46
47
PCMK__UNIT_TEST
(NULL, NULL,
48
cmocka_unit_test(rscs_equal),
49
cmocka_unit_test(rsc1_first),
50
cmocka_unit_test(rsc2_first))
internal.h
rsc2
pcmk_resource_t rsc2
Definition:
pe__cmp_rsc_priority_test.c:18
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))
pe_resource_s
Implementation of pcmk_resource_t.
Definition:
resources.h:399
crm_internal.h
pe_resource_s::priority
int priority
Configured priority.
Definition:
resources.h:422
rsc1
pcmk_resource_t rsc1
Definition:
pe__cmp_rsc_priority_test.c:17
pe__cmp_rsc_priority
G_GNUC_INTERNAL gint pe__cmp_rsc_priority(gconstpointer a, gconstpointer b)
Definition:
utils.c:296
unittest_internal.h
pe_status_private.h
Generated on Tue Dec 19 2023 17:32:57 for pacemaker by
1.8.14