Skip to content

fix: handle json.Unmarshal error in GetTestResult#258

Open
mugiwaraluffy56 wants to merge 1 commit intomicrocks:masterfrom
mugiwaraluffy56:fix/get-test-result-unmarshal-error
Open

fix: handle json.Unmarshal error in GetTestResult#258
mugiwaraluffy56 wants to merge 1 commit intomicrocks:masterfrom
mugiwaraluffy56:fix/get-test-result-unmarshal-error

Conversation

@mugiwaraluffy56
Copy link
Copy Markdown
Contributor

GetTestResult in microcks_client.go called json.Unmarshal but ignored the returned error. every other unmarshal call in the same file checks it, this one didn't.

the problem is that if the api returns something unexpected (an html error page, a rate-limit response, or a not-yet-ready response during startup), json.Unmarshal fails silently and result stays as a zero-value TestResultSummary with Success=false and InProgress=false. the polling loop in cmd/test.go sees inProgress=false, exits immediately, and the user gets a failure with no useful message.

the fix is straightforward: check the error and return it so the caller gets a real error instead of a silent bad result.

also removed the redundant []byte(body) cast since io.ReadAll already returns []byte.

…oring it

Signed-off-by: puneeth_aditya_5656 <myakampuneeth@gmail.com>
@mugiwaraluffy56 mugiwaraluffy56 force-pushed the fix/get-test-result-unmarshal-error branch from 50c1a8e to 68cc46a Compare May 1, 2026 19:31
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.

1 participant