-
由 Heikki Linnakangas 提交于
Some notable differences: * For the last "appendonly_verify_block_checksums_co" test, don't use a compressed table. That seems fragile. * In the "appendonly_verify_block_checksums_co" test, be more explicit in what is replaced. It used to scan backwards from end of file for the byte 'a', but we didn't explicitly include that byte in the test data. What actually gets replaced depends heavily on how integers are encoded. (And the table was compressed too, which made it even more indeterministic.) In the rewritten test, we replace the string 'xyz', and we use a text field that contains that string as the table data. * Don't restore the original table file after corrupting. That seemed uninteresting to test. Presumably the table was OK before we corrupted it, so surely it's still OK after restoring it back. In theory, there could be a problem if the file's corrupt contents were cached somewhere, but we don't cache AO tables, and I'm not sure what we'd try to prove by testing that, anway, because swapping the file while the system is active is surely not supported. * The old script checked that the output when a corrupt table was SELECTed from contained the string "ERROR: Header checksum does not match". However, half of the tests actually printed a different error, "Block checksum does not match". It turns out that the way the old select_table function asserted the result of the grep command was wrong. It should've done "assert(int(result) > 0), ..." rather than just "assert(result > 0), ...". As written, it always passed, even if there was no ERROR in the output. The rewritten test does not have that bug.
c54ffe6e