Why we need this:
The --waitFor flag only validates the suffix (milli/sec/min) but does
not check if the numeric part is present and valid. For example,
--waitFor=sec passes validation but causes unexpected behavior
during execution.
How this will help:
Adding proper validation for the numeric part will give users a
clear error message instead of unexpected behavior.
Motivation:
Improve CLI robustness and user experience with better error messages.
Problem
Current validation in cmd/test.go:
if !strings.HasSuffix(waitFor, "milli") &&
!strings.HasSuffix(waitFor, "sec") &&
!strings.HasSuffix(waitFor, "min") {
// error
}
This allows invalid values like:
- --waitFor=sec (no number)
- --waitFor=0sec (zero wait)
- --waitFor=sec30 (wrong format)
Fix
Add validation to ensure numeric part exists and is greater than zero.
Expected behavior after fix
--waitFor=sec → error: "--waitFor value must include a number e.g. 5sec"
--waitFor=0sec → error: "--waitFor value must be greater than zero"
Why we need this:
The --waitFor flag only validates the suffix (milli/sec/min) but does
not check if the numeric part is present and valid. For example,
--waitFor=sec passes validation but causes unexpected behavior
during execution.
How this will help:
Adding proper validation for the numeric part will give users a
clear error message instead of unexpected behavior.
Motivation:
Improve CLI robustness and user experience with better error messages.
Problem
Current validation in cmd/test.go:
if !strings.HasSuffix(waitFor, "milli") &&
!strings.HasSuffix(waitFor, "sec") &&
!strings.HasSuffix(waitFor, "min") {
// error
}
This allows invalid values like:
Fix
Add validation to ensure numeric part exists and is greater than zero.
Expected behavior after fix
--waitFor=sec → error: "--waitFor value must include a number e.g. 5sec"
--waitFor=0sec → error: "--waitFor value must be greater than zero"