Skip to content

Conversation

@Hocuri
Copy link
Collaborator

@Hocuri Hocuri commented Aug 7, 2025

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.

Self::builder().configure_alice().build().await
Self::builder()
.configure_alice()
.build(&mut BTreeSet::new())
Copy link
Collaborator

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.

Copy link
Collaborator Author

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.

@Hocuri Hocuri enabled auto-merge (squash) August 11, 2025 17:15
Hocuri added 5 commits August 12, 2025 10:40
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.
@Hocuri Hocuri force-pushed the hoc/log-testacc-number-in-tests branch from 42a12bf to 31cfcce Compare August 12, 2025 08:40
@Hocuri Hocuri merged commit b3c5787 into main Aug 12, 2025
29 checks passed
@Hocuri Hocuri deleted the hoc/log-testacc-number-in-tests branch August 12, 2025 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants