yams/tests/integration/daemon/meson.build
Trevon 60dd2c9afe
fix(daemon): admit cold reads and preserve sync deferral accounting (#331)
Dispatch explicit committed memory reads on admitted workers, checking the
governor before queueing and before I/O. Require the coordinator instead of
using the synchronous strand fallback; keep cached APIs and wire opcodes
unchanged and preserve task-record validation.

Use the paged content adapter, distinguish typed local admission deferral
from hard errors and retain known deferred totals/ages after incomplete
scans. Forward exact topology totals independently of diagnostic samples
and keep attempted cycles distinct from complete scans and successful apply.

Add real daemon IPC tests for authenticated off-resident reads, pressure
health, exact 70-edge status/retry accounting and authenticated cold document
retrieval through the existing MCP get handler, DaemonClient IPC and CAS.
Reanchor existing dispatcher environment-read entries without new exceptions.

Scan uncertainty remains C++-only: typed wire/status/MCP exposure, broader
fault/readiness/P2P convergence and patched resource measurements remain open.

Signed-off-by: trvon <git@trevon.dev>
2026-10-22 07:12:25 -06:00

946 lines
34 KiB
Meson

# Daemon integration tests - Catch2 socket/client integration tests
#
# IMPORTANT: Each test case runs in its own process to avoid static pool state
# issues (RepairThreadPool, ConnectionRegistry, GlobalIOContext) that cause
# std::future_error crashes when multiple daemon instances are created/destroyed
# within a single process.
if not catch2_dep.found()
message('Catch2 not found; skipping daemon integration tests (PBI-066).')
else
daemon_catch2_srcs = files(
'daemon_socket_client_test.cpp',
)
daemon_shutdown_srcs = files(
'daemon_shutdown_test.cpp',
)
daemon_harness_srcs = files(
'daemon_harness_catch2_test.cpp',
)
post_ingest_queue_validation_srcs = files(
'post_ingest_queue_validation_test.cpp',
)
post_ingest_queue_benchmark_srcs = files(
'post_ingest_queue_benchmark_test.cpp',
)
post_ingest_trace_srcs = files(
'post_ingest_trace.cpp',
)
client_timeout_recovery_srcs = files(
'client_timeout_recovery_test.cpp',
)
codex_sandbox_embedding_regression_srcs = files(
'codex_sandbox_embedding_regression_test.cpp',
)
# idle_streaming and writer_drain tests removed - timing-sensitive and flaky in CI
# See git history for original implementation if needed
socket_memory_pressure_srcs = files(
'socket_memory_pressure_test.cpp',
)
stats_command_crash_srcs = files(
'stats_command_crash_test.cpp',
)
daemon_db_corruption_recovery_srcs = files(
'daemon_db_corruption_recovery_test.cpp',
)
cli_responsiveness_under_load_srcs = files(
'cli_responsiveness_under_load_test.cpp',
)
ghidra_kg_entity_ingestion_srcs = files(
'ghidra_kg_entity_ingestion_test.cpp',
)
daemon_sigterm_srcs = files(
'daemon_sigterm_test.cpp',
)
proxy_slot_starvation_srcs = files(
'proxy_slot_starvation_test.cpp',
)
lifecycle_single_instance_srcs = files(
'lifecycle_single_instance_test.cpp',
)
memory_sync_service_integration_srcs = files(
'memory_sync_service_integration_test.cpp',
)
dbg = (get_option('buildtype') == 'debug')
daemon_integration_timeout = 1200
if (get_option('enable-integration-tests') or dbg)
# catch2_main_dep is inherited from parent tests/meson.build - no need to redeclare
# Common environment for daemon tests
_daemon_test_env = {
'YAMS_TEST_SAFE_SINGLE_INSTANCE': '1',
'YAMS_DISABLE_VECTORS': '1',
'YAMS_DISABLE_SESSION_WATCHER': '1',
'TSAN_OPTIONS': _test_tsan_options,
}
daemon_catch2_exe = executable('yams_daemon_socket_tests_catch2',
daemon_catch2_srcs,
include_directories: incs,
dependencies: [catch2_dep, catch2_main_dep, test_deps, catch2_trailing_link_deps],
cpp_args: ['-DYAMS_TESTING=1'],
install: false,
)
# Split socket tests into individual processes to avoid static pool state issues
# Each test case creates/destroys a daemon, and static singletons (RepairThreadPool,
# ConnectionRegistry) don't reset properly between runs, causing future_error crashes.
test('daemon_socket_connection_lifecycle',
daemon_catch2_exe,
suite: ['integration', 'daemon', 'catch2', 'socket'],
env: _daemon_test_env,
is_parallel: false,
timeout: daemon_integration_timeout,
args: ['Daemon socket connection lifecycle', '--allow-running-no-tests'],
)
test('daemon_socket_request_execution',
daemon_catch2_exe,
suite: ['integration', 'daemon', 'catch2', 'socket'],
env: _daemon_test_env,
is_parallel: false,
timeout: daemon_integration_timeout,
args: ['Daemon client request execution', '--allow-running-no-tests'],
)
test('daemon_socket_download_job_request_execution',
daemon_catch2_exe,
suite: ['integration', 'daemon', 'catch2', 'socket', 'download-jobs'],
env: _daemon_test_env,
is_parallel: false,
timeout: daemon_integration_timeout,
args: ['Daemon client download job request execution', '--allow-running-no-tests'],
)
test('daemon_socket_model_request_execution',
daemon_catch2_exe,
suite: ['integration', 'daemon', 'catch2', 'socket'],
env: _daemon_test_env,
is_parallel: false,
timeout: daemon_integration_timeout,
args: ['Daemon client model request execution', '--allow-running-no-tests'],
)
test('daemon_socket_plugin_request_execution',
daemon_catch2_exe,
suite: ['integration', 'daemon', 'catch2', 'socket'],
env: _daemon_test_env,
is_parallel: false,
timeout: daemon_integration_timeout,
args: ['Daemon client plugin request execution', '--allow-running-no-tests'],
)
test('daemon_socket_prune_request_execution',
daemon_catch2_exe,
suite: ['integration', 'daemon', 'catch2', 'socket'],
env: _daemon_test_env,
is_parallel: false,
timeout: daemon_integration_timeout,
args: ['Daemon client prune request execution', '--allow-running-no-tests'],
)
test('daemon_socket_graph_request_execution',
daemon_catch2_exe,
suite: ['integration', 'daemon', 'catch2', 'socket'],
env: _daemon_test_env,
is_parallel: false,
timeout: daemon_integration_timeout,
args: ['Daemon client graph maintenance request execution', '--allow-running-no-tests'],
)
test('daemon_socket_collection_request_execution',
daemon_catch2_exe,
suite: ['integration', 'daemon', 'catch2', 'socket'],
env: _daemon_test_env,
is_parallel: false,
timeout: daemon_integration_timeout,
args: ['Daemon client collection request execution', '--allow-running-no-tests'],
)
test('daemon_socket_tree_diff_request_execution',
daemon_catch2_exe,
suite: ['integration', 'daemon', 'catch2', 'socket'],
env: _daemon_test_env,
is_parallel: false,
timeout: daemon_integration_timeout,
args: ['Daemon client tree diff request execution', '--allow-running-no-tests'],
)
test('daemon_socket_session_request_execution',
daemon_catch2_exe,
suite: ['integration', 'daemon', 'catch2', 'socket'],
env: _daemon_test_env,
is_parallel: false,
timeout: daemon_integration_timeout,
args: ['Daemon client session request execution', '--allow-running-no-tests'],
)
test('daemon_socket_repair_request_execution',
daemon_catch2_exe,
suite: ['integration', 'daemon', 'catch2', 'socket'],
env: _daemon_test_env,
is_parallel: false,
timeout: daemon_integration_timeout,
args: ['Daemon client repair request execution', '--allow-running-no-tests'],
)
test('daemon_socket_error_handling',
daemon_catch2_exe,
suite: ['integration', 'daemon', 'catch2', 'socket'],
env: _daemon_test_env,
is_parallel: false,
timeout: daemon_integration_timeout,
args: ['Daemon client error handling', '--allow-running-no-tests'],
)
test('daemon_socket_concurrent_requests',
daemon_catch2_exe,
suite: ['integration', 'daemon', 'catch2', 'socket'],
env: _daemon_test_env,
is_parallel: false,
timeout: daemon_integration_timeout,
args: ['Daemon client concurrent requests', '--allow-running-no-tests'],
)
test('daemon_socket_timeout_behavior',
daemon_catch2_exe,
suite: ['integration', 'daemon', 'catch2', 'socket'],
env: _daemon_test_env,
is_parallel: false,
timeout: daemon_integration_timeout,
args: ['Daemon client timeout behavior', '--allow-running-no-tests'],
)
test('daemon_socket_move_semantics',
daemon_catch2_exe,
suite: ['integration', 'daemon', 'catch2', 'socket'],
env: _daemon_test_env,
is_parallel: false,
timeout: daemon_integration_timeout,
args: ['Daemon client move semantics', '--allow-running-no-tests'],
)
test('daemon_socket_file_lifecycle',
daemon_catch2_exe,
suite: ['integration', 'daemon', 'catch2', 'socket'],
env: _daemon_test_env,
is_parallel: false,
timeout: daemon_integration_timeout,
args: ['Daemon socket file lifecycle', '--allow-running-no-tests'],
)
daemon_shutdown_exe = executable('yams_daemon_shutdown_tests_catch2',
daemon_shutdown_srcs,
include_directories: incs,
dependencies: [catch2_dep, catch2_main_dep, test_deps, catch2_trailing_link_deps],
cpp_args: ['-DYAMS_TESTING=1'],
install: false,
)
daemon_harness_exe = executable('yams_daemon_harness_tests_catch2',
daemon_harness_srcs,
include_directories: incs,
dependencies: [catch2_dep, catch2_main_dep, test_deps, catch2_trailing_link_deps],
cpp_args: ['-DYAMS_TESTING=1'],
install: false,
)
test('daemon_harness_startup_rollback',
daemon_harness_exe,
suite: ['integration', 'daemon', 'catch2', 'harness'],
env: _daemon_test_env,
is_parallel: false,
timeout: daemon_integration_timeout,
args: [
'DaemonHarness rolls back owned endpoints when startup callback fails',
'--allow-running-no-tests',
],
)
test('daemon_harness_endpoint_ownership',
daemon_harness_exe,
suite: ['integration', 'daemon', 'catch2', 'harness'],
env: _daemon_test_env,
is_parallel: false,
timeout: daemon_integration_timeout,
args: [
'DaemonHarness preserves endpoints claimed after fixture construction',
'--allow-running-no-tests',
],
)
test('daemon_harness_config_exception',
daemon_harness_exe,
suite: ['integration', 'daemon', 'catch2', 'harness'],
env: _daemon_test_env,
is_parallel: false,
timeout: daemon_integration_timeout,
args: [
'DaemonHarness restores process state when configuration throws',
'--allow-running-no-tests',
],
)
test('daemon_harness_config_lifecycle',
daemon_harness_exe,
suite: ['integration', 'daemon', 'catch2', 'harness'],
env: _daemon_test_env,
is_parallel: false,
timeout: daemon_integration_timeout,
args: [
'DaemonHarness isolates config and observes lifecycle cleanup',
'--allow-running-no-tests',
],
)
test('daemon_harness_full_isolation',
daemon_harness_exe,
suite: ['integration', 'daemon', 'catch2', 'harness'],
env: _daemon_test_env,
is_parallel: false,
timeout: daemon_integration_timeout,
args: [
'DaemonHarness full isolation ignores ambient developer config and data',
'--allow-running-no-tests',
],
)
# Split shutdown tests into individual processes
test('daemon_shutdown_timing',
daemon_shutdown_exe,
suite: ['integration', 'daemon', 'catch2', 'shutdown'],
env: _daemon_test_env,
is_parallel: false,
timeout: daemon_integration_timeout,
args: ['Daemon shutdown timing', '--allow-running-no-tests'],
)
test('daemon_shutdown_inflight_ops',
daemon_shutdown_exe,
suite: ['integration', 'daemon', 'catch2', 'shutdown'],
env: _daemon_test_env,
is_parallel: false,
timeout: daemon_integration_timeout,
args: ['Daemon shutdown with in-flight operations', '--allow-running-no-tests'],
)
test('daemon_shutdown_draining_connections',
daemon_shutdown_exe,
suite: ['integration', 'daemon', 'catch2', 'shutdown'],
env: _daemon_test_env,
is_parallel: false,
timeout: daemon_integration_timeout,
args: ['Daemon stop outlives connections still draining on the IO threads',
'--allow-running-no-tests'],
)
# Removed flaky shutdown tests (idempotency, after_ops, under_load, graceful)
# Core shutdown behavior is covered by timing and inflight_ops tests above
post_ingest_queue_validation_exe = executable('yams_post_ingest_queue_validation',
post_ingest_queue_validation_srcs,
include_directories: incs,
dependencies: [catch2_dep, catch2_main_dep, test_deps, catch2_trailing_link_deps],
cpp_args: ['-DYAMS_TESTING=1'],
install: false,
)
test('post_ingest_queue_validation',
post_ingest_queue_validation_exe,
suite: ['integration', 'daemon', 'catch2', 'post-ingest'],
env: _daemon_test_env,
is_parallel: false,
timeout: daemon_integration_timeout,
args: ['--allow-running-no-tests'],
)
if get_option('enable-bench-tests')
post_ingest_queue_benchmark_exe = executable('yams_post_ingest_queue_benchmark',
post_ingest_queue_benchmark_srcs,
include_directories: incs,
dependencies: [catch2_dep, catch2_main_dep, test_deps, catch2_trailing_link_deps],
cpp_args: ['-DYAMS_TESTING=1'],
install: false,
)
test('post_ingest_queue_benchmark',
post_ingest_queue_benchmark_exe,
suite: ['integration', 'daemon', 'catch2', 'post-ingest', 'benchmark'],
env: _daemon_test_env,
is_parallel: false,
timeout: 600, # Longer timeout for benchmark
args: ['--allow-running-no-tests'],
)
endif
client_timeout_recovery_exe = executable('yams_client_timeout_recovery_tests_catch2',
client_timeout_recovery_srcs,
include_directories: incs,
dependencies: [catch2_dep, catch2_main_dep, test_deps, catch2_trailing_link_deps],
cpp_args: ['-DYAMS_TESTING=1'],
install: false,
)
test('client_timeout_recovery',
client_timeout_recovery_exe,
suite: ['integration', 'daemon', 'catch2', 'timeout'],
env: _daemon_test_env,
is_parallel: false,
timeout: daemon_integration_timeout,
args: ['--allow-running-no-tests'],
)
# idle_streaming and writer_drain executables/tests removed (flaky)
socket_memory_pressure_exe = executable('yams_socket_memory_pressure_tests_catch2',
socket_memory_pressure_srcs,
include_directories: incs,
dependencies: [catch2_dep, catch2_main_dep, test_deps, catch2_trailing_link_deps],
cpp_args: ['-DYAMS_TESTING=1'],
install: false,
)
test('socket_memory_pressure',
socket_memory_pressure_exe,
suite: ['integration', 'daemon', 'catch2', 'socket', 'memory-pressure', 'crash'],
env: _daemon_test_env,
is_parallel: false,
timeout: daemon_integration_timeout,
args: ['--allow-running-no-tests'],
)
stats_command_crash_exe = executable('yams_stats_command_crash_tests_catch2',
stats_command_crash_srcs,
include_directories: incs,
dependencies: [catch2_dep, catch2_main_dep, test_deps, catch2_trailing_link_deps],
cpp_args: ['-DYAMS_TESTING=1'],
install: false,
)
test('stats_command_crash',
stats_command_crash_exe,
suite: ['integration', 'daemon', 'catch2', 'stats', 'crash'],
env: _daemon_test_env,
is_parallel: false,
timeout: daemon_integration_timeout,
)
daemon_db_corruption_recovery_exe = executable('yams_daemon_db_corruption_recovery_tests_catch2',
daemon_db_corruption_recovery_srcs,
include_directories: incs,
dependencies: [catch2_dep, catch2_main_dep, test_deps, catch2_trailing_link_deps],
cpp_args: ['-DYAMS_TESTING=1'],
install: false,
)
test('daemon_db_corruption_recovery',
daemon_db_corruption_recovery_exe,
suite: ['integration', 'daemon', 'catch2', 'db_recovery'],
env: _daemon_test_env,
is_parallel: false,
timeout: daemon_integration_timeout,
args: ['--allow-running-no-tests'],
)
cli_responsiveness_under_load_exe = executable('yams_cli_responsiveness_under_load_tests_catch2',
cli_responsiveness_under_load_srcs,
include_directories: incs,
dependencies: [catch2_dep, catch2_main_dep, test_deps, catch2_trailing_link_deps],
cpp_args: ['-DYAMS_TESTING=1'],
install: false,
)
test('cli_responsiveness_under_load',
cli_responsiveness_under_load_exe,
suite: ['integration', 'daemon', 'catch2', 'cli', 'responsiveness', 'load'],
env: _daemon_test_env,
is_parallel: false,
timeout: 120, # 2 minutes for load testing
args: ['--allow-running-no-tests'],
)
# KG tests need vectors enabled, but still disable session watcher
_kg_test_env = {
'YAMS_TEST_SAFE_SINGLE_INSTANCE': '1',
'YAMS_DISABLE_SESSION_WATCHER': '1',
'TSAN_OPTIONS': _test_tsan_options,
}
ghidra_kg_entity_ingestion_exe = executable('yams_ghidra_kg_entity_ingestion_tests_catch2',
ghidra_kg_entity_ingestion_srcs,
include_directories: incs,
dependencies: [catch2_dep, catch2_main_dep, test_deps, catch2_trailing_link_deps],
cpp_args: ['-DYAMS_TESTING=1'],
install: false,
)
test('ghidra_kg_entity_ingestion',
ghidra_kg_entity_ingestion_exe,
suite: ['integration', 'daemon', 'catch2', 'kg', 'ghidra', 'pbi-3jb'],
env: _kg_test_env,
is_parallel: false,
timeout: daemon_integration_timeout,
args: ['--allow-running-no-tests'],
)
codex_sandbox_embedding_regression_exe = executable('yams_codex_sandbox_embedding_regression_tests_catch2',
codex_sandbox_embedding_regression_srcs,
include_directories: incs,
dependencies: [catch2_dep, catch2_main_dep, test_deps,
dependency('yams_daemon_client_embedded'), catch2_trailing_link_deps],
cpp_args: ['-DYAMS_TESTING=1'],
install: false,
)
test('codex_sandbox_embedding_regression',
codex_sandbox_embedding_regression_exe,
suite: ['integration', 'daemon', 'catch2', 'sandbox', 'embeddings'],
env: _kg_test_env,
is_parallel: false,
timeout: daemon_integration_timeout,
args: ['--allow-running-no-tests'],
)
# SIGTERM signal handling tests (yams-qe6r)
daemon_sigterm_exe = executable('yams_daemon_sigterm_tests_catch2',
daemon_sigterm_srcs,
include_directories: incs,
dependencies: [catch2_dep, catch2_main_dep, test_deps, catch2_trailing_link_deps],
cpp_args: ['-DYAMS_TESTING=1'],
install: false,
)
proxy_slot_starvation_exe = executable('yams_proxy_slot_starvation_tests_catch2',
proxy_slot_starvation_srcs,
include_directories: incs,
dependencies: [catch2_dep, catch2_main_dep, test_deps, catch2_trailing_link_deps],
cpp_args: ['-DYAMS_TESTING=1'],
install: false,
)
test('proxy_slot_starvation',
proxy_slot_starvation_exe,
suite: ['integration', 'daemon', 'catch2', 'proxy', 'slots'],
env: _daemon_test_env,
is_parallel: false,
timeout: daemon_integration_timeout,
args: ['--allow-running-no-tests'],
)
test('daemon_sigterm_external_flag',
daemon_sigterm_exe,
suite: ['integration', 'daemon', 'catch2', 'sigterm'],
env: _daemon_test_env,
is_parallel: false,
timeout: daemon_integration_timeout,
args: ['Daemon responds to external shutdown flag', '--allow-running-no-tests'],
)
test('daemon_sigterm_timing',
daemon_sigterm_exe,
suite: ['integration', 'daemon', 'catch2', 'sigterm'],
env: _daemon_test_env,
is_parallel: false,
timeout: daemon_integration_timeout,
args: ['Daemon shutdown timing with external flag', '--allow-running-no-tests'],
)
# Data-dir single-instance enforcement tests
lifecycle_single_instance_exe = executable('yams_lifecycle_single_instance_tests_catch2',
lifecycle_single_instance_srcs,
include_directories: incs,
dependencies: [catch2_dep, catch2_main_dep, test_deps, catch2_trailing_link_deps],
cpp_args: ['-DYAMS_TESTING=1'],
install: false,
)
test('lifecycle_single_instance_lock',
lifecycle_single_instance_exe,
suite: ['integration', 'daemon', 'catch2', 'lifecycle', 'single-instance'],
env: _daemon_test_env,
is_parallel: false,
timeout: 120, # 2 minutes for takeover scenarios
args: ['Data-dir lock prevents concurrent access', '--allow-running-no-tests'],
)
test('lifecycle_single_instance_release',
lifecycle_single_instance_exe,
suite: ['integration', 'daemon', 'catch2', 'lifecycle', 'single-instance'],
env: _daemon_test_env,
is_parallel: false,
timeout: 60, # 1 minute for sequential start/stop
args: ['Data-dir lock released on shutdown', '--allow-running-no-tests'],
)
memory_sync_service_integration_exe = executable('yams_memory_sync_service_integration',
memory_sync_service_integration_srcs,
include_directories: incs,
dependencies: [catch2_dep, catch2_main_dep, test_deps, catch2_trailing_link_deps],
cpp_args: ['-DYAMS_TESTING=1', _test_timeout_cpp_arg],
install: false,
)
test('daemon_memory_sync_auth_startup_failure',
memory_sync_service_integration_exe,
suite: ['integration', 'daemon', 'catch2', 'memory-sync'],
env: _daemon_test_env,
is_parallel: false,
timeout: 30,
args: ['Daemon refuses enabled memory sync when writer authentication cannot initialize', '--allow-running-no-tests'],
)
test('daemon_memory_sync_periodic_convergence',
memory_sync_service_integration_exe,
suite: ['integration', 'daemon', 'catch2', 'memory-sync'],
env: _daemon_test_env,
is_parallel: false,
timeout: 60,
args: ['Daemon memory sync periodically converges and stops cleanly', '--allow-running-no-tests'],
)
test('daemon_memory_sync_delete_integrity',
memory_sync_service_integration_exe,
suite: ['integration', 'daemon', 'catch2', 'memory-sync'],
env: _daemon_test_env,
is_parallel: false,
timeout: 60,
args: ['Production document deletion also replicates content-byte deletion', '--allow-running-no-tests'],
)
test('daemon_memory_sync_apply_stop',
memory_sync_service_integration_exe,
suite: ['integration', 'daemon', 'catch2', 'memory-sync'],
env: _daemon_test_env,
is_parallel: false,
timeout: 60,
args: ['Daemon memory sync stop during production apply prevents later adapters', '--allow-running-no-tests'],
)
test('daemon_memory_sync_apply_serialization',
memory_sync_service_integration_exe,
suite: ['integration', 'daemon', 'catch2', 'memory-sync'],
env: _daemon_test_env,
is_parallel: false,
timeout: 60,
args: ['Daemon serializes concurrent memory sync apply callbacks', '--allow-running-no-tests'],
)
test('daemon_memory_sync_offresident_read',
memory_sync_service_integration_exe,
suite: ['integration', 'daemon', 'catch2', 'memory-sync'],
env: _daemon_test_env,
is_parallel: false,
timeout: 60,
args: ['Daemon memory sync IPC reads off-resident authenticated winners'],
)
test('daemon_memory_sync_mcp_cold_read',
memory_sync_service_integration_exe,
suite: ['integration', 'daemon', 'catch2', 'memory-sync', 'mcp'],
env: _daemon_test_env,
is_parallel: false,
timeout: 90,
args: ['MCP get serves authenticated replicated cold documents after content prerequisites'],
)
test('daemon_memory_sync_pressure_health',
memory_sync_service_integration_exe,
suite: ['integration', 'daemon', 'catch2', 'memory-sync'],
env: _daemon_test_env,
is_parallel: false,
timeout: 60,
args: ['Daemon memory sync pressure defers topology without reporting a hard failure'],
)
test('daemon_memory_sync_deferred_total',
memory_sync_service_integration_exe,
suite: ['integration', 'daemon', 'catch2', 'memory-sync'],
env: _daemon_test_env,
is_parallel: false,
timeout: 60,
args: ['Daemon topology status keeps exact deferred totals and retries local prerequisites'],
)
test('daemon_memory_sync_prerequisites',
memory_sync_service_integration_exe,
suite: ['integration', 'daemon', 'catch2', 'memory-sync'],
env: _daemon_test_env,
is_parallel: false,
timeout: 60,
args: ['Daemon memory sync stage failures neither skip later stages nor block retry', '--allow-running-no-tests'],
)
test('daemon_memory_sync_content_prerequisite',
memory_sync_service_integration_exe,
suite: ['integration', 'daemon', 'catch2', 'memory-sync'],
env: _daemon_test_env,
is_parallel: false,
timeout: 60,
args: ['Daemon memory sync requires content before metadata visibility', '--allow-running-no-tests'],
)
test('daemon_memory_sync_backfill_stop',
memory_sync_service_integration_exe,
suite: ['integration', 'daemon', 'catch2', 'memory-sync'],
env: _daemon_test_env,
is_parallel: false,
timeout: 60,
args: ['Daemon memory sync stop during production backfill bounds published documents', '--allow-running-no-tests'],
)
test('daemon_memory_sync_backfill_budget',
memory_sync_service_integration_exe,
suite: ['integration', 'daemon', 'catch2', 'memory-sync'],
env: _daemon_test_env,
is_parallel: false,
timeout: 60,
args: ['Daemon memory sync backfill budget resumes document cursor', '--allow-running-no-tests'],
)
test('daemon_memory_sync_poisoned_blob',
memory_sync_service_integration_exe,
suite: ['integration', 'daemon', 'catch2', 'memory-sync'],
env: _daemon_test_env,
is_parallel: false,
timeout: 60,
args: ['Daemon memory sync backfill skips a poisoned blob and continues', '--allow-running-no-tests'],
)
test('daemon_memory_sync_direct_delta_hydration',
memory_sync_service_integration_exe,
suite: ['integration', 'daemon', 'catch2', 'memory-sync'],
env: _daemon_test_env,
is_parallel: false,
timeout: 60,
args: ['Daemon direct deltas immediately hydrate content and metadata', '--allow-running-no-tests'],
)
test('daemon_memory_sync_temporary',
memory_sync_service_integration_exe,
suite: ['integration', 'daemon', 'catch2', 'memory-sync'],
env: _daemon_test_env,
is_parallel: false,
timeout: 60,
args: ['Daemon temporary memory sync converges inside one session and cleans only its namespace', '--allow-running-no-tests'],
)
test('lifecycle_repair_hysteresis',
lifecycle_single_instance_exe,
suite: ['integration', 'daemon', 'catch2', 'lifecycle', 'repair'],
env: _daemon_test_env,
is_parallel: false,
timeout: 120,
args: ['~[slow]', '--allow-running-no-tests'],
)
test('lifecycle_repair_hysteresis_slow',
lifecycle_single_instance_exe,
suite: ['integration', 'daemon', 'catch2', 'lifecycle', 'repair', 'slow'],
env: _daemon_test_env,
is_parallel: false,
timeout: 300,
args: ['[slow]', '--allow-running-no-tests'],
)
# ONNX Concurrency / TuneAdvisor integration tests
onnx_tuning_integration_srcs = files(
'onnx_tuning_integration_test.cpp',
)
onnx_tuning_integration_exe = executable('yams_onnx_tuning_integration_tests_catch2',
onnx_tuning_integration_srcs,
include_directories: incs,
dependencies: [catch2_dep, catch2_main_dep, test_deps, catch2_trailing_link_deps],
cpp_args: ['-DYAMS_TESTING=1'],
install: false,
)
# Split ONNX tuning tests into separate test cases to avoid state leakage
test('onnx_tuning_env_settings',
onnx_tuning_integration_exe,
suite: ['integration', 'daemon', 'catch2', 'onnx', 'tuning'],
env: _daemon_test_env,
is_parallel: false,
timeout: 300, # 5 sections, ~32s/section (EmbeddingService quiesce dominates)
args: ['OnnxConcurrencyRegistry respects TuneAdvisor env settings', '--allow-running-no-tests'],
)
test('onnx_tuning_embedding_lanes',
onnx_tuning_integration_exe,
suite: ['integration', 'daemon', 'catch2', 'onnx', 'embedding'],
env: _daemon_test_env,
is_parallel: false,
timeout: daemon_integration_timeout,
args: ['Embedding lane slots are configured correctly', '--allow-running-no-tests'],
)
test('onnx_tuning_fsm_metrics',
onnx_tuning_integration_exe,
suite: ['integration', 'daemon', 'catch2', 'onnx', 'metrics'],
env: _daemon_test_env,
is_parallel: false,
timeout: daemon_integration_timeout,
args: ['FSM metrics reflect ONNX configuration', '--allow-running-no-tests'],
)
test('onnx_tuning_lifecycle',
onnx_tuning_integration_exe,
suite: ['integration', 'daemon', 'catch2', 'onnx', 'lifecycle'],
env: _daemon_test_env,
is_parallel: false,
timeout: 120, # 2 minutes for daemon restarts
args: ['OnnxConcurrencyRegistry state resets on daemon restart', '--allow-running-no-tests'],
)
test('onnx_tuning_lanes',
onnx_tuning_integration_exe,
suite: ['integration', 'daemon', 'catch2', 'onnx', 'lanes'],
env: _daemon_test_env,
is_parallel: false,
timeout: daemon_integration_timeout,
args: ['Lane metrics update during slot acquisition', '--allow-running-no-tests'],
)
# Adapter test needs vectors ENABLED to test real ONNX plugin path
# Use _kg_test_env which doesn't have YAMS_DISABLE_VECTORS=1
test('onnx_tuning_adapter',
onnx_tuning_integration_exe,
suite: ['integration', 'daemon', 'catch2', 'onnx', 'adapter'],
env: _kg_test_env,
is_parallel: false,
timeout: 300, # 5 minutes - real ONNX model loading is slow
args: ['AbiModelProviderAdapter acquires SlotGuard during real embedding', '--allow-running-no-tests'],
)
test('onnx_tuning_config_backend',
onnx_tuning_integration_exe,
suite: ['integration', 'daemon', 'catch2', 'onnx', 'config'],
env: _kg_test_env,
is_parallel: false,
timeout: 300,
args: ['Config selecting onnx backend uses ONNX provider for embeddings', '--allow-running-no-tests'],
)
test('onnx_tuning_timeout',
onnx_tuning_integration_exe,
suite: ['integration', 'daemon', 'catch2', 'onnx', 'timeout'],
env: _daemon_test_env,
is_parallel: false,
timeout: daemon_integration_timeout,
args: ['ONNX slot exhaustion causes graceful timeout', '--allow-running-no-tests'],
)
# ResourceGovernor integration tests - verify throttling behavior during real operations
resource_governor_integration_srcs = files(
'resource_governor_integration_test.cpp',
)
resource_governor_integration_exe = executable('yams_resource_governor_integration_tests_catch2',
resource_governor_integration_srcs,
include_directories: incs,
dependencies: [catch2_dep, catch2_main_dep, test_deps, catch2_trailing_link_deps],
cpp_args: ['-DYAMS_TESTING=1'],
install: false,
)
# Split governor tests into separate test cases to avoid state leakage
test('resource_governor_status_metrics',
resource_governor_integration_exe,
suite: ['integration', 'daemon', 'catch2', 'governor', 'status'],
env: _daemon_test_env,
is_parallel: false,
timeout: daemon_integration_timeout,
args: ['ResourceGovernor metrics exposed in daemon status', '--allow-running-no-tests'],
)
test('resource_governor_singleton',
resource_governor_integration_exe,
suite: ['integration', 'daemon', 'catch2', 'governor', 'singleton'],
env: _daemon_test_env,
is_parallel: false,
timeout: daemon_integration_timeout,
args: ['ResourceGovernor singleton is accessible during daemon operation', '--allow-running-no-tests'],
)
test('resource_governor_pressure_detection',
resource_governor_integration_exe,
suite: ['integration', 'daemon', 'catch2', 'governor', 'pressure'],
env: _daemon_test_env,
is_parallel: false,
timeout: 120, # 2 minutes for ingest + processing
args: ['Governor detects pressure with low CPU threshold', '--allow-running-no-tests'],
)
test('resource_governor_scaling_caps',
resource_governor_integration_exe,
suite: ['integration', 'daemon', 'catch2', 'governor', 'scaling'],
env: _daemon_test_env,
is_parallel: false,
timeout: daemon_integration_timeout,
args: ['Governor scaling caps adjust based on pressure level', '--allow-running-no-tests'],
)
test('resource_governor_ingest_metrics',
resource_governor_integration_exe,
suite: ['integration', 'daemon', 'catch2', 'governor', 'ingest'],
env: _daemon_test_env,
is_parallel: false,
timeout: 120, # 2 minutes for ingest + processing
args: ['Status response contains governor metrics during ingest', '--allow-running-no-tests'],
)
test('resource_governor_snapshot',
resource_governor_integration_exe,
suite: ['integration', 'daemon', 'catch2', 'governor', 'snapshot'],
env: _daemon_test_env,
is_parallel: false,
timeout: daemon_integration_timeout,
args: ['ResourceGovernor snapshot contains valid metrics', '--allow-running-no-tests'],
)
test('resource_governor_concurrent',
resource_governor_integration_exe,
suite: ['integration', 'daemon', 'catch2', 'governor', 'concurrent'],
env: _daemon_test_env,
is_parallel: false,
timeout: daemon_integration_timeout,
args: ['Concurrent status queries return consistent governor data', '--allow-running-no-tests'],
)
# Diagnostic tool (not a test, but helpful for debugging)
post_ingest_trace_exe = executable('yams_post_ingest_trace',
post_ingest_trace_srcs,
include_directories: incs,
dependencies: test_deps,
cpp_args: ['-DYAMS_TESTING=1'],
install: false,
)
# HNSW Retrieval Diagnostic - tests vector search quality with known corpus
hnsw_retrieval_diagnostic_srcs = files(
'../vector/hnsw_retrieval_diagnostic.cpp',
)
hnsw_retrieval_diagnostic_exe = executable('hnsw_retrieval_diagnostic',
hnsw_retrieval_diagnostic_srcs,
include_directories: incs,
dependencies: [catch2_dep, catch2_main_dep, test_deps, catch2_trailing_link_deps],
cpp_args: ['-DYAMS_TESTING=1'],
install: false,
)
test('hnsw_retrieval_diagnostic',
hnsw_retrieval_diagnostic_exe,
suite: ['integration', 'daemon', 'catch2', 'hnsw', 'vector', 'diagnostic'],
env: _kg_test_env,
is_parallel: false,
timeout: 300, # 5 minutes for embedding generation
args: ['--allow-running-no-tests'],
)
else
message('daemon_socket_client test disabled (enable with -Denable-integration-tests=true).')
endif
endif