Skip to content

fix: exit with clear error when --waitFor value is not a valid number#271

Merged
lbroudoux merged 1 commit intomicrocks:masterfrom
mugiwaraluffy56:fix/waitfor-invalid-number-exits-cleanly
May 4, 2026
Merged

fix: exit with clear error when --waitFor value is not a valid number#271
lbroudoux merged 1 commit intomicrocks:masterfrom
mugiwaraluffy56:fix/waitfor-invalid-number-exits-cleanly

Conversation

@mugiwaraluffy56
Copy link
Copy Markdown
Contributor

passing an invalid number to --waitFor (e.g. --waitFor abcsec) would silently set the timeout to 0ms. the suffix check passed because the unit was correct, but strconv.ParseInt returned 0 on the unparseable prefix and the error was discarded with _. the test then fired with a zero timeout and always failed, with no indication of what went wrong.

this also affects the invalid-suffix path: the old code printed a warning but did not exit, so the command continued with whatever value waitForMilliseconds happened to have.

both cases now exit with a clear message pointing at the bad value.

tested manually:

$ microcks test ... --waitFor abcsec
--waitFor value "abcsec" is not a valid number

$ microcks test ... --waitFor 30s
--waitFor format is wrong. Accepted units are: milli, sec, min (e.g. 500milli, 30sec, 5min)

Signed-off-by: puneeth_aditya_5656 <myakampuneeth@gmail.com>
Copy link
Copy Markdown
Member

@lbroudoux lbroudoux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks legit. Thank you very much.

@lbroudoux lbroudoux added this to the Next milestone May 4, 2026
@lbroudoux lbroudoux added kind/enhancement New feature or request component/cli labels May 4, 2026
@lbroudoux lbroudoux merged commit 7081036 into microcks:master May 4, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/cli kind/enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants