davsclaus opened a new pull request, #29521: URL: https://github.com/apache/camel/pull/29521
[CAMEL-26793](https://issues.apache.org/jira/browse/CAMEL-26793): a route that starts from `platform-http` or the REST DSL could not be fed by a chaos experiment. The component has no producer, and #29519 (CAMEL-26792) refuses such a feed with the reason. Now the experiment sends it as **HTTP requests to the integration's own server**: - **Where:** localhost and the port of its HTTP server, as `HttpEndpoints.fromStatus` finds them for the `http_request` tool. The path is the one served, including the context path of the server or the REST DSL. The method is the route's (`httpMethodRestrict`, the REST verb), POST otherwise. - **What:** `--body` is the request body (text, `file:<path>`, or `file:<folder>` for one request per file). `--header` lines are HTTP headers, and `Content-Type: application/json` is added for a JSON body. - **When:** the requests are sent on a virtual thread while the experiment waits for its verdict, with the pauses of `--interval`. They stop when the experiment ends. - **Evidence:** the traffic counts the **status codes the clients got**, so a hypothesis such as "a client gets a 503, not a 500" has its evidence. Run 3 of the demo had exactly that hypothesis for the payment route, and could not check it. - **Path with a parameter** (`/orders/{id}`): the feed is the path to call, with an optional method (`--feed='PUT /orders/42'`). The error for such a route says so, with an example. Live, on the shop of the chaos example (payment served by platform-http): ``` $ camel cmd chaos-experiment shop --hypothesis='a client of payment gets an error, nothing is lost' \ --rule='route=payment error rate=every:4 until=30s expect=payment:failed<=0 within=20s' \ --feed=payment --body='{"orderId": "O-1", "amount": 10}' --repeat=12 --interval=100..300 Experiment 1 FAIL a client of payment gets an error, nothing is lost (r1, ended after 2s) expect payment:failed<=0: unmet, 1 failed routes: orders 2 completed, 0 failed, payment 6 completed, 1 failed, shipping 2 completed, 0 failed traffic: 5 messages sent to POST http://localhost:8080/payment in 1s, answered 200 x4, 500 x1 (of 12: the experiment ended first) ``` What changed: - **New:** `ChaosHttpFeed` (target, bodies, headers, the sender). - **`ChaosExperimentRun`:** - `Integration.http` is a default method on the JDK HttpClient, so the CLI, `camel ask` and MCP all get it without changes, and a test can fake it. - `checkFeed` lets platform-http, rest and paths through. An HTTP server with its own address (netty-http, undertow, jetty) is still refused with the reason. - `feedWarning` no longer calls an HTTP route a real remote system. - **CLI:** the traffic line prints the status codes, and "of N: the experiment ended first". - **Wording:** the playbook, the feed parameter of the tools and the CLI, and the docs (camel-jbang-managing). - **Generated:** golden help and the command metadata are regenerated. Tests: `ChaosExperimentRunTest` (`anHttpRouteIsFedWithRequestsToTheServerOfTheIntegration`, `whereTheRequestsOfAnHttpFeedGo`) and `CamelChaosActionTest`. 567 chaos, tool, golden and help tests of camel-jbang-core are green. **Stacked on #29519** (CAMEL-26792). Retarget to main once that merges. _Claude Code on behalf of Claus Ibsen_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_012nJsFsjqqFiwroeHRWaKbS -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
