smengcl commented on code in PR #8021:
URL: https://github.com/apache/ozone/pull/8021#discussion_r1985808926
##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/container/metrics/TestSCMContainerManagerMetrics.java:
##########
@@ -134,37 +129,18 @@ public void testContainerOpsMetrics() throws Exception {
@Test
public void testReportProcessingMetrics() throws Exception {
- String volumeName = "vol-" + UUID.randomUUID();
- String bucketName = "bucket1";
- String key = "key1";
-
MetricsRecordBuilder metrics =
getMetrics(SCMContainerManagerMetrics.class.getSimpleName());
assertThat(getLongCounter("NumContainerReportsProcessedSuccessful",
metrics))
.isPositive();
- final long previous = getLongCounter("NumICRReportsProcessedSuccessful",
metrics);
-
// Create key should create container on DN.
- client.getObjectStore().getClientProxy()
- .createVolume(volumeName);
- client.getObjectStore().getClientProxy()
- .createBucket(volumeName, bucketName);
- OzoneOutputStream ozoneOutputStream = client
- .getObjectStore().getClientProxy().createKey(volumeName, bucketName,
- key, 0, ReplicationType.RATIS, ReplicationFactor.ONE,
- new HashMap<>());
-
- String data = "file data";
- ozoneOutputStream.write(data.getBytes(UTF_8), 0, data.length());
- ozoneOutputStream.close();
-
+ TestDataUtil.createKeys(cluster(), 1);
GenericTestUtils.waitFor(() -> {
final MetricsRecordBuilder scmMetrics =
getMetrics(SCMContainerManagerMetrics.class.getSimpleName());
- return getLongCounter("NumICRReportsProcessedSuccessful",
- scmMetrics) >= previous + 1;
+ return getLongCounter("NumICRReportsProcessedSuccessful", scmMetrics) >
0;
Review Comment:
Thanks @adoroszlai for the patch.
I mean, this is one way to fix it. But this effectively makes this test less
meaningful?
In other words, IMO the original intent of this test case would be to check
if `NumICRReportsProcessedSuccessful` would increment as expect e.g. when a new
container is created. Shall we try to force close the existing containers and
let new write go to a new container?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]