-
Notifications
You must be signed in to change notification settings - Fork 15
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
test: improve default correlation unit tests #501
test: improve default correlation unit tests #501
Conversation
✅ Deploy Preview for arcus-observability ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
DefaultCorrelationInfoAccessor.Instance.SetCorrelationInfo( | ||
new CorrelationInfo(operationId, transactionId)); | ||
await Task.Run(() => DefaultCorrelationInfoAccessor.Instance.SetCorrelationInfo( | ||
new CorrelationInfo(operationId, transactionId))); | ||
} |
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.
Well, we avoid the warning here but it is actually a bad practice, as it is by no means necessary to startup another thread just for this. See also this: https://blog.stephencleary.com/2013/11/taskrun-etiquette-examples-using.html
Why is the SetCorrelationInfoAsync
method even declared as async ? I don't think that is even necessary ?
Moreover, I think this complete testcase can be synchronous ?
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.
This test case was made because we had a problem with setting our correlation in an asynchronously setting. It really is a unit test to secure this fix.
Also note that this is testing deprecated functionality.
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.
Ah.
In that case, it would have been good if the name of the test described that we're specifically testing this in an async context.
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.
Added ...InAsyncContext
to the test's name.
DefaultCorrelationInfoAccessor.Instance.SetCorrelationInfo( | ||
new CorrelationInfo(operationId, transactionId)); | ||
await Task.Run(() => DefaultCorrelationInfoAccessor.Instance.SetCorrelationInfo( | ||
new CorrelationInfo(operationId, transactionId))); | ||
} |
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.
Ah.
In that case, it would have been good if the name of the test described that we're specifically testing this in an async context.
Improve asynchronous default correlation unit tests.
Closes #344