unison
unison copied to clipboard
Create testing harness for multi-node serialization
We want to make sure a whole bunch of values round trip successfully, and also test the situation where the "sender" code cache is in a different state than the "receiver" code cache.
Suggestion: have some golden files of serialized stuff, which is checked in, make sure we can deserialize them.
Suggestion: have the golden file be generated from a Unison transcript that calls Value.serialize
, that way we will notice if the serialization format ever accidentally changes.
@ceedubs and @stew can provide some color on this.
Having this is going to give us more confidence when merging stuff like #3377
Ideas we discussed:
- Have a transcript that serializes as many cases we can think of, and writes results to file(s). These files are checked into version control so that we know if they ever change.
- Also do the same but with
hash
builtin, so we know if hashing code ever changes - The serialized file should round trip - when you read the values back in, they test
Universal.==
to the originals - The serialized file should round trip even if the runtime code cache is permuted
- How do we test this?
-
debug.permute-code-cache
command, just use this within the transcript. Involves some munging of runtime state. -
Value.(de)serializeSelfContained
which serializes a value and all itsCode
dependencies (transitive). Just do this for a bunch of values, store them in git. Then have aio.test
that picks a random permutation of those files and deserializes them all and has the same the hash. - Transcript can produce this file, so it's easy to add more test cases over time.
-
- How do we test this?