[ 
https://issues.apache.org/jira/browse/HDDS-16338?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

ASF GitHub Bot updated HDDS-16338:
----------------------------------
    Labels: pull-request-available  (was: )

> TestHSync has no-op assertThat checks on openFileTable/fileTable sizes
> ----------------------------------------------------------------------
>
>                 Key: HDDS-16338
>                 URL: https://issues.apache.org/jira/browse/HDDS-16338
>             Project: Apache Ozone
>          Issue Type: Bug
>            Reporter: Meng-Shuan Tsai
>            Assignee: Meng-Shuan Tsai
>            Priority: Major
>              Labels: pull-request-available
>
> TestHSync.java has four no-op assertions. No test run is needed to see it: 
> this is a static code issue, not a runtime failure.
> testHSyncOpenKeyCommitAfterExpiry:
> {code}
> assertThat(2 == getOpenKeyInfo(BUCKET_LAYOUT).size());
> assertThat(1 == getKeyInfo(BUCKET_LAYOUT).size());
> // ... after open-key cleanup ...
> assertThat(1 == getKeyInfo(BUCKET_LAYOUT).size());
> {code}
> testHSyncOpenKeyDeletionWhileDeleteDirectory:
> {code}
> assertThat(1 == getOpenKeyInfo(BUCKET_LAYOUT).size());
> {code}
> assertThat(boolean) returns an AbstractBooleanAssert. Without a trailing 
> isTrue()/isFalse() the object is discarded and nothing is ever checked, so 
> these lines pass even when the size comparison is false.
> See AssertJ source (this project pins assertj-core 3.27.7, per pom.xml):
> https://github.com/assertj/assertj/blob/assertj-build-3.27.7/assertj-core/src/main/java/org/assertj/core/api/Assertions.java#L361
> https://github.com/assertj/assertj/blob/assertj-build-3.27.7/assertj-core/src/main/java/org/assertj/core/api/AbstractBooleanAssert.java#L62-L84



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to