Skip to content

Indicate the use of virtual time in withTimeout in TestScope #3591

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

Closed
wants to merge 1 commit into from

Conversation

dkhalanskyjb
Copy link
Collaborator

Fixes #3588

@dkhalanskyjb dkhalanskyjb force-pushed the TestScope.withTimeout branch from f869427 to 4523bfb Compare January 19, 2023 15:21
Copy link
Collaborator

@qwwdfsad qwwdfsad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The overall idea with better diagnostic message is good, but I'm not sure that introducing our own additional extension is -- it breaks apart as soon as withTimeout is moved into a different method with effectively the same context, but without an explicit receiver.

Probably, a proper toString implementation appended to TimeoutCE will achieve the same result while being more robust. WDYT?

@dkhalanskyjb
Copy link
Collaborator Author

I wanted to do both because I didn't think it was reasonable to do something like

public interface Delay {
  val whatCanBeDoneToAvoidATimeout: String?

and just a message from withTimeout is not very actionable. The intention was for people to see that something test-module-related is wrong, try withTimeout in runTest itself in the debugging process, and then see the solution.

Though I guess if I manage to implement #3179 after all (it turned out to be very demanding) + an informative message in withTimeout, we will be able to rely on word of mouth to spread the correct solution to timeouts that have a specific test-module related message.

@qwwdfsad
Copy link
Collaborator

qwwdfsad commented Feb 6, 2023

The reasoning works for me.

It seems like an alternative could be a slightly better Delay interface -- maybe it should be in control of both scheduling and timeout exceptions (e.g. to enhance stracktraces, add diagnostics to exceptions, provide domain-specific message etc.).
It should be achievable the moment we'll figure -Xjvm-defaults

@dkhalanskyjb dkhalanskyjb deleted the TestScope.withTimeout branch February 13, 2023 14:27
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.

2 participants