Add a set of "chaos monkey" tests for rehydration. #991
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.
Based on an idea that @krisselden and I had while working on #988 this adds tests that run a number of iterations removing a random node, and confirming that the final rehydrated (e.g. client rendered) HTML is correct.
In order to make these tests actionable the infrastructure added here provides a way to replicate specific iterations upon failure. The way this works is based on QUnit's internal
QUnit.config.seed
implementation. When aQUnit
test suite is ran with theseed
query param set (with no value e.g./tests/index.html?hidepassed&seed
), QUnit will choose a random seed and use that seed to choose a randomized test order. Then if a failure occurs with the randomized and seeded test run, you can run the tests again with exactly that seed value byspecifying the
seed
query param with the failing seed value (e.g./tests/index.html?hidepassed&seed=THEVALUEHERE
). The implementation here piggie backs on that system to use the QUnit's seed value (along with a copied version of their hashing functionand seeded randomizer) in addition to the iteration being ran to always select a "known value" to remove. This means that given the correct seed (and iteration number) we can easily replicate specific failure scenarios without manually having to track it down.
The way you'd do this is:
/tests/index.html?hidepassed&seed
until a failure occurs./tests/index.html?hidepassed&seed=SEED_HERE&iteration=ITERATION_HERE
).Currently includes the changes from #988, but will rebase once that lands.