Skip to content

Generated Kafka cross-event key test filters variant message IDs instead of wire types #711

In review

Description

@clemensv

Defect

The generated Python Kafka cross-event key test filters CloudEvents using transport-specific message IDs instead of the inherited wire type. The producer emits both messages, but the test ignores them and times out.

Observed in the checked-in generated Pegelonline package:
https://github.com/clemensv/real-time-sources/blob/1eb840424a24e94d87e3b7cdaf57864bc52871b9/feeders/pegelonline/pegelonline_producer/pegelonline_producer_kafka_producer/tests/test_producer.py#L232

Reproduction

Install the local generated data and Kafka producer packages, pytest and the Kafka testcontainers dependencies. Run:

python -m pytest feeders\pegelonline\pegelonline_producer\pegelonline_producer_kafka_producer\tests\test_producer.py::test_de_wsv_pegelonline_kafka_cross_event_type_kafka_key -q

The messages inherit these CloudEvents types from their base contracts:

  • de.wsv.pegelonline.Station
  • de.wsv.pegelonline.CurrentMeasurement

The generated test instead checks:

if cloudevent["type"] in [
    "de.wsv.pegelonline.kafka.Station",
    "de.wsv.pegelonline.kafka.CurrentMeasurement",
]:
    collected_keys.append(...)

Actual result:

AssertionError: Expected 2 messages but received 0

The per-family generated tests accept the canonical wire types and pass against the same test broker. The cross-event test uses the transport variant's registry message identity rather than the resolved envelope metadata value.

Expected correction

Generate the cross-event filter from the resolved literal envelopemetadata.type.value, including inherited values. Do not change valid producer wire types to match the incorrect test. Add a generator regression with variant message IDs that differ from the canonical CloudEvents type. No consumer generated files have been edited or worked around.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions