-
Notifications
You must be signed in to change notification settings - Fork 7.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ZOOKEEPER-4232: InvalidSnapshotTest corrupts its own test data #1622
ZOOKEEPER-4232: InvalidSnapshotTest corrupts its own test data #1622
Conversation
A "fixed" copy of snapshot.83f was recently checked in my accident. Without this revert, InvalidSnapshotTest.testSnapshot succeeds "trivially" instead of demonstrating recovery.
Without this, the ZooKeeperServer "fixes" the 'snapshot.83f' reference file, which: 1. Makes the test ineffective after the first run; 2. Causes the file to show as modified in version control tools; 3. Can end up committed by accident. This patch creates a temporary copy of the data directory.
Changes look good to me. Please raise PR for other branches as well. |
Thank you for the review, @arshadmohammad.
No such luck, unfortunately! JUnit's API churn gets in the way… Anyway; here you are:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM +1
`InvalidSnapshotTest.testSnapshot` starts an instance of `ZooKeeperServer` on the version-controlled `resources/data/invalidsnap` directory, which, as a side-effect, \"fixes\" the following snapshot—which was broken on purpose (see ZOOKEEPER-367): `zookeeper-server/src/test/resources/data/invalidsnap/version-2/snapshot.83f` This status quo creates a number of problems: 1. It makes the test ineffective after the first run; 2. The file shows as modified in version control tools, which can be annoying; 3. The \"fixed\" snapshot can end up being committed by mistake, invalidating the test. (\#3 is not theoretical; that \"fixed\" snapshot frequently shows up in pull requests, and was recently merged into master.). Author: Damien Diederen <[email protected]> Reviewers: Mohammad Arshad <[email protected]> Closes apache#1622 from ztzg/ZOOKEEPER-4232-invalid-snapshot-is-invalid and squashes the following commits: 8b48eea [Damien Diederen] ZOOKEEPER-4232: Ensure that ZOOKEEPER-367 test data fails to parse 9250756 [Damien Diederen] ZOOKEEPER-4232: Run InvalidSnapshotTest on a copy of test data dcf5604 [Damien Diederen] ZOOKEEPER-4232: Restore test data for ZOOKEEPER-367
`InvalidSnapshotTest.testSnapshot` starts an instance of `ZooKeeperServer` on the version-controlled `resources/data/invalidsnap` directory, which, as a side-effect, \"fixes\" the following snapshot—which was broken on purpose (see ZOOKEEPER-367): `zookeeper-server/src/test/resources/data/invalidsnap/version-2/snapshot.83f` This status quo creates a number of problems: 1. It makes the test ineffective after the first run; 2. The file shows as modified in version control tools, which can be annoying; 3. The \"fixed\" snapshot can end up being committed by mistake, invalidating the test. (\#3 is not theoretical; that \"fixed\" snapshot frequently shows up in pull requests, and was recently merged into master.). Author: Damien Diederen <[email protected]> Reviewers: Mohammad Arshad <[email protected]> Closes apache#1622 from ztzg/ZOOKEEPER-4232-invalid-snapshot-is-invalid and squashes the following commits: 8b48eea [Damien Diederen] ZOOKEEPER-4232: Ensure that ZOOKEEPER-367 test data fails to parse 9250756 [Damien Diederen] ZOOKEEPER-4232: Run InvalidSnapshotTest on a copy of test data dcf5604 [Damien Diederen] ZOOKEEPER-4232: Restore test data for ZOOKEEPER-367
`InvalidSnapshotTest.testSnapshot` starts an instance of `ZooKeeperServer` on the version-controlled `resources/data/invalidsnap` directory, which, as a side-effect, \"fixes\" the following snapshot—which was broken on purpose (see ZOOKEEPER-367): `zookeeper-server/src/test/resources/data/invalidsnap/version-2/snapshot.83f` This status quo creates a number of problems: 1. It makes the test ineffective after the first run; 2. The file shows as modified in version control tools, which can be annoying; 3. The \"fixed\" snapshot can end up being committed by mistake, invalidating the test. (\#3 is not theoretical; that \"fixed\" snapshot frequently shows up in pull requests, and was recently merged into master.). Author: Damien Diederen <[email protected]> Reviewers: Mohammad Arshad <[email protected]> Closes apache#1622 from ztzg/ZOOKEEPER-4232-invalid-snapshot-is-invalid and squashes the following commits: 8b48eea [Damien Diederen] ZOOKEEPER-4232: Ensure that ZOOKEEPER-367 test data fails to parse 9250756 [Damien Diederen] ZOOKEEPER-4232: Run InvalidSnapshotTest on a copy of test data dcf5604 [Damien Diederen] ZOOKEEPER-4232: Restore test data for ZOOKEEPER-367
`InvalidSnapshotTest.testSnapshot` starts an instance of `ZooKeeperServer` on the version-controlled `resources/data/invalidsnap` directory, which, as a side-effect, \"fixes\" the following snapshot—which was broken on purpose (see ZOOKEEPER-367): `zookeeper-server/src/test/resources/data/invalidsnap/version-2/snapshot.83f` This status quo creates a number of problems: 1. It makes the test ineffective after the first run; 2. The file shows as modified in version control tools, which can be annoying; 3. The \"fixed\" snapshot can end up being committed by mistake, invalidating the test. (\#3 is not theoretical; that \"fixed\" snapshot frequently shows up in pull requests, and was recently merged into master.). Author: Damien Diederen <[email protected]> Reviewers: Mohammad Arshad <[email protected]> Closes apache#1622 from ztzg/ZOOKEEPER-4232-invalid-snapshot-is-invalid and squashes the following commits: 8b48eea [Damien Diederen] ZOOKEEPER-4232: Ensure that ZOOKEEPER-367 test data fails to parse 9250756 [Damien Diederen] ZOOKEEPER-4232: Run InvalidSnapshotTest on a copy of test data dcf5604 [Damien Diederen] ZOOKEEPER-4232: Restore test data for ZOOKEEPER-367
`InvalidSnapshotTest.testSnapshot` starts an instance of `ZooKeeperServer` on the version-controlled `resources/data/invalidsnap` directory, which, as a side-effect, \"fixes\" the following snapshot—which was broken on purpose (see ZOOKEEPER-367): `zookeeper-server/src/test/resources/data/invalidsnap/version-2/snapshot.83f` This status quo creates a number of problems: 1. It makes the test ineffective after the first run; 2. The file shows as modified in version control tools, which can be annoying; 3. The \"fixed\" snapshot can end up being committed by mistake, invalidating the test. (\#3 is not theoretical; that \"fixed\" snapshot frequently shows up in pull requests, and was recently merged into master.). Author: Damien Diederen <[email protected]> Reviewers: Mohammad Arshad <[email protected]> Closes apache#1622 from ztzg/ZOOKEEPER-4232-invalid-snapshot-is-invalid and squashes the following commits: 8b48eea [Damien Diederen] ZOOKEEPER-4232: Ensure that ZOOKEEPER-367 test data fails to parse 9250756 [Damien Diederen] ZOOKEEPER-4232: Run InvalidSnapshotTest on a copy of test data dcf5604 [Damien Diederen] ZOOKEEPER-4232: Restore test data for ZOOKEEPER-367
`InvalidSnapshotTest.testSnapshot` starts an instance of `ZooKeeperServer` on the version-controlled `resources/data/invalidsnap` directory, which, as a side-effect, \"fixes\" the following snapshot—which was broken on purpose (see ZOOKEEPER-367): `zookeeper-server/src/test/resources/data/invalidsnap/version-2/snapshot.83f` This status quo creates a number of problems: 1. It makes the test ineffective after the first run; 2. The file shows as modified in version control tools, which can be annoying; 3. The \"fixed\" snapshot can end up being committed by mistake, invalidating the test. (\#3 is not theoretical; that \"fixed\" snapshot frequently shows up in pull requests, and was recently merged into master.). Author: Damien Diederen <[email protected]> Reviewers: Mohammad Arshad <[email protected]> Closes apache#1622 from ztzg/ZOOKEEPER-4232-invalid-snapshot-is-invalid and squashes the following commits: 8b48eea [Damien Diederen] ZOOKEEPER-4232: Ensure that ZOOKEEPER-367 test data fails to parse 9250756 [Damien Diederen] ZOOKEEPER-4232: Run InvalidSnapshotTest on a copy of test data dcf5604 [Damien Diederen] ZOOKEEPER-4232: Restore test data for ZOOKEEPER-367
`InvalidSnapshotTest.testSnapshot` starts an instance of `ZooKeeperServer` on the version-controlled `resources/data/invalidsnap` directory, which, as a side-effect, \"fixes\" the following snapshot—which was broken on purpose (see ZOOKEEPER-367): `zookeeper-server/src/test/resources/data/invalidsnap/version-2/snapshot.83f` This status quo creates a number of problems: 1. It makes the test ineffective after the first run; 2. The file shows as modified in version control tools, which can be annoying; 3. The \"fixed\" snapshot can end up being committed by mistake, invalidating the test. (\#3 is not theoretical; that \"fixed\" snapshot frequently shows up in pull requests, and was recently merged into master.). Author: Damien Diederen <[email protected]> Reviewers: Mohammad Arshad <[email protected]> Closes apache#1622 from ztzg/ZOOKEEPER-4232-invalid-snapshot-is-invalid and squashes the following commits: 8b48eea [Damien Diederen] ZOOKEEPER-4232: Ensure that ZOOKEEPER-367 test data fails to parse 9250756 [Damien Diederen] ZOOKEEPER-4232: Run InvalidSnapshotTest on a copy of test data dcf5604 [Damien Diederen] ZOOKEEPER-4232: Restore test data for ZOOKEEPER-367 Co-authored-by: Damien Diederen <[email protected]>
InvalidSnapshotTest.testSnapshot
starts an instance ofZooKeeperServer
on the version-controlledresources/data/invalidsnap
directory, which, as a side-effect, "fixes" the following
snapshot—which was broken on purpose (see ZOOKEEPER-367):
zookeeper-server/src/test/resources/data/invalidsnap/version-2/snapshot.83f
This status quo creates a number of problems:
annoying;
invalidating the test.
(#3 is not theoretical; that "fixed" snapshot frequently shows up in
pull requests, and was recently merged into master.).