pacemaker  2.1.8-3980678f03
Scalable High-Availability cluster resource manager
pcmk_resource_is_managed_test.c
Go to the documentation of this file.
1 /*
2  * Copyright 2024 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 <stdio.h> // NULL
13 
14 #include <crm/common/resources.h>
16 
17 static void
18 null_resource(void **state)
19 {
20  assert_false(pcmk_resource_is_managed(NULL));
21 }
22 
23 static void
24 resource_is_managed(void **state)
25 {
28  };
29 
30  assert_true(pcmk_resource_is_managed(&rsc1));
31 }
32 
33 static void
34 resource_is_not_managed(void **state)
35 {
37  .flags = 0,
38  };
39 
40  assert_false(pcmk_resource_is_managed(&rsc1));
41 }
42 
43 PCMK__UNIT_TEST(NULL, NULL,
44  cmocka_unit_test(null_resource),
45  cmocka_unit_test(resource_is_managed),
46  cmocka_unit_test(resource_is_not_managed))
Scheduler API for resources.
bool pcmk_resource_is_managed(const pcmk_resource_t *rsc)
Definition: resources.c:41
#define PCMK__UNIT_TEST(group_setup, group_teardown,...)
unsigned long long flags
Definition: resources.h:428
pcmk_resource_t rsc1