GeorgeJahad commented on a change in pull request #2703:
URL: https://github.com/apache/ozone/pull/2703#discussion_r720868046
##########
File path:
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOmMetrics.java
##########
@@ -111,63 +123,54 @@ public void testVolumeOps() throws Exception {
ozoneManager, "volumeManager");
VolumeManager mockVm = Mockito.spy(volumeManager);
- Mockito.doNothing().when(mockVm).createVolume(null);
- Mockito.doNothing().when(mockVm).deleteVolume(null);
- Mockito.doReturn(null).when(mockVm).getVolumeInfo(null);
- Mockito.doReturn(true).when(mockVm).checkVolumeAccess(null, null);
- Mockito.doNothing().when(mockVm).setOwner(null, null);
- Mockito.doReturn(null).when(mockVm).listVolumes(null, null, null, 0);
-
- HddsWhiteboxTestUtils.setInternalState(
- ozoneManager, "volumeManager", mockVm);
- doVolumeOps();
-
+ OmVolumeArgs volumeArgs = createVolumeArgs();
+ doVolumeOps(volumeArgs);
MetricsRecordBuilder omMetrics = getMetrics("OMMetrics");
- assertCounter("NumVolumeOps", 6L, omMetrics);
+ assertCounter("NumVolumeOps", 5L, omMetrics);
assertCounter("NumVolumeCreates", 1L, omMetrics);
assertCounter("NumVolumeUpdates", 1L, omMetrics);
assertCounter("NumVolumeInfos", 1L, omMetrics);
- assertCounter("NumVolumeCheckAccesses", 1L, omMetrics);
assertCounter("NumVolumeDeletes", 1L, omMetrics);
assertCounter("NumVolumeLists", 1L, omMetrics);
assertCounter("NumVolumes", 1L, omMetrics);
- ozoneManager.createVolume(null);
- ozoneManager.createVolume(null);
- ozoneManager.createVolume(null);
- ozoneManager.deleteVolume(null);
+ volumeArgs = createVolumeArgs();
Review comment:
In the previous version the mocks would allow the counters would
increment, even though the same volume was being created every time. To allow
this to work now, I had to create new volumeArgs, each time a new volume was
created.
--
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]