-
Notifications
You must be signed in to change notification settings - Fork 637
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tests: remove near_actix_test_utils::run_actix_until_panic
#4452
Conversation
The way remove `near_actix_test_utils::run_actix_until` was written, the expect_panic flag didn’t actually matter: SET_PANIC_HOOK.call_once(|| { let default_hook = std::panic::take_hook(); std::panic::set_hook(Box::new(move |info| { if !expect_panic { default_hook(info); } // ... })); }); Since `SET_PANIC_HOOK.call_once` invokes the closure only once, the value of expect_panic when that calls happen is the only one that matters. In other words, the first run of `run_actix_until` function decides what the value of `expect_panic` in the panic handler is. Fortunately this didn’t actually matter. The only test which set the flag to true – `chunks_recovered_from_full_timeout_too_short` – was marked `#[should_panic]` and running the default panic hook didn’t negatively influence the test. As such, get rid of `run_actix_until_panic` and rename `run_actix_until_stop` to simply be `run_actix`. Issue: near#3266
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM updated to rebase onto master, as github automerge doesn't do it. @mina86 I would recommend to use the S-automerge
label instead, as that bot also does automatocally rebase you PR.
I suspected that is the case. Has been tested this with a few recent PRs. Thanks for confirming. |
The way
near_actix_test_utils::run_actix_until
was written,the
expect_panic
flag didn’t actually matter:Since
SET_PANIC_HOOK.call_once
invokes the closure only once, thevalue of
expect_panic
when that calls happen is the only one thatmatters. In other words, the first run of
run_actix_until
functiondecides what the value of
expect_panic
in the panic handler is.Fortunately this didn’t actually matter. The only test which set the
flag to true –
chunks_recovered_from_full_timeout_too_short
– wasmarked
#[should_panic]
and running the default panic hook didn’tnegatively influence the test.
As such, get rid of
run_actix_until_panic
and renamerun_actix_until_stop
to simply berun_actix
.