Skip to content

Kafka sidecar: add a test for the record → CloudEvent → ack delivery path #4098

Closed

Description

@aliok

What

There is no test asserting the actual record → CloudEvent → ack delivery path
through the injected Kafka runtime sidecar.

Gap

The KEDA integration test (pkg/keda, TestInt_KafkaScaling) only verifies
readiness = partition assignment; it produces no records. So the real path —
consume a record → build a CloudEvent → POST to the function's HTTP server →
2xx → commit offset — is unverified from the func side. The negative case
(a non-2xx response must not commit the offset) is also untested.

Proposal

Add a test that produces a record and asserts:

  1. the function receives the expected CloudEvent,
  2. the offset is committed after a 2xx, and
  3. the offset is not committed on a non-2xx (the record is retried).

This could live as an integration test on the slim Kafka job, or as a focused
test in knative-extensions/func-adapter-kafka.

/kind cleanup

Follow-up to #4060.

Activity

  1. aliok commented on Oct 27, 2026

    @aliok
    MemberAuthor

    Done in knative-extensions/func-adapter-kafka#21 (merged). The test lives in the adapter repo because that's where the sidecar's ConsumeClaim delivery path (record → CloudEvent → ack) is implemented. It drives ConsumeClaim with sarama session/claim doubles and asserts: field conversion (key → subject, timestamp → time, partition/offset → ID), ce_* header pass-through, offset marked only after a 2xx delivery, and no offset marked / no advance past a failed record on non-2xx.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions