I encounter a memory allocation error when I run tests using rstest.
This project has about 300 test cases.
This is a part of the output when failing.
$ cargo test
... snip ...
test bgp::rib::tests::works_table_insert_and_remove::case_2 ... ok
test bgp::rib::tests::works_rib_manager_add_peer ... ok
test bgp::rib::tests::works_table_insert_and_remove::case_3 ... ok
test bgp::rib::tests::works_table_insert_and_remove::case_4 ... ok
test controller::reconciler::cluster_bgp::tests::test_get_label_selector::case_1 ... ok
test controller::reconciler::cluster_bgp::tests::test_get_label_selector::case_2 ... ok
test controller::reconciler::cluster_bgp::tests::test_get_label_selector::case_3 ... ok
test controller::reconciler::cluster_bgp::tests::test_match_selector::case_1 ... ok
test controller::reconciler::cluster_bgp::tests::test_match_selector::case_2 ... ok
test controller::reconciler::cluster_bgp::tests::test_match_selector::case_3 ... ok
test controller::reconciler::cluster_bgp::tests::test_match_selector::case_4 ... ok
test controller::reconciler::cluster_bgp::tests::test_match_selector::case_5 ... ok
test controller::reconciler::cluster_bgp::tests::test_match_selector::case_6 ... ok
test controller::reconciler::endpointslice_watcher::tests::works_sync_target_peers::case_1 ... ok
test controller::reconciler::endpointslice_watcher::tests::works_sync_target_peers::case_2 ... ok
test controller::reconciler::endpointslice_watcher::tests::works_sync_target_peers::case_3 ... ok
memory allocation of 2305843009213693952 bytes failed
error: test failed, to rerun pass `--lib`
Caused by:
process didn't exit successfully: `sudo -E /home/terassyi/workspace/sart/sartd/target/debug/deps/sartd-92e6f14d9e8f1d1c` (signal: 6, SIGABRT: process abort signal)
I wonder if tests are failed out of memory and are caused by controller::reconciler::endpointslice_watcher::tests::works_sync_target_peer.
However, when I run only this test function, I can get successful results like this.
$ cargo test --package sartd --lib -- controller::reconciler::endpointslice_watcher::tests::works_sync_target_peers --nocapture
warning: `sartd` (lib test) generated 185 warnings (run `cargo fix --lib -p sartd --tests` to apply 27 suggestions)
Finished test [unoptimized + debuginfo] target(s) in 0.06s
Running unittests src/lib.rs (target/debug/deps/sartd-92e6f14d9e8f1d1c)
running 7 tests
test controller::reconciler::endpointslice_watcher::tests::works_sync_target_peers::case_1 ... ok
test controller::reconciler::endpointslice_watcher::tests::works_sync_target_peers::case_2 ... ok
test controller::reconciler::endpointslice_watcher::tests::works_sync_target_peers::case_3 ... ok
test controller::reconciler::endpointslice_watcher::tests::works_sync_target_peers::case_4 ... ok
test controller::reconciler::endpointslice_watcher::tests::works_sync_target_peers::case_5 ... ok
test controller::reconciler::endpointslice_watcher::tests::works_sync_target_peers::case_6 ... ok
test controller::reconciler::endpointslice_watcher::tests::works_sync_target_peers::case_7 ... ok
test result: ok. 7 passed; 0 failed; 0 ignored; 0 measured; 237 filtered out; finished in 0.00s
In my consideration, I create BTreeMap for each test case and I also create BTreeMap in other tests.
And many BTreeMap use so much memory and it causes out of memory.
My environment
Ubuntu 22.04
13th Gen Intel(R) Core(TM) i9-13900K
Mem 64GB
I'm not sure it is correct to report this problem here but I need some help to resolve this.
Hi, I'm using rest conveniently for my project.
What
I encounter a memory allocation error when I run tests using rstest. This project has about 300 test cases.
This is a part of the output when failing.
I wonder if tests are failed out of memory and are caused by
controller::reconciler::endpointslice_watcher::tests::works_sync_target_peer
.works_sync_target_peer
is below.However, when I run only this test function, I can get successful results like this.
In my consideration, I create
BTreeMap
for each test case and I also createBTreeMap
in other tests. And many BTreeMap use so much memory and it causes out of memory.My environment
I'm not sure it is correct to report this problem here but I need some help to resolve this.
Thank you.