HDDS-16338. Fix no-op table size assertions in TestHSync - #11183
HDDS-16338. Fix no-op table size assertions in TestHSync#11183shuan1026 wants to merge 3 commits into
Conversation
chihsuan
left a comment
There was a problem hiding this comment.
Thanks for the patch! @shuan1026 +1 LGTM
| List<OmKeyInfo> filtered = new ArrayList<>(); | ||
| for (OmKeyInfo omKeyInfo : omKeyInfos) { | ||
| for (String keyName : keyNames) { | ||
| if (keyName.equals(omKeyInfo.getKeyName())) { |
There was a problem hiding this comment.
Just a thought, would getFileName() work better here than getKeyName()?
There was a problem hiding this comment.
Thanks for the patch @shuan1026 ! just a quick questions and nit below.
| os.hsync(); | ||
| // There should be 1 key in openFileTable | ||
| assertThat(1 == getOpenKeyInfo(BUCKET_LAYOUT).size()); | ||
| assertEquals(1, getOpenKeyInfo(BUCKET_LAYOUT).size()); |
There was a problem hiding this comment.
Minor question:
As i see in testHSyncOpenKeyCommitAfterExpiry now the keys are checked to avoid failure from other tests having entries in the respective tables. Curious why this test also isn't doing the same or is it safe to assume the open table is empty from earlier tests?
There was a problem hiding this comment.
Minor question: As i see in
testHSyncOpenKeyCommitAfterExpirynow the keys are checked to avoid failure from other tests having entries in the respective tables. Curious why this test also isn't doing the same or is it safe to assume the open table is empty from earlier tests?
Thanks for the review @sravani-revuri! Yes, it isn't safe to assume that.
Scoped this test the same way: the size check, the DELETED_HSYNC_KEY wait and the final wait now all filter to this test's key. Also filtered the one remaining whole-table wait in testHSyncOpenKeyCommitAfterExpiry.
There was a problem hiding this comment.
nit: Unrelated to change, but should this be renamed to fileTable since it reads Keytable not open one?
What changes were proposed in this pull request?
TestHSynchad four no-op AssertJ calls of the formassertThat(n == collection.size()).assertThat(boolean)only builds anAbstractBooleanAssert, so those size checks never failed.They live in two tests:
testHSyncOpenKeyCommitAfterExpiry: after expire,OpenKeyCleanupServiceshould commit the hsynced open key and delete the non-hsync one. The size checks are about this test'skey1/key2, not the whole tables.testHSyncOpenKeyDeletionWhileDeleteDirectory: after hsync, openFileTable should have that one open key before the directory is deleted.This class shares one static bucket and
getOpenKeyInfo/getKeyInfoscan the entire layout. Turning the first test's checks into globalassertEqualsfailed CI (expected: <1> but was: <4>on fileTable; round 1) because other tests leave committed keys behind. That is shared test state, not an hsync/cleanup product bug.This PR:
assertEquals, matching the rest of the filefilterByKeyName(..., key1, key2)What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-16338
How was this patch tested?
assertEqualsonly): failedTestHSync.testHSyncOpenKeyCommitAfterExpiry: https://github.com/shuan1026/ozone/actions/runs/33292933066/job/99208880146filterByKeyName): full fork CI: https://github.com/shuan1026/ozone/actions/runs/33299986156