test: Fix invalid JSON payloads in actions workflow runs tests#4197
test: Fix invalid JSON payloads in actions workflow runs tests#4197gmlewis merged 2 commits intogoogle:masterfrom
Conversation
gmlewis
left a comment
There was a problem hiding this comment.
Awesome, thank you, @merchantmoh-debug!
LGTM.
I'm looking at the surrounding code and it is not obvious to me as to how we can prevent bugs like this in the future.
Do you have any ideas, @merchantmoh-debug - or should we just consider this to be a one-off bug fix?
I'm totally fine either way.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4197 +/- ##
=======================================
Coverage 93.71% 93.71%
=======================================
Files 209 209
Lines 19772 19772
=======================================
Hits 18529 18529
Misses 1046 1046
Partials 197 197 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
We could actually eliminate this class of bugs entirely by introducing a simple Right now, the mock servers use If we use a If you like the idea, I could write an AST script to automatically migrate all the intended JSON mock payloads across the test suite over to this new helper (intelligently skipping the tests that intentionally use invalid JSON for error checking). It would be a pretty big diff touching a lot of files though, so if you'd rather avoid the noise, we can absolutely just consider this a one-off bug fix. I'm totally fine either way. |
OK, excellent. Let's go ahead and get this in, and we can address the other ideas later if we decide it would be really beneficial. |
Fixes #4196
Description
Removes the invalid trailing
}}braces from the mock HTTP server JSON payloads inactions_workflow_runs_test.go.Motivation
This bug was silently masked by
json.NewDecoder(). By correcting the test payloads, we ensure the tests are generating valid JSON, clearing the way for stricter memory-pooling and performance optimizations in the core client.Verification