summaryrefslogtreecommitdiff
path: root/internal/ior_mode_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/ior_mode_test.go')
-rw-r--r--internal/ior_mode_test.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/internal/ior_mode_test.go b/internal/ior_mode_test.go
index bac54bd..bbca555 100644
--- a/internal/ior_mode_test.go
+++ b/internal/ior_mode_test.go
@@ -176,6 +176,28 @@ func TestDispatchRunRejectsLiveAndFlamegraph(t *testing.T) {
}
}
+func TestValidateRunConfigRejectsIorWatchWithoutIor(t *testing.T) {
+ cfg := flags.Flags{IorWatchInterval: time.Second}
+ err := validateRunConfig(cfg)
+ if err == nil {
+ t.Fatalf("expected error for -iorWatchInterval without -ior")
+ }
+ if err.Error() != "-iorWatchInterval requires -ior" {
+ t.Fatalf("unexpected error: %v", err)
+ }
+}
+
+func TestValidateRunConfigRejectsNegativeIorWatchInterval(t *testing.T) {
+ cfg := flags.Flags{IorWatchInterval: -time.Second}
+ err := validateRunConfig(cfg)
+ if err == nil {
+ t.Fatalf("expected error for negative -iorWatchInterval")
+ }
+ if err.Error() != "-iorWatchInterval must be >= 0" {
+ t.Fatalf("unexpected error: %v", err)
+ }
+}
+
func TestRunTraceWithContextRequiresRoot(t *testing.T) {
origGetEUID := getEUID
defer func() { getEUID = origGetEUID }()