summaryrefslogtreecommitdiff
path: root/internal/ior_mode_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-08 20:14:32 +0200
committerPaul Buetow <paul@buetow.org>2026-03-08 20:14:32 +0200
commit4acb116d78588489e79b7e17a79d4609a32fbba7 (patch)
treea43e755c890083fec1fb86169844593cf9a70e13 /internal/ior_mode_test.go
parent21aa0cd0f96087fa040750643109c496e7a1b3ee (diff)
task 367: carry full trace filters through TUI context
Diffstat (limited to 'internal/ior_mode_test.go')
-rw-r--r--internal/ior_mode_test.go22
1 files changed, 21 insertions, 1 deletions
diff --git a/internal/ior_mode_test.go b/internal/ior_mode_test.go
index 6b51985..fef3125 100644
--- a/internal/ior_mode_test.go
+++ b/internal/ior_mode_test.go
@@ -10,6 +10,7 @@ import (
"time"
"ior/internal/flags"
+ "ior/internal/globalfilter"
"ior/internal/tui"
)
@@ -440,7 +441,14 @@ func TestTuiTraceStarterFromRunTraceUsesContextFilters(t *testing.T) {
},
)
- ctx := tui.ContextWithTraceFilters(context.Background(), 2222, 3333)
+ ctx := tui.ContextWithTraceFilters(context.Background(), globalfilter.Filter{
+ PID: &globalfilter.NumericFilter{Op: globalfilter.OpEq, Value: 2222},
+ TID: &globalfilter.NumericFilter{Op: globalfilter.OpEq, Value: 3333},
+ Comm: &globalfilter.StringFilter{Pattern: "nginx"},
+ File: &globalfilter.StringFilter{Pattern: "/var/log"},
+ Syscall: &globalfilter.StringFilter{Pattern: "read"},
+ FD: &globalfilter.NumericFilter{Op: globalfilter.OpEq, Value: 7},
+ })
if err := starter(ctx); err != nil {
t.Fatalf("starter returned error: %v", err)
}
@@ -450,6 +458,18 @@ func TestTuiTraceStarterFromRunTraceUsesContextFilters(t *testing.T) {
if gotCfg.TidFilter != 3333 {
t.Fatalf("expected tid filter from context, got %d", gotCfg.TidFilter)
}
+ if gotCfg.CommFilter != "nginx" {
+ t.Fatalf("expected comm filter from context, got %q", gotCfg.CommFilter)
+ }
+ if gotCfg.PathFilter != "/var/log" {
+ t.Fatalf("expected path filter from context, got %q", gotCfg.PathFilter)
+ }
+ if gotCfg.GlobalFilter.Syscall == nil || gotCfg.GlobalFilter.Syscall.Pattern != "read" {
+ t.Fatalf("expected syscall preserved in global filter payload, got %+v", gotCfg.GlobalFilter.Syscall)
+ }
+ if gotCfg.GlobalFilter.FD == nil || gotCfg.GlobalFilter.FD.Value != 7 {
+ t.Fatalf("expected fd preserved in global filter payload, got %+v", gotCfg.GlobalFilter.FD)
+ }
}
func TestProfilingFilesForMode(t *testing.T) {