Skip to content

fix(test): return KindConnection error on polling timeout - #585

Open
ish-g09 wants to merge 1 commit into
microcks:masterfrom
ish-g09:fix/test-polling-timeout-exit-code
Open

ish-g09 wants to merge 1 commit into
microcks:masterfrom
ish-g09:fix/test-polling-timeout-exit-code

Conversation

@ish-g09

@ish-g09 ish-g09 commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Description

  • Hoisted inProgress variable out of the polling loop in cmd/testExecutor.go to track test state after the deadline expires.
  • Returned errors.Wrapf(errors.KindConnection, ...) if inProgress is still true after the loop so the CLI exits with code 11 instead of 1.
  • Skipped renderTestResult on timeouts so unfinished tests are not falsely reported as contract failures (FAILURE 0ms).
  • Added unit test in cmd/testExecutor_test.go asserting errors.KindConnection and exit code 11.

Related issue(s)

Fixes #573

AI Disclosure

The code changes and unit test were written and verified by me. I fully understand them. I used an AI assistant to discuss the error-handling architecture.

Testing

  • go build ./... : passes
  • go test ./... : all packages pass
  • go test -v -count=1 -run TestRunTestAndWait_TimeoutReturnsKindConnection ./cmd : passes (asserts exit code 11)
  • Manual CLI test against hanging mock server: verified timeout error on stderr and exit code 11
$ ./microcks test "MyAPI:1.0" "http://localhost:8080" HTTP --microcksURL=http://127.0.0.1:8888 --waitFor=100milli
MicrocksClient got status for test "test-hanging-1" - success: false, inProgress: true 
MicrocksTester waiting for 2 seconds before checking again or exiting.
...
test polling timed out after 10100ms waiting for result test-hanging-1
$ echo $?
11
Screenshot 2026-10-15 at 16 38 10

Copilot AI balanced review requested due to automatic review settings October 15, 2026 11:11

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

This branch was successfully deployed

1 active deployment
Build — 628fc155 Deployed Oct 15, 2026 by ish-g09 via build-verify-package #802
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.

microcks test exits with code 1 (contract failure) instead of code 11 (connection) when polling loop times out

2 participants