pacemaker 2.1.8-2.1.8
Scalable High-Availability cluster resource manager
Loading...
Searching...
No Matches
pcmk_node_is_pending_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#include <glib.h> // TRUE, FALSE
14
15#include <crm/common/nodes.h>
17
18static void
19null_is_not_pending(void **state)
20{
21 assert_false(pcmk_node_is_pending(NULL));
22}
23
24static void
25node_is_pending(void **state)
26{
27 struct pe_node_shared_s shared = {
28 .pending = TRUE,
29 };
30
31 pcmk_node_t node = {
32 .details = &shared,
33 };
34
35 assert_true(pcmk_node_is_pending(&node));
36}
37
38static void
39node_is_not_pending(void **state)
40{
41 struct pe_node_shared_s shared = {
42 .pending = FALSE,
43 };
44 pcmk_node_t node = {
45 .details = &shared,
46 };
47
48 assert_false(pcmk_node_is_pending(&node));
49}
50
51PCMK__UNIT_TEST(NULL, NULL,
52 cmocka_unit_test(null_is_not_pending),
53 cmocka_unit_test(node_is_pending),
54 cmocka_unit_test(node_is_not_pending))
Scheduler API for nodes.
bool pcmk_node_is_pending(const pcmk_node_t *node)
Definition nodes.c:42
struct pe_node_shared_s * details
Definition nodes.h:167
gboolean pending
Definition nodes.h:87
#define PCMK__UNIT_TEST(group_setup, group_teardown,...)