You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "bbejeck (via GitHub)" <gi...@apache.org> on 2026/07/17 18:00:16 UTC

[PR] WIP: KAFKA-XXXX Fault injection proxy [kafka]

bbejeck opened a new pull request, #22860:
URL: https://github.com/apache/kafka/pull/22860

   ## What                                                                                                                                                                                                      
     A lightweight, client-agnostic Kafka **wire-protocol fault-injection proxy** for Streams                                                                                                                     
     integration tests. It sits between a client and an embedded broker — point any                                                                                                                               
     `bootstrap.servers` at it — and decodes/re-encodes responses with Kafka's own protocol classes                                                                                                               
     (`RequestHeader`, `AbstractResponse`, `RequestUtils#serialize`), so it's correct across all                                                                                                                  
     wire/flexible versions with no hand-rolled byte offsets.                                                                                                                                                     
                                                                                                                                                                                                                  
     ## Why                                                                                                                                                                                                       
     This proxy lets a test deterministically inject broker-side faults — and *drive lifecycle transitions*                                                                                                                              
     (fault → rebalance / migrate / corrupt / revive) — to flush out that class of bug before release.                                                                                                            
                                                                                                                                                                                                                  
     ## API                                                                                                                                                                                                       
     ```java                                                                                                                                                                                                      
     try (var proxy = KafkaProtocolFaultProxy.inFrontOf(cluster.bootstrapServers())) {                                                                                                                            
         props.put(BOOTSTRAP_SERVERS_CONFIG, proxy.bootstrapServers());                                                                                                                                           
         proxy.injectError(ApiKeys.END_TXN, Errors.INVALID_TXN_STATE).once();                                                                                                                                     
         proxy.disconnectOn(ApiKeys.END_TXN).everyTime();   // models the EOS commit gap                                                                                                                          
     }                                                                                                                                                                                                            
     ```                                                                                                                                                                                                          
                                                                                                                                                                                                                  
     Triggers: `once()` / `onCall(n)` / `times(n)` / `everyTime()` / `withProbability(p)` — the first                                                                                                             
     three are deterministic and assertion-safe. Routing is transparent (rewrites                                                                                                                                 
     `Metadata`/`FindCoordinator`); sockets are never dropped unless a `disconnectOn` rule fires, so                                                                                                              
     the proxy isn't itself a flakiness source.


-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] WIP: KAFKA-XXXX Fault injection proxy [kafka]

Posted by "bbejeck (via GitHub)" <gi...@apache.org>.
bbejeck closed pull request #22860: WIP: KAFKA-XXXX Fault injection proxy
URL: https://github.com/apache/kafka/pull/22860


-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org