-
Notifications
You must be signed in to change notification settings - Fork 9.2k
HDFS-15862. Make TestViewfsWithNfs3.testNfsRenameSingleNN() idempotent #2724
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
Conversation
aajisaka
left a comment
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.
If the 2nd rename failed, the test will be non-idempotent. I think renameSingleNN should be created in the test case instead of @BeforeClass. In addition, we need to remove renameSingleNNSucess if exists before running rename.
|
@aajisaka Thanks for the feedback! I've made the corresponding changes following your suggestion. Please let me know what you think. Thanks! |
|
🎊 +1 overall
This message was automatically generated. |
...roject/hadoop-hdfs-nfs/src/test/java/org/apache/hadoop/hdfs/nfs/nfs3/TestViewfsWithNfs3.java
Outdated
Show resolved
Hide resolved
|
🎊 +1 overall
This message was automatically generated. |
|
Merged. Thank you @lzx404243 |
#2724) Signed-off-by: Akira Ajisaka <[email protected]> (cherry picked from commit 7ba91c1)
#2724) Signed-off-by: Akira Ajisaka <[email protected]> (cherry picked from commit 7ba91c1)
#2724) Signed-off-by: Akira Ajisaka <[email protected]> (cherry picked from commit 7ba91c1)
apache#2724) Signed-off-by: Akira Ajisaka <[email protected]>
The test
org.apache.hadoop.hdfs.nfs.nfs3.TestViewfsWithNfs3.testNfsRenameSingleNNis not idempotent and fails if run twice in the same JVM, because it pollutes state shared among tests. It may be good to clean this state pollution so that some other tests do not fail in the future due to the shared state polluted by this test.Details
Running
TestViewfsWithNfs3.testNfsRenameSingleNNtwice would result in the second run failing with the a NullPointer exception:The reason for this is that the
/user1/renameSingleNNfile is created insetup(), but gets renamed intestNfsRenameSingleNN. When the second run oftestNfsRenameSingleNNtries to get info of the file by its original name, it returns a NullPointer since the file no longer exists.The fix for this is to rename the file back to the original when the test is done.
With the proposed fix, the test does not pollute the shared state (and passes when run twice in the same JVM).
Link to JIRA issue: https://issues.apache.org/jira/browse/HDFS-15862