shashank created CAMEL-26757:
--------------------------------

             Summary: camel-chaos - test that chaos step rules and the exchange 
sanitizer work together
                 Key: CAMEL-26757
                 URL: https://issues.apache.org/jira/browse/CAMEL-26757
             Project: Camel
          Issue Type: Improvement
          Components: camel-core
            Reporter: shashank
            Assignee: shashank


Follow-up of CAMEL-26714 (the {{camel-sanitizer}} module, rule R1), as agreed 
in the review of its pull request.

The exchange sanitizer design ({{design/exchange-sanitizer.adoc}}, 
"Validation", "Together with the others") asks for a test that runs a route 
with a chaos step rule and the sanitizer on, and shows that each still works: 
chaos injects its faults, and the sanitizer reports only real breaks of the 
contract of {{AsyncProcessor}}. A step that the chaos hook fails is not a call 
of its processor, so it must not be checked or reported. 
{{ManagedSanitizerTest}} in camel-management covers this with a hand-written 
{{StepHook}}; there is no test with the real rules of camel-chaos.

Proposal: a small test class in camel-chaos, which already has 
{{camel-test-junit6}} in test scope, with {{camel-sanitizer}} added in test 
scope (it only brings camel-support and camel-core-model, which camel-chaos 
already has). The tests in camel-core, where the other sanitizer tests are, 
cannot use camel-chaos: camel-chaos uses camel-main in test scope, and 
camel-main uses the test-jar of camel-core in test scope, so the reactor would 
have a cycle.

The cases:
* a {{step=}} {{error}} rule that fails the first attempt of a step, with the 
error handler redelivering: the processor is called once, and the sanitizer 
checks only the redelivered call;
* the same rule on a route with {{noErrorHandler()}}, where the channel of the 
step asks the hook: the processor is never called, and the sanitizer checks no 
call;
* a {{step=}} {{delay}} rule: one call, no report;
* an {{endpoint=}} {{duplicate}} rule, with a first send that completes 
asynchronously and with one that completes synchronously: the producer is 
called twice within one call of the step, whose callback is called once, so no 
report;
* a processor that throws instead of calling its callback, on a step whose 
first attempt a rule fails: reported once ({{THREW_BEFORE_CALLBACK}}), for the 
redelivered call only.

Left out on purpose: JMX, the tracer and the backlog debugger, which 
{{ManagedSanitizerTest}} in camel-management already runs with the sanitizer 
and a hand-written hook that fails a step. Adding camel-management to the test 
scope of camel-chaos would switch JMX on for its camel-main tests.

Test only, no change to main code.

_Filed with Claude Code on behalf of allthingssecurity._



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to