|
| 1 | +%% This Source Code Form is subject to the terms of the Mozilla Public |
| 2 | +%% License, v. 2.0. If a copy of the MPL was not distributed with this |
| 3 | +%% file, You can obtain one at https://mozilla.org/MPL/2.0/. |
| 4 | +%% |
| 5 | +%% Copyright (c) 2007-2026 Broadcom. All Rights Reserved. The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. All rights reserved. |
| 6 | +%% |
| 7 | + |
| 8 | +-module(rabbit_ra_systems_SUITE). |
| 9 | + |
| 10 | +-compile(export_all). |
| 11 | + |
| 12 | +-include_lib("common_test/include/ct.hrl"). |
| 13 | +-include_lib("eunit/include/eunit.hrl"). |
| 14 | + |
| 15 | +all() -> |
| 16 | + [ |
| 17 | + coordination_defaults, |
| 18 | + coordination_wal_max_size_bytes_default, |
| 19 | + quorum_queue_defaults |
| 20 | + ]. |
| 21 | + |
| 22 | +init_per_suite(Config) -> |
| 23 | + rabbit_ct_helpers:log_environment(), |
| 24 | + Config1 = rabbit_ct_helpers:run_setup_steps(Config), |
| 25 | + rabbit_ct_config_schema:init_schemas(rabbit, Config1). |
| 26 | + |
| 27 | +end_per_suite(Config) -> |
| 28 | + rabbit_ct_helpers:run_teardown_steps(Config). |
| 29 | + |
| 30 | +init_per_testcase(Testcase, Config) -> |
| 31 | + rabbit_ct_helpers:testcase_started(Config, Testcase), |
| 32 | + Config1 = rabbit_ct_helpers:set_config(Config, [ |
| 33 | + {rmq_nodename_suffix, Testcase} |
| 34 | + ]), |
| 35 | + rabbit_ct_helpers:run_steps(Config1, |
| 36 | + rabbit_ct_broker_helpers:setup_steps() ++ |
| 37 | + rabbit_ct_client_helpers:setup_steps()). |
| 38 | + |
| 39 | +end_per_testcase(Testcase, Config) -> |
| 40 | + Config1 = rabbit_ct_helpers:run_steps(Config, |
| 41 | + rabbit_ct_client_helpers:teardown_steps() ++ |
| 42 | + rabbit_ct_broker_helpers:teardown_steps()), |
| 43 | + rabbit_ct_helpers:testcase_finished(Config1, Testcase). |
| 44 | + |
| 45 | +coordination_defaults(Config) -> |
| 46 | + ok = rabbit_ct_broker_helpers:rpc(Config, 0, |
| 47 | + ?MODULE, check_coordination_defaults, []). |
| 48 | + |
| 49 | +coordination_wal_max_size_bytes_default(Config) -> |
| 50 | + ok = rabbit_ct_broker_helpers:rpc(Config, 0, |
| 51 | + ?MODULE, check_coordination_wal_max_size_bytes_default, []). |
| 52 | + |
| 53 | +quorum_queue_defaults(Config) -> |
| 54 | + ok = rabbit_ct_broker_helpers:rpc(Config, 0, |
| 55 | + ?MODULE, check_quorum_queue_defaults, []). |
| 56 | + |
| 57 | +check_coordination_defaults() -> |
| 58 | + %% Get the coordination Ra system config |
| 59 | + Config = rabbit_ra_systems:get_config(coordination), |
| 60 | + |
| 61 | + %% Verify that all expected keys are present |
| 62 | + ?assert(maps:is_key(wal_compute_checksums, Config)), |
| 63 | + ?assert(maps:is_key(segment_compute_checksums, Config)), |
| 64 | + ?assert(maps:is_key(wal_max_size_bytes, Config)), |
| 65 | + ?assert(maps:is_key(wal_max_entries, Config)), |
| 66 | + ?assert(maps:is_key(wal_max_batch_size, Config)), |
| 67 | + ?assert(maps:is_key(segment_max_size_bytes, Config)), |
| 68 | + ?assert(maps:is_key(segment_max_entries, Config)), |
| 69 | + ?assert(maps:is_key(default_max_append_entries_rpc_batch_size, Config)), |
| 70 | + ?assert(maps:is_key(compress_mem_tables, Config)), |
| 71 | + ?assert(maps:is_key(snapshot_chunk_size, Config)), |
| 72 | + |
| 73 | + %% Verify default boolean values |
| 74 | + ?assertEqual(true, maps:get(wal_compute_checksums, Config)), |
| 75 | + ?assertEqual(true, maps:get(segment_compute_checksums, Config)), |
| 76 | + ?assertEqual(true, maps:get(compress_mem_tables, Config)), |
| 77 | + |
| 78 | + ok. |
| 79 | + |
| 80 | +check_coordination_wal_max_size_bytes_default() -> |
| 81 | + %% Get the coordination Ra system config |
| 82 | + Config = rabbit_ra_systems:get_config(coordination), |
| 83 | + |
| 84 | + %% Verify that wal_max_size_bytes defaults to 64 MB (64_000_000 bytes) |
| 85 | + WalMaxSizeBytes = maps:get(wal_max_size_bytes, Config), |
| 86 | + ExpectedWalMaxSizeBytes = 64_000_000, |
| 87 | + ?assertEqual(ExpectedWalMaxSizeBytes, WalMaxSizeBytes), |
| 88 | + |
| 89 | + ok. |
| 90 | + |
| 91 | +check_quorum_queue_defaults() -> |
| 92 | + %% Get the quorum_queues Ra system config |
| 93 | + Config = rabbit_ra_systems:get_config(quorum_queues), |
| 94 | + |
| 95 | + %% Verify that all expected keys are present |
| 96 | + ?assert(maps:is_key(wal_compute_checksums, Config)), |
| 97 | + ?assert(maps:is_key(segment_compute_checksums, Config)), |
| 98 | + ?assert(maps:is_key(wal_max_size_bytes, Config)), |
| 99 | + ?assert(maps:is_key(wal_max_entries, Config)), |
| 100 | + ?assert(maps:is_key(wal_max_batch_size, Config)), |
| 101 | + ?assert(maps:is_key(segment_max_size_bytes, Config)), |
| 102 | + ?assert(maps:is_key(segment_max_entries, Config)), |
| 103 | + ?assert(maps:is_key(default_max_append_entries_rpc_batch_size, Config)), |
| 104 | + ?assert(maps:is_key(compress_mem_tables, Config)), |
| 105 | + ?assert(maps:is_key(snapshot_chunk_size, Config)), |
| 106 | + ?assert(maps:is_key(server_recovery_strategy, Config)), |
| 107 | + |
| 108 | + ok. |
0 commit comments