Repository navigation
test(ci): assert status codes and response shape for /webhook/manual in integration job - #107
Merged
OkiriGabriel merged 1 commit intoOct 22, 2026
Conversation
The integration job posted incidents to /webhook/manual with `|| echo "Expected to fail gracefully"`. curl exits 0 on HTTP 4xx/5xx unless -f is given, so those steps could only fail on a connection error and never checked what the server returned. Capture the HTTP status and body for each request and assert: - k8s, cicd and argocd incidents: 200, status "queued", a non-empty incident_id, and the echoed context (type as sent, source "manual") - missing "type": 400 "'type' field required" - invalid JSON: 400 "JSON object required" On a mismatch the step exits non-zero and prints the status and body. Other /webhook/* routes are not covered yet. Part of open-devops-agent#18
This was referenced Nov 21, 2026
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.
Description
The integration job posted incidents to
/webhook/manualwith|| echo "Expected to fail gracefully without real API key".curlexits 0 on HTTP 4xx/5xx unless-fis given, so those steps could only fail if the connection itself failed; they never checked what the server returned.Each webhook step now captures the HTTP status and body and asserts:
k8s,cicdandargocdincidents: HTTP 200,status == "queued", a non-empty stringincident_id,context.typeequal to the type sent, andcontext.source == "manual"type: HTTP 400 with'type' field requiredJSON object requiredOn a mismatch the step exits non-zero and prints the status code and body, so failures are debuggable from the CI log.
Part of #18 (this covers
/webhook/manualonly; it does not close the issue)Type of Change
CI configuration change (none of the listed types fit).
Platform/Component
Testing
Unit tests added/updated
Integration tests pass
Manual testing performed
Tested with dummy data
Tested in production-like environment
Probed the real
/webhook/manualroute in-process with FastAPI'sTestClient: no server and no queue worker started, in-memory storage,WEBHOOK_SECRETunset,DevOpsAgentandSlackNotifierpatched,.envloading disabled. Results: the three incident types returned 200 withstatus: "queued", anINC-...incident_idand the echoed context (source: "manual"); a missingtypereturned 400'type' field required; invalid JSON returned 400JSON object required.Parsed the workflow with
yaml.safe_loadand ranbash -non each newrun:script.jqisn't installed on my machine, so I evaluated the same conditions in Python against the captured responses locally.CI result on this PR: all 10 checks pass, including the integration job running the new
jqassertions against the live server.Full test suite locally (Windows): 436 passed, 2 skipped, 1 failed. The failure is
tests/test_nginx_bamboo.py::TestNginxTools::test_write_file_command_prevents_shell_expansion, which shells out topython3; that isn't on my Windows PATH (sh: python3: command not found). It is unrelated to this workflow-only change, and the Test Agent jobs in CI run it on Linux.Test Configuration
Checklist
Screenshots (if applicable)
N/A
Breaking Changes
None to the application. In CI, a change to the status code or body shape of
/webhook/manualwill now fail the integration job. #64 (fail-closed webhook defaults) will need to update these steps when it lands.Additional Notes
/webhook/manualis asserted here./webhook/github,/alertmanager,/grafana,/gitlaband/bitbucketare not covered yet; happy to follow up with those if you'd like.Reviewer Checklist