You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since we've upgraded our ProtoBuf package version in #8075, the new serializer to JSON and ProtoText inserts random whitespace on its output that prevents byte-wise comparison.
Our test suite makes extensive use of "golden tests" that compare these outputs. In order to complete the upgrade successfully, I had to disable the randomness in the serializer.
This is explained in detail in the following comment:
Of course, this is actually a hack. The ideal solution here would be making sure that no tests in our test suite are actually comparing bytes directly.
There are two ways to get there:
Adding helpers to the test suite that parse the contents of the serialized PB and then comparing the parsed structures directly, instead of comparing the bytes.
Normalizing the contents of the serialized PB (i.e. by removing all whitespace) before we do the literal comparison.
The ideal approach will probably change for each test. There are many tests to fix, but fortunately this is something that can be done incrementally. This is a tracking issue so we can get there.
The text was updated successfully, but these errors were encountered:
Hey @exitflynn! This issue is still very much up for grabs. The easiest way to figure out which tests would start failing because of PB comparisons is disabling the hack in go/hack/detrand.go and seeing which tests start failing. From there, it's just a matter of coming up with a good approach (which will probably vary between tests) to compare these Protobuf objects without direct text comparison.
Since we've upgraded our ProtoBuf package version in #8075, the new serializer to JSON and ProtoText inserts random whitespace on its output that prevents byte-wise comparison.
Our test suite makes extensive use of "golden tests" that compare these outputs. In order to complete the upgrade successfully, I had to disable the randomness in the serializer.
This is explained in detail in the following comment:
vitess/go/hack/detrand.go
Lines 23 to 40 in d51a7ee
Of course, this is actually a hack. The ideal solution here would be making sure that no tests in our test suite are actually comparing bytes directly.
There are two ways to get there:
The ideal approach will probably change for each test. There are many tests to fix, but fortunately this is something that can be done incrementally. This is a tracking issue so we can get there.
The text was updated successfully, but these errors were encountered: