root/lib/pengine/tests/status/set_working_set_defaults_test.c

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

DEFINITIONS

This source file includes following definitions.
  1. check_defaults

   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/unittest_internal.h>
  13 
  14 #include <crm/common/scheduler.h>
  15 #include <crm/pengine/internal.h>
  16 #include <crm/pengine/status.h>
  17 
  18 #include "mock_private.h"
  19 
  20 static void
  21 check_defaults(void **state) {
     /* [previous][next][first][last][top][bottom][index][help] */
  22     uint32_t flags;
  23     pcmk_scheduler_t *scheduler = pcmk__assert_alloc(1,
  24                                                      sizeof(pcmk_scheduler_t));
  25 
  26     set_working_set_defaults(scheduler);
  27 
  28     flags = pcmk_sched_symmetric_cluster
  29 #if PCMK__CONCURRENT_FENCING_DEFAULT_TRUE
  30             |pcmk_sched_concurrent_fencing
  31 #endif
  32             |pcmk_sched_stop_removed_resources
  33             |pcmk_sched_cancel_removed_actions;
  34 
  35     assert_null(scheduler->priv);
  36     assert_int_equal(scheduler->order_id, 1);
  37     assert_int_equal(scheduler->action_id, 1);
  38     assert_int_equal(scheduler->no_quorum_policy, pcmk_no_quorum_stop);
  39     assert_int_equal(scheduler->flags, flags);
  40 
  41     /* Avoid calling pe_free_working_set here so we don't artificially
  42      * inflate the coverage numbers.
  43      */
  44     free(scheduler);
  45 }
  46 
  47 PCMK__UNIT_TEST(NULL, NULL,
  48                 cmocka_unit_test(check_defaults))

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