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 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 Lesser General Public License
   7  * version 2.1 or later (LGPLv2.1+) 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 #include <crm/pengine/pe_types.h>
  15 #include <crm/pengine/status.h>
  16 
  17 #include "mock_private.h"
  18 
  19 static void
  20 check_defaults(void **state) {
     /* [previous][next][first][last][top][bottom][index][help] */
  21     uint32_t flags;
  22     pe_working_set_t *data_set = calloc(1, sizeof(pe_working_set_t));
  23 
  24     set_working_set_defaults(data_set);
  25 
  26     flags = pe_flag_stop_rsc_orphans|pe_flag_symmetric_cluster|pe_flag_stop_action_orphans;
  27 
  28     if (!strcmp(PCMK__CONCURRENT_FENCING_DEFAULT, "true")) {
  29         flags |= pe_flag_concurrent_fencing;
  30     }
  31 
  32 
  33     assert_null(data_set->priv);
  34     assert_int_equal(data_set->order_id, 1);
  35     assert_int_equal(data_set->action_id, 1);
  36     assert_int_equal(data_set->no_quorum_policy, no_quorum_stop);
  37     assert_int_equal(data_set->flags, flags);
  38 
  39     /* Avoid calling pe_free_working_set here so we don't artificially
  40      * inflate the coverage numbers.
  41      */
  42     free(data_set);
  43 }
  44 
  45 PCMK__UNIT_TEST(NULL, NULL,
  46                 cmocka_unit_test(check_defaults))

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