fix(Test): Fix table checksum test. Test on uncompressed. #1952
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.
Problem
Fixes DGRAPHCORE-152
Previously, when testing to verify that a bad checksum would actually cause a checksum failure, we were overlooking the fact that our method of modifying the data could also modify the compressed data or even some of the metadata related to our block data.
The symptomatic results:
--- FAIL: TestTableChecksum (0.11s)
2640 table_test.go:698:
2641 Error Trace: table_test.go:698
2642 table_test.go:692
2643 Error: Received unexpected error:
2644 failed to initialize table error: failed to initialize biggest for table /tmp/2687635575.sst error: failed to decode compressed data in file: /tmp/2687635575.sst at offset: 51750, len: 149 error: failed to decompress err: unexpected EOF
2645 Test: TestTableChecksum
or some similar error
(There were earlier errors about failing to panic, but these were always generated before the secondary logged error was added).
Solution
Now, when we want to test that our checksum process is valid, we check with uncompressed data rather than with compressed data. In addition, we still write random bytes, but we no longer place it randomly. Instead, we place it in a location that will avoid the metadata locations of the data blocks.