feat(resource-value-verification): extract resupdate type-resolution logic (task 1.1)

Move set_resval()'s resource-name lookup table into a new, dependency-light
resval_typeresolve.c/.h module so it's independently unit-testable (test.c
can't be white-box included into Unity). Adds RED tests for the not-yet-
implemented numeric-fallback/type-override behavior (task 2.1).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Rongsong Shen 2026-08-17 23:03:57 +00:00
parent 54ea3bc5b5
commit 98b8c34bec
Signed by: rshen
SSH key fingerprint: SHA256:8Vf2pZ3h6rJa7EhGK+WaAQ9Mta/apZvteW6g9U/WKKk
5 changed files with 357 additions and 1 deletions

View file

@ -54,7 +54,7 @@ controller = executable('xce_controller',
link_args: wrap_link_args,
install: true)
xce_test_src = [ 'testsuite/test.c', 'testsuite/waldump.c', 'testsuite/walcompare.c', 'testsuite/snapverify.c', 'testsuite/snapdiff.c', 'testsuite/configcompare.c']
xce_test_src = [ 'testsuite/test.c', 'testsuite/waldump.c', 'testsuite/walcompare.c', 'testsuite/snapverify.c', 'testsuite/snapdiff.c', 'testsuite/configcompare.c', 'testsuite/resval_typeresolve.c']
# BSD-licensed readline replacement (scheduler-core spec, task 12.1 review
# finding): GNU readline is GPL; xce_test's REPL only needs readline()/
@ -283,3 +283,29 @@ test('apiserver push test', apiserver_push_unit_test,
timeout: 60,
env: ['ASAN_OPTIONS=detect_leaks=0'])
# resource-value-verification task 1.1: resval_typeresolve.c is a small,
# dependency-light module (no networking/REPL/global state) extracted from
# test.c's set_resval() specifically so its name -> Value_u_which resolution
# logic can be unit-tested in isolation -- test.c itself (4298 lines, its own
# main(), heavy libedit/network dependencies) cannot be white-box included
# into a Unity test. Standalone binary (not folded into controller_unit_test_
# src) since it has zero dependency on controller.c/cluster.c internals,
# mirroring sched_push_unit_test's/apiserver_push_unit_test's own standalone-
# binary rationale above.
resval_typeresolve_unit_test_src = [
'testsuite/test_resval_typeresolve.c',
'testsuite/resval_typeresolve.c',
]
resval_typeresolve_unit_test = executable('resval_typeresolve_unit_test',
resval_typeresolve_unit_test_src,
include_directories: [incdir],
dependencies: controller_unit_test_deps,
c_args: ['-DXCE_TESTING'],
install: false)
test('resval typeresolve test', resval_typeresolve_unit_test,
suite: 'controller',
timeout: 60,
env: ['ASAN_OPTIONS=detect_leaks=0'])