Repository navigation
test: move misfiled unit tests out of tests/ into their modules (T-06) - #392
Merged
Merged
Conversation
…#340) config_tests, serialization_tests, optimizer_tests, boundary_value_tests and the parser half of iql_syntax_tests exercise only library types, so they now build into the lib test binary; the storage half of iql_syntax_tests joins storage_engine_tests. Five fewer test binaries. Config cases already asserted by src/config.rs tests are dropped.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Do GitHub issue #340 in inputlayer/inputlayer, part of the test restructure in TESTING.md: "Testing: Misfiled unit tests (T-06)".
Part of the test strategy (captain, 2026-10-05: scenarios that test the changes together; cleaner, faster suites; TESTING.md). Epic #305.
Scope. Move
tests/config_tests.rsintosrc/config.rstests (dropping cases already there),serialization_tests.rsintosrc/value,optimizer_tests.rsintosrc/optimizer,boundary_value_tests.rsintosrc/value, the parser half ofiql_syntax_tests.rsintosrc/parser/src/statement, the storage half into the storage component binary (T-07).Acceptance. Five fewer test binaries; no test deleted without a named duplicate in the PR description;
cargo test --libtime unchanged within noise.Deliver it as a small PR; done means merged with CI green.
What Changed
tests/optimizer_tests.rs(20 tests),tests/boundary_value_tests.rs(33) andtests/serialization_tests.rs(25) move unchanged apart frominputlayer::→crate::imports tosrc/optimizer/optimizer_tests.rs,src/value/boundary_value_tests.rsandsrc/value/serialization_tests.rs, each wired in as a#[cfg(test)]module.tests/config_tests.rsandtests/iql_syntax_tests.rsare deleted and their tests redistributed as below.iql_syntax_tests.rssplit in two, all 32 tests kept. The 19 parser-only tests becomesrc/statement/iql_syntax_tests.rs; the 13 that need aStorageEngine(rule catalog, rule persistence, view operations, queries with constants) are appended totests/storage_engine_tests.rs, whose header comment now mentions IQL rules and queries.config_tests.rsfolded into thesrc/config.rstest module: 8 of 27 tests kept, 19 dropped as duplicates. Kept:test_config_default_performance_settings,test_load_config_from_toml,test_load_missing_config_file,test_config_local_overrides_base,test_config_relative_path,test_config_absolute_path,test_config_can_be_cloned,test_config_can_be_debugged. Each dropped test and the existingsrc/config.rstest that already asserts the same thing:tests/config_tests.rssrc/config.rstest_config_default_storage_pathtest_default_configtest_config_default_knowledge_graph_nametest_default_configtest_config_default_persistence_formattest_default_configtest_config_default_compressiontest_default_configtest_config_valid_formatstest_default_configtest_config_valid_compressiontest_default_configtest_env_var_syntax_documentedtest_default_configtest_config_default_auto_create_knowledge_graphstest_default_storage_configtest_config_default_auto_save_intervaltest_default_storage_configtest_config_has_storage_sectiontest_default_storage_configtest_persistence_config_fieldstest_default_storage_config(save interval),test_default_config(format, compression)test_config_default_optimization_enabledtest_default_optimization_configtest_config_has_optimization_sectiontest_default_optimization_configtest_config_default_logging_leveltest_default_logging_configtest_config_default_logging_formattest_default_logging_configtest_config_valid_log_leveltest_default_logging_configtest_config_valid_log_formattest_default_logging_configtest_config_has_logging_sectiontest_default_logging_configtest_performance_config_fieldstest_default_performance_config🤖 Generated with Claude Code
Risk Assessment
✅ Low: Test-only relocation with unchanged test bodies (imports switched to crate paths, one config test wrapped in a figment Jail to isolate it from env-setting sibling tests), five tests/ binaries removed, no production code touched, and every dropped config case has a verified equivalent already in src/config.rs.
Testing
Built the lib unit-test binary and
storage_engine_testsat both the base and target commits (base extracted to a throwaway directory undertarget/, since removed). Compared cargo's test-target list, compared the--listinventory of every affected binary by test name, ran the relocated tests, and timed the full lib test binary three times per commit in alternation. Five targets are gone, no pre-existing lib or storage test disappeared, all 158 relocated lib tests and all 38 storage tests pass, and lib timing overlaps between commits (base 33–58s, target 29–39s on a noisy machine). The only tests not carried over are the 19 config cases named in the declined review-1 decision. No UI surface, so no visual evidence.cargo test --test <name> --no-runreturnserror: no test target named ...for all fivecargo test --libfiltered to the new modules and the relocated config, value, optimizer and parser tests execute and passcargo test --test storage_engine_testsand the storage half of iql_syntax_tests runs there alongside the existing storage testscargo test --libbinary before and after the change and wall-clock time is unchanged within noiseEvidence: Test target and test-name inventory, base vs target
Integration test targets (cargo metadata): base efa32cec = 77, target a61d198e = 72 Removed targets: boundary_value_tests, config_tests, iql_syntax_tests, optimizer_tests, serialization_tests lib: base 3240 -> target 3345; lib tests removed: 0 storage_engine_tests: base 25 -> target 38; removed: 0 boundary_value_tests 33 -> value::boundary_value_tests 33 serialization_tests 25 -> value::serialization_tests 25 optimizer_tests 20 -> optimizer::optimizer_tests 20 iql_syntax_tests 32 -> statement::iql_syntax_tests 19 + storage_engine_tests 13 new config_tests 27 -> config::tests gained 8; 19 names not carried over (the dropped duplicates)Evidence: Relocated tests running in their new homes
lib (filtered to the five new modules): test result: ok. 158 passed; 0 failed; 0 ignored; 3187 filtered out; finished in 1.28s storage_engine_tests: test result: ok. 38 passed; 0 failed; 0 ignored; finished in 2.24sEvidence: cargo test --lib wall-clock, base vs target (3 alternating runs)
run1 lib-base 57.99s (3239 passed) lib-target 39.15s (3344 passed) run2 lib-base 36.97s lib-target 36.93s run3 lib-base 33.18s lib-target 29.14sEvidence: Old test binaries no longer exist
$ cargo test --test config_tests --no-run error: no test target namedconfig_testsin default-run packages (same for serialization_tests, optimizer_tests, boundary_value_tests, iql_syntax_tests)Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
src/config.rs:2117- Acceptance check "no test deleted without a named duplicate in the PR description": 19 cases from tests/config_tests.rs are dropped and the commit message only says they are "already asserted by src/config.rs tests" without naming them. I verified each has an equivalent in src/config.rs; the PR description should carry this mapping: test_config_default_storage_path, _knowledge_graph_name, _persistence_format, _compression, test_config_valid_formats, test_config_valid_compression, test_env_var_syntax_documented, test_config_has_storage_section -> test_default_config (1707); test_config_default_auto_create_knowledge_graphs, _auto_save_interval, test_persistence_config_fields -> test_default_storage_config (1733); test_config_default_optimization_enabled, test_config_has_optimization_section -> test_default_optimization_config (1741); test_config_default_logging_level, _logging_format, test_config_valid_log_level, test_config_valid_log_format, test_config_has_logging_section -> test_default_logging_config (1750); test_performance_config_fields -> test_default_performance_config (1780) and the kept test_config_default_performance_settings (2117). No other test was deleted: optimizer (20), boundary_value (33), serialization (25) and all 32 iql_syntax tests (19 parser in src/statement/iql_syntax_tests.rs, 13 storage in tests/storage_engine_tests.rs) are present with unchanged bodies.✅ **Test** - passed
✅ No issues found.
cargo test --test <name> --no-runreturnserror: no test target named ...for all fivecargo test --libfiltered to the new modules and the relocated config, value, optimizer and parser tests execute and passcargo test --test storage_engine_testsand the storage half of iql_syntax_tests runs there alongside the existing storage testscargo test --libbinary before and after the change and wall-clock time is unchanged within noisecargo metadata --no-deps --format-version 1at base efa32cec and target a61d198e, diffing targets of kindtest(77 -> 72)cargo test --lib --test storage_engine_tests --no-runat target, and at base together with the five old--testbinaries--liston the base and target lib andstorage_engine_testsbinaries and on the five old binaries, mapping each old test name to its new modulecargo test --lib -- config::tests:: value::boundary_value_tests:: value::serialization_tests:: optimizer::optimizer_tests:: statement::iql_syntax_tests::at target (158 passed)cargo test --test storage_engine_testsat target (38 passed, 13 of them new from the storage half of iql_syntax_tests)Full lib unit-test binary run 3x at base and 3x at target, alternating, for wall-clock comparison (all runs green)cargo test --test <name> --no-runfor each of config_tests, serialization_tests, optimizer_tests, boundary_value_tests, iql_syntax_tests at target (each: no test target named ...)TESTING.md:31- TESTING.md Tier 1 says "~1560 tests" for unit tests. This approximate count was already far off before this change (about 3,255 #[test]/#[tokio::test] attributes under src/ at the base commit) and this change adds roughly 105 more by moving tests into the lib binary. Left untouched because the drift is pre-existing and not caused by this change; a follow-up could drop the hand-copied number or refresh it.✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.