test: characterization tests for outbound webhook job#196
Open
dan2k3k4 wants to merge 2 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds test coverage for the outbound webhook delivery job (success, non-success response, and transport-error handling).
Greptile Summary
This PR adds characterization tests for
ProcessPolydockStoreWebhookCalland improves both webhook factories with proper relational defaults and correct enum values.PolydockStoreWebhookCallFactorynow usesPolydockStoreWebhook::factory(), thePENDINGenum default, and null response fields;PolydockStoreWebhookFactorygains the missingpolydock_store_idkey — both changes make the factories work correctly in isolation.PENDINGon the first attempt via the catch block), and the transport-exception path — assertions match the actual job implementation accurately.failed()callback (permanent failure after all retries) is not exercised; calling$job->failed($e)directly in a fourth test would complete the coverage.Confidence Score: 5/5
Test-only change with factory improvements; no production code is modified and all assertions match the actual job implementation.
All three test assertions are verified against the real job code — status transitions, response fields, exception capture, and HTTP header checks are correct. The factory fixes remove incorrect placeholder values that could have caused unrelated tests to fail silently. No production code paths are altered.
No files require special attention; the test file has two minor style/coverage observations but nothing that blocks merging.
Important Files Changed
Sequence Diagram
%%{init: {'theme': 'neutral'}}%% sequenceDiagram participant T as Test participant J as ProcessPolydockStoreWebhookCall participant DB as Database participant H as Http (faked) T->>DB: "factory()->create() [Bus faked, auto-dispatch suppressed]" T->>J: "new Job($call)->handle()" J->>DB: "update(status=PROCESSING, attempt=1)" J->>H: POST webhook URL with headers alt 2xx response H-->>J: 200 OK J->>DB: "update(status=SUCCESS, response_code, response_body, processed_at)" J-->>T: returns void else Non-2xx response H-->>J: 500 Error J->>DB: "update(status=FAILED, response_code, response_body, processed_at)" J->>J: throw Exception J->>DB: "catch: update(status=PENDING, processed_at, exception)" J-->>T: rethrow Exception else Transport Exception H-->>J: throws ConnectionException J->>DB: "catch: update(status=PENDING, processed_at, exception)" J-->>T: rethrow ConnectionException end%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%% sequenceDiagram participant T as Test participant J as ProcessPolydockStoreWebhookCall participant DB as Database participant H as Http (faked) T->>DB: "factory()->create() [Bus faked, auto-dispatch suppressed]" T->>J: "new Job($call)->handle()" J->>DB: "update(status=PROCESSING, attempt=1)" J->>H: POST webhook URL with headers alt 2xx response H-->>J: 200 OK J->>DB: "update(status=SUCCESS, response_code, response_body, processed_at)" J-->>T: returns void else Non-2xx response H-->>J: 500 Error J->>DB: "update(status=FAILED, response_code, response_body, processed_at)" J->>J: throw Exception J->>DB: "catch: update(status=PENDING, processed_at, exception)" J-->>T: rethrow Exception else Transport Exception H-->>J: throws ConnectionException J->>DB: "catch: update(status=PENDING, processed_at, exception)" J-->>T: rethrow ConnectionException endReviews (2): Last reviewed commit: "test: correct attempts() comment and ass..." | Re-trigger Greptile