fix(tests): replace #[test] with #[tokio::test] on 13 async fns Refs #2040#893
Open
AlexMikhalev wants to merge 1 commit into
Open
fix(tests): replace #[test] with #[tokio::test] on 13 async fns Refs #2040#893AlexMikhalev wants to merge 1 commit into
AlexMikhalev wants to merge 1 commit into
Conversation
…rraphim_rolegraph Refs #2040 Async test functions decorated with #[test] compile and appear to pass but the test runner drops the returned Future without polling it -- the async body never executes. This converts all 13 affected functions in crates/terraphim_rolegraph/src/lib.rs to #[tokio::test]. Affected functions: test_split_paragraphs, test_find_matching_node_idss, test_find_matching_node_idss_ac_values, test_terraphim_engineer, test_rolegraph, test_is_all_terms_connected_by_path_true, test_is_all_terms_connected_by_path_false, tfidf_empty_index_returns_empty, tfidf_exact_match_scores_high, tfidf_no_match_scores_zero, tfidf_partial_match, tfidf_threshold_filters, two_pass_aho_corasick_first. Post-fix: 20 tests pass (1 deliberately #[ignore]d), execution time increases from ~0ms to 2.21s confirming async bodies now execute.
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.
Problem
13 async test functions in
crates/terraphim_rolegraph/src/lib.rswere decorated with#[test]instead of#[tokio::test]. These tests compiled and appeared to pass but never executed their async bodies -- the test runner received aFuture, dropped it without polling, and recorded a pass since no panic occurred.Fix
Replace
#[test]with#[tokio::test]on all 13 affected functions:test_split_paragraphs,test_find_matching_node_idss,test_find_matching_node_idss_ac_values,test_terraphim_engineer,test_rolegraph,test_is_all_terms_connected_by_path_true,test_is_all_terms_connected_by_path_false,tfidf_empty_index_returns_empty,tfidf_exact_match_scores_high,tfidf_no_match_scores_zero,tfidf_partial_match,tfidf_threshold_filters,two_pass_aho_corasick_first.Verification
cargo test -p terraphim_rolegraph: 20 passed, 1 deliberately#[ignore]dcargo clippy -p terraphim_rolegraph -- -D warnings: cleancargo fmt -p terraphim_rolegraph -- --check: cleanNote on count
Issue listed 12 functions; inspection found 13 (the
#2037commit addedtest_is_all_terms_connected_by_path_truewhich also had#[test]beforeasync fn). All 13 are fixed.Refs terraphim/terraphim-ai#2040 (Gitea)
🤖 Generated with Terraphim AI