Minor tidying of test to reduce line count and log chatter #45989
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I'd independently implemented #45960, because the MetricsTest was failing consistently if the execution order was different (a side effect of #34681). I only spotted the change had been made when I went to do my PR.
Looking at the changes, I think mine has a few minor advantages:
As discussed in #45955, the pattern is that the await is waiting for "have we got enough spans that there's no point waiting any more?", and then the "have we got the right number of spans?" is handled in an assertion. That gives a more useful error message, which in this case includes the listing of what spans we got. It also means that the
await()
doesn't wait for 4 spans to turn into 2 spans, since that's not likely to happen.The spans can be kind of long, so we'd only want them in the log if there's a failure. This was my failure: