Skip to content

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

Open
A-d-i-t-y wants to merge 2 commits into
microcks:masterfrom
A-d-i-t-y:fix/waitfor-flag-validation
Open

fix: validate numeric part of --waitFor flag in test command#431
A-d-i-t-y wants to merge 2 commits into
microcks:masterfrom
A-d-i-t-y:fix/waitfor-flag-validation

Conversation

@A-d-i-t-y
Copy link
Copy Markdown

Summary

Adds proper validation for the numeric part of the --waitFor flag.

Problem

Current validation only checks the suffix (milli/sec/min) but not
the numeric part. This allows invalid values like:

  • --waitFor=sec (no number)
  • --waitFor=0sec (zero is invalid)
  • --waitFor=abcsec (non-numeric)

These pass validation but cause unexpected behavior during execution.

Fix

Added validation that ensures:

  • Numeric part must be present (e.g. 5sec not sec)
  • Numeric part must be a valid integer
  • Value must be greater than zero

Example error messages after fix

--waitFor=sec → "--waitFor value "sec" is missing numeric part (e.g. 5sec)"
--waitFor=0sec → "--waitFor value "0sec" must be greater than zero"
--waitFor=abcsec → "--waitFor value "abcsec" has invalid numeric part"

Files Changed

  • cmd/test.go — added numeric validation for --waitFor flag

Closes #430

Previously --waitFor=sec or --waitFor=0sec would pass validation
but cause unexpected behavior during execution.

Now proper validation ensures:
- Numeric part must be present (e.g. 5sec not sec)
- Numeric part must be a valid integer
- Value must be greater than zero

Closes microcks#430

Signed-off-by: Aditya <aaaditya1909@gmail.com>
@A-d-i-t-y
Copy link
Copy Markdown
Author

Hi @Harsh4902 @Vaishnav88sk, I have raised this PR to fix the --waitFor flag validation as discussed in issue #430. Previously invalid values like --waitFor=sec or --waitFor=0sec would pass validation but cause unexpected behavior. This fix adds proper numeric validation with clear error messages. Would love your feedback!

@Harsh4902
Copy link
Copy Markdown
Member

@A-d-i-t-y There some merge conflicts. Can you please check and try to solve it?

@A-d-i-t-y
Copy link
Copy Markdown
Author

Hi @Harsh4902, I have resolved the merge conflict. Please review again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants