[go: nahoru, domu]

Skip to content
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

Refactor how we handle errors around imgtestInit/tryjobInit #149356

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Hixie
Copy link
Contributor
@Hixie Hixie commented May 30, 2024

I noticed that we don't really assert that these aren't called in ways that conflict with their internal logic, and that there were some redundant initializers and some race conditions. This patch makes it so that calling them reentrantly is always safe and always returns the same future, while also explicitly asserting that they're not called in conflicting ways.

Diff is much more readable if you enable "ignore whitespace changes".

I noticed that we don't really assert that these aren't called in ways that conflict with their internal logic, and that there were some redundant initializers and some race conditions. This patch makes it so that calling them reentrantly is always safe and always returns the same future, while also explicitly asserting that they're not called in conflicting ways.
@github-actions github-actions bot added a: tests "flutter test", flutter_test, or one of our tests framework flutter/packages/flutter repository. See also f: labels. labels May 30, 2024
@Hixie
Copy link
Contributor Author
Hixie commented May 30, 2024

Not really part of my ongoing refactor, just something I ran into while trying to figure out what to do next in that refactor.

@goderbauer goderbauer requested a review from Piinks June 4, 2024 22:06
Copy link
Contributor
@Piinks Piinks left a comment

Choose a reason for hiding this comment

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

Diff is much more readable if you enable "ignore whitespace changes".

Thank you!

// because the FakeProcessManager we use never returns.
// Using a synchronous try/catch works because the assertion is not asynchronous.
client.tryjobInit();
fail('Missing assertion.');
Copy link
Contributor

Choose a reason for hiding this comment

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

In my experience, we usually avoid these types of try/fail tests since folks tend to forget to add the fail at the end of the try block. Can these be updated to something like this test instead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: tests "flutter test", flutter_test, or one of our tests framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants