root/lib/common/tests/scheduler/pcmk_has_quorum_test.c

/* [previous][next][first][last][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. null_scheduler
  2. valid_scheduler

   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 <crm/common/scheduler.h>
  13 #include <crm/common/scheduler_internal.h>
  14 #include <crm/common/unittest_internal.h>
  15 
  16 static void
  17 null_scheduler(void **state)
     /* [previous][next][first][last][top][bottom][index][help] */
  18 {
  19     assert_false(pcmk_has_quorum(NULL));
  20 }
  21 
  22 static void
  23 valid_scheduler(void **state)
     /* [previous][next][first][last][top][bottom][index][help] */
  24 {
  25     pcmk_scheduler_t scheduler = {
  26         .flags = pcmk__sched_quorate,
  27     };
  28 
  29     assert_true(pcmk_has_quorum(&scheduler));
  30 
  31     scheduler.flags = pcmk__sched_none;
  32     assert_false(pcmk_has_quorum(&scheduler));
  33 }
  34 
  35 PCMK__UNIT_TEST(NULL, NULL,
  36                 cmocka_unit_test(null_scheduler),
  37                 cmocka_unit_test(valid_scheduler))

/* [previous][next][first][last][top][bottom][index][help] */