CommitLogMetrics Test-CasesCommitLogMetrics Test-Cases
1. For below metrics, test-case are added in CommitLogTest.java . In test-cases, mutations are added, which internally update metrics.
- completedTasks
- totalCommitLogSize
- waitingOnCommit
2. pendingTasks - In AbstractCommitLogService.java , added testPendingTasks test-case, since pendingTasks metric are incremented and decremented in single method of AbstractCommitLogService::maybeWaitForSync .
So introduced a dummy method incrementPendingTaks in FakeCommitLogService-class, to manually update pendingTasks metric.
3. waitingOnSegmentAllocation - In CommitLogMetricsTest.java test-case is added. In test commitlog_segment_size_in_mb is changed to 1mb, and adding multiple mutations so that waitingOnSegmentAllocation metric updated while creating new segments.
In normal case , waitingOnSegmentAllocation it will be zero, if during test-execution, waitingOnSegmentAllocation was not updated, then manually updating it.