Skip to content

fix: validate numeric part of --waitFor flag in test command #430

@A-d-i-t-y

Description

@A-d-i-t-y

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"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions