Skip to content

Generated MQTT tests omit topic-only URI-template parameters #637

Open

Description

@clemensv

Summary

xrcg 0.11.0 generates MQTT producer tests that do not pass all required URI-template parameters when a message topic contains more than the CloudEvents subject field.

Minimal shape

An MQTT message uses a topic such as:

hydro/no/source/{river_name}/{station_id}/observation

The base CloudEvent subject is {station_id}. The generated publish method correctly requires both river_name and station_id, but the generated tests/test_client.py calls the method with only station_id and an explicit topic.

Failure

TypeError: publish_...() missing 1 required positional argument: 'river_name'

The generated tests fail before publishing, even though the generated client and feeder runtime are correct.

Expected

Generated tests must provide sample values for every required URI-template argument, including topic-only placeholders such as river_name.

Reproducer

Observed in clemensv/real-time-sources/feeders/nve-hydro after generating the MQTT client from xreg/nve_hydro.xreg.json with xrcg 0.11.0 on September 23, 2026.

Activity

  1. clemensv commented on Nov 24, 2026

    @clemensv
    CollaboratorAuthor

    Also reproduced in the Pegelonline generated MQTT client during review of clemensv/real-time-sources#1747. Both Station and CurrentMeasurement tests in feeders/pegelonline/pegelonline_mqtt_producer/pegelonline_mqtt_producer_mqtt_client/tests/test_client.py omit the required water_shortname argument and raise TypeError before publication. This was reproduced against a real test Mosquitto broker. The hand-written bridge passes the argument correctly. No generated consumer files were edited or worked around.

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