Skip to content

Commit 6a29aea

Browse files
akiefufuakie
andauthored
This PR is to add comments to TestParseReportMetric in pkg/ddc/alluxio/report_test.go (#5030)
* Add English comments to TestParseReportMetric in report_test.go Signed-off-by: akie <221850025@smail.nju.edu.cn> * Add comments to TestParseReportMetric in pkg/ddc/alluxio/report_test.go Signed-off-by: akie <221850025@smail.nju.edu.cn> --------- Signed-off-by: akie <221850025@smail.nju.edu.cn> Co-authored-by: akie <221850025@smail.nju.edu.cn>
1 parent 7f0778c commit 6a29aea

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

pkg/ddc/alluxio/report_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,22 @@ func TestParseReportSummary(t *testing.T) {
4343
}
4444
}
4545

46+
// TestParseReportMetric tests the ParseReportMetric method of the AlluxioEngine struct.
47+
// It defines multiple test cases to verify the correctness of metric parsing and calculation of cache hit states.
48+
//
49+
// Each test case provides:
50+
// - 'metrics': input string representing raw metrics data.
51+
// - 'lastCacheHitStates': the previous cache hit state, which may be nil for initial parsing.
52+
// - 'want': the expected cacheHitStates result after parsing.
53+
//
54+
// The test checks two scenarios:
55+
// 1. When there is no previous cache hit state (lastCacheHitStates is nil),
56+
// it verifies that the parsed bytesReadLocal and bytesReadUfsAll values are correct.
57+
// 2. When a previous cache hit state exists, it also checks the computed cache hit ratios
58+
// and throughput ratios for correctness using deep equality.
59+
//
60+
// If the actual output differs from the expected output, the test reports an error
61+
// with detailed information for debugging.
4662
func TestParseReportMetric(t *testing.T) {
4763
testCases := map[string]struct {
4864
metrics string

0 commit comments

Comments
 (0)