Skip to content
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

Closed

Conversation

ztzg
Copy link
Contributor

@ztzg ztzg commented Mar 6, 2021

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.).

ztzg added 3 commits March 6, 2021 19:19
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.
@arshadmohammad
Copy link
Contributor

arshadmohammad commented Mar 8, 2021

Changes look good to me. Please raise PR for other branches as well.
You can raise PR for branch-3.7, I think that PR will apply on branch-3.6 and branch-3.5 also

@ztzg
Copy link
Contributor Author

ztzg commented Mar 9, 2021

Thank you for the review, @arshadmohammad.

Changes look good to me. Please raise PR for other branches as well.
You can raise PR for branch-3.7, I think that PR will apply on branch-3.6 and branch-3.5 also

No such luck, unfortunately! JUnit's API churn gets in the way… Anyway; here you are:

Copy link
Contributor

@arshadmohammad arshadmohammad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM +1

@asfgit asfgit closed this in 0ab7766 Mar 9, 2021
RokLenarcic pushed a commit to RokLenarcic/zookeeper that referenced this pull request Aug 31, 2022
`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
RokLenarcic pushed a commit to RokLenarcic/zookeeper that referenced this pull request Aug 31, 2022
`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
RokLenarcic pushed a commit to RokLenarcic/zookeeper that referenced this pull request Aug 31, 2022
`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
RokLenarcic pushed a commit to RokLenarcic/zookeeper that referenced this pull request Sep 3, 2022
`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
RokLenarcic pushed a commit to RokLenarcic/zookeeper that referenced this pull request Sep 29, 2022
`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
anuragmadnawat1 pushed a commit to anuragmadnawat1/zookeeper that referenced this pull request Nov 2, 2022
`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
anuragmadnawat1 added a commit to anuragmadnawat1/zookeeper that referenced this pull request Nov 2, 2022
`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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants