-
Notifications
You must be signed in to change notification settings - Fork 473
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
updated uses of random number generation in tests so that we log the … #2631
base: master
Are you sure you want to change the base?
Conversation
@@ -69,7 +70,10 @@ public async Task SupportPostCollectionPropertyByEntityPayload() | |||
// clear respository | |||
await this.ClearRepositoryAsync("CollectionProperty_Entity"); | |||
|
|||
var rand = new Random(RandomSeedGenerator.GetRandomSeed()); | |||
var seed = RandomSeedGenerator.GetRandomSeed(); | |||
Trace.WriteLine($"Generated seed for random number generator: {seed}"); |
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.
where do you retrieve the trace information? If it's running on Azure pipeline, is it easy to trace?
Different test cases output the same trace, is it easy to identify?
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.
I guess I am only expecting someone to need the seed in the event of an intermittent test failure that needs to be investigated, so in the pipeline logs, when it logs the failed test, the trace will be right above the name of the failed test
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.
Are you thinking I should add the test name to the message or something along those lines?
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.
@xuzhg, I've updated the change so that we only log 1 time. It is relatively straightforward to find the seed in the build logs.
481bfba
to
efaa207
Compare
b0d9127
to
8388bee
Compare
This PR has Quantification details
Why proper sizing of changes matters
Optimal pull request sizes drive a better predictable PR flow as they strike a
What can I do to optimize my changes
How to interpret the change counts in git diff output
Was this comment helpful? 👍 :ok_hand: :thumbsdown: (Email) |
…used for later investigation
Description
Some tests use a random number generated when creating data. This can cause tests to fail intermittently. This PR logs the seed used for random number generation so that those intermittent failures can be reproduced for investigation.
Checklist (Uncheck if it is not completed)
Additional work necessary
No additional work necessary.