summaryrefslogtreecommitdiff
path: root/internal/flamegraph
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-05-20 09:38:50 +0300
committerPaul Buetow <paul@buetow.org>2025-05-20 09:38:50 +0300
commit70d554fb641fbd2b09833316c66468f99e3f41ba (patch)
tree2768b5a235791d8009721000289b32a01bd4fd93 /internal/flamegraph
parentf27848b812aecd0bb0aecb100119c0ab71b5fbeb (diff)
fix unit tests
Diffstat (limited to 'internal/flamegraph')
-rw-r--r--internal/flamegraph/iordata_test.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/internal/flamegraph/iordata_test.go b/internal/flamegraph/iordata_test.go
index a720dee..f01828f 100644
--- a/internal/flamegraph/iordata_test.go
+++ b/internal/flamegraph/iordata_test.go
@@ -35,8 +35,7 @@ func TestMerge(t *testing.T) {
rdwrFlag := flagsType(syscall.O_RDWR)
roFlag := flagsType(syscall.O_RDONLY)
traceId := types.SYS_ENTER_OPENAT
-
- // Initialize two iorData instances with sample data
+ // Initialize iorData instances with sample data
iod1 := iorData{paths: pathMap{
"path1": {traceId: {"comm1": {100: {1000: {rdwrFlag: Counter{
Count: 10,
@@ -62,17 +61,18 @@ func TestMerge(t *testing.T) {
DurationToPrev: 400,
}}}}}}}}
- // Merge iod2 into iod1
- t.Log(iod1)
- t.Log(iod2)
+ t.Log("iod1", iod1)
+ t.Log("iod2", iod2)
+ t.Log("iod3", iod3)
+ t.Log("iod4", iod4)
merged := iod1.merge(iod2).merge(iod3).merge(iod4)
- t.Log(merged)
+ t.Log("merged", merged)
t.Run("Merged correctly", func(t *testing.T) {
if len(merged.paths) != 2 {
t.Errorf("Expected 2 paths, got %d", len(merged.paths))
}
- if merged.paths["path1"][traceId]["comm1"][100][1000][roFlag].Count != 10 {
+ if merged.paths["path1"][traceId]["comm1"][100][1000][rdwrFlag].Count != 10 {
t.Errorf("Expected counter 10, got %d", merged.paths["path1"][1]["comm1"][100][1000][rdwrFlag].Count)
}
if merged.paths["path2"][traceId]["comm2"][101][1000][roFlag].Count != 60 {