Mahesh kumar gaddam created HDDS-16422:
------------------------------------------

             Summary: Freon dfsrw integration test cannot assert an exact file 
count once reads are drawn per operation
                 Key: HDDS-16422
                 URL: https://issues.apache.org/jira/browse/HDDS-16422
             Project: Apache Ozone
          Issue Type: Test
          Components: freon
            Reporter: Mahesh kumar gaddam


{\{TestHadoopFsReadWriteValidator.testWriteReadValidate}} used to assert that 
\{{-n}} files were left on the file system, because every operation was a 
write. Since HDDS-16354 introduced \{{--read-percent}}, each operation 
independently draws read or write, so the file count is a random variable and 
the test can only bound it:

{code:java}
assertThat(files.length).isBetween(1, fileCount);
{code}

That bound is weak. A run that performs 11 writes but leaves only 3 files on 
the file system still passes, so a path-collision or lost-write bug in the 
generator would go unnoticed by this test.

The write count is available at runtime, as 
\{{BaseFreonGenerator.getMetrics().timer("file-write").getCount()}}, but 
reading it from \{{integration-test}} makes that module compile against 
\{{io.dropwizard.metrics:metrics-core}}, which it does not declare, and 
\{{maven-dependency-plugin:analyze}} fails the build on the undeclared use:

{noformat}
[ERROR] Used undeclared dependencies found:
[ERROR]    io.dropwizard.metrics:metrics-core:jar:3.2.6:test
{noformat}

Options:
* Declare \{{metrics-core}} as a test dependency of 
\{{hadoop-ozone/integration-test}} and assert \{{files.length == writes}}.
* Expose the per-operation counts through a plain accessor on 
\{{BaseFreonGenerator}}, with no Dropwizard types in the signature, so any test 
can assert on them without the dependency.
* Add a second invocation at \{{--read-percent 0}} purely for the exact-count 
assertion, keeping the mixed run for read validation.

The second looks cleanest. The underlying awkwardness is that \{{getMetrics()}} 
leaks a Dropwizard type into what is effectively the test surface of the 
generators.



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