-
-
Couldn't load subscription status.
- Fork 109
test: Log the number of the test account if there are multiple alices #7087
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
Conversation
src/test_utils.rs
Outdated
| Self::builder().configure_alice().build().await | ||
| Self::builder() | ||
| .configure_alice() | ||
| .build(&mut BTreeSet::new()) |
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.
Instead of creating fake argument to build, I think it should be optional and set with .with_used_names in the builder. Probably needs to be a reference-counted pointer. Otherwise instead of a builder we will eventually get a constructor with a lot of non-optional arguments that need to be faked.
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.
Probably needs to be a reference-counted pointer
It even needs to be Arc<Mutex>, because we need to mutate the BTreeSet (probably can't use Rc<RefCell> because our async runtime is multi-threaded). We may be able to solve this by putting lifetimes everywhere, but this will make the code hard to read esp. for Rust beginners. While possible, at this point I don't think it's worth it to make this abstraction perfect for a builder that is only used 9 times, all of which is in the same file. (and the TestContextBuilder exists since 3 years, so there was a lot of time to use it outside this file, but noone ever felt the need to do so).
I think moving a bit towards a constructor is fine.
But it makes sense to make this argument optional.
In order to debug some test failures wrt broadcast channels, I need to read the log of some tests that have an alice0 and an alice1. It's currently not possible to tell whether a line was logged by alice0 or alice1, so, I would like to change that with this PR.
42a12bf to
31cfcce
Compare
In order to debug some test failures wrt broadcast channels, I need to read the log of some tests that have an alice0 and an alice1.
It's currently not possible to tell whether a line was logged by alice0 or alice1, so, I would like to change that with this PR.
Edit: Turns out that there are more tests that call their profiles "alice1"/"alice2" (or "alice"/"alice2") than "alice0"/"alice1". So, I changed the logging to count "alice", "alice2", "alice3", ….
Not sure whether I should adapt old tests; it might save someone some confusion in the future, but I might also make a mistake and make it so that the test doesn't properly test anymore.