HDDS-14608. Convert OzoneFileSystemTests to abstract class#9750
HDDS-14608. Convert OzoneFileSystemTests to abstract class#9750adoroszlai merged 2 commits intoapache:masterfrom
Conversation
|
@adoroszlai can you review please when you have time? |
adoroszlai
left a comment
There was a problem hiding this comment.
Thanks @len548 for the patch.
| protected OzoneFileSystemTestBase() { | ||
| // no instances | ||
| } |
There was a problem hiding this comment.
The comment is no longer valid. The constructor can be completely removed, we can rely on the default one.
| public static void listStatusIteratorOnPageSize(OzoneConfiguration conf, | ||
| protected void listStatusIteratorOnPageSize(OzoneConfiguration conf, |
There was a problem hiding this comment.
This and other existing methods that are not going to be overridden can still be static.
| RemoteIterator<FileStatus> listStatusIterator(Path path) throws IOException { | ||
| return o3fs.listStatusIterator(path); |
There was a problem hiding this comment.
Let's define public abstract FileSystem getFs() in the parent class (implementations already exist, just add @Override). This way we don't need to add a template method for each FileSystem operation (like listStatusIterator(Path)) in the tests.
|
@len548 Please try to avoid force-push when updating the PR. Here are some great articles that explain why: https://developers.mattermost.com/blog/submitting-great-prs/#4-avoid-force-pushing There is no need to rebase on top of |
|
Thanks @len548 for the patch. |
What changes were proposed in this pull request?
As a sub-task of HDDS-12355, I converted
OzoneFileSystemTeststo abstract class (previously it was static final) and renamed it toOzoneFileSystemTestBase. This enables template method pattern and abstracts similar tests betweenAbstractOzoneFileSystemTestandAbstractRootedOzoneFileSystemTesteasier.This PR also addresses:
testOzoneFsServiceLoaderfrom both test classes becauseFileSystem.getFileSystemClass()is Hadoop's code, not Ozone's. We should test our implementation, not the framework's behaviortestCreateKeyWithECReplicationConfigandtestListStatusIteratorWithDirtoOzoneFileSystemTestBaseclass.setPageSizemethod to a new classOzoneFileSystemTestUtilsfrom oldOzoneFileSystemTests.Since there are a lot of duplicates in the two test classes, subsequent Jira tickets will continue to evaluate other duplicate tests if this approach is accepted.
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-14608
How was this patch tested?
Existing test suites are not broken by this PR.
CI pass: https://github.com/len548/ozone/actions/runs/21897543317