myxce/src/lib/testsuite/test_config.c
Rongsong Shen 7b6cbb8e3e fix(test): sync test_config DEFAULT_SYNC_TIMEOUT_MS assertion to 500
Commit ca1d9ae raised the commit-barrier default 50->500ms in config.h
but left test_config.c asserting ==50, leaving test_persistence_constants
failing on HEAD. Sync the assertion to the committed constant.

Unrelated to raft-log-replication; fixed in isolation so the library
suite has a clean baseline for the spec's task-10.1 green gate.
2026-06-21 15:18:39 +00:00

61 lines
1.8 KiB
C

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unity/unity.h>
#include "config.h"
static void test_cluster_id(void)
{
TEST_ASSERT_TRUE(MAX_CLUSTER_ID == 63);
TEST_ASSERT_TRUE(CLUSTER_ID_SHIFT == 56);
}
static void test_apiserver_id(void)
{
TEST_ASSERT_TRUE(MAX_APISERVER_ID == 15);
TEST_ASSERT_TRUE(APISERVER_ID_SHIFT == 52);
}
static void test_timestamp(void) { TEST_ASSERT_TRUE(TIMESTAMP_SHIFT == 20); }
static void test_tag(void) { TEST_ASSERT_TRUE(TAG_SHIFT == 62); }
static void test_array(void)
{
TEST_ASSERT_TRUE(SEQUENCE_HIGH_SHIFT == 15);
TEST_ASSERT_TRUE(MAX_ARRAY_IDX == 32767);
}
static void test_persistence_constants(void)
{
TEST_ASSERT_TRUE(MAX_STANDBYS == 3);
TEST_ASSERT_TRUE(MAX_HA_CANDIDATES == 4);
TEST_ASSERT_TRUE(WAL_FORMAT_VERSION == 1);
TEST_ASSERT_TRUE(WAL_ENTRY_TYPE_MAX == 100);
TEST_ASSERT_TRUE(MAX_WAL_PAYLOAD_BYTES == (1 << 20));
TEST_ASSERT_TRUE(MAX_SNAPSHOT_BYTES == (256 * 1024 * 1024));
TEST_ASSERT_TRUE(DEFAULT_WAL_SYNC_MS == 10);
TEST_ASSERT_TRUE(DEFAULT_SNAP_INTERVAL_S == 60);
TEST_ASSERT_TRUE(DEFAULT_SNAP_WAL_SIZE_MB == 64);
TEST_ASSERT_TRUE(DEFAULT_SNAP_KEEP_N == 2);
TEST_ASSERT_TRUE(DEFAULT_FINISHED_RETAIN_S == 3600);
TEST_ASSERT_TRUE(DEFAULT_WORKER_RETAIN_S == 86400);
TEST_ASSERT_TRUE(DEFAULT_SYNC_TIMEOUT_MS == 500);
TEST_ASSERT_TRUE(DEFAULT_HB_INTERVAL_MS == 3000);
TEST_ASSERT_TRUE(DEFAULT_TRANSIENT_JOB_TIMEOUT_S == 300);
TEST_ASSERT_TRUE(WAL_HDR_CRC_SIZE == 32);
TEST_ASSERT_TRUE(WAL_CRC_NONE == 0xFFFFFFFFu);
}
void test_config(void)
{
printf("\n>> config test\n\n");
RUN_TEST(test_cluster_id);
RUN_TEST(test_apiserver_id);
RUN_TEST(test_timestamp);
RUN_TEST(test_tag);
RUN_TEST(test_array);
RUN_TEST(test_persistence_constants);
}