Skip to content

Add broker-level integration test harness (pytest + paho-mqtt) #16

Description

@TalkingJupiter

Context

The hello → config → telemetry handshake has never been exercised end to end. The Radxa host does not exist yet, so a Python test harness that plays host against the real device is both the test rig for #3 and the executable contract for #11 — whatever MAC format and role names the harness uses becomes the spec the real provisioning service must match.

Scope

A pytest + paho-mqtt suite (suggested location: host/tests/) run against the Mosquitto broker with a real ESP32 on the bench.

Scenarios

  1. Device boots unconfigured → hello appears on repacss/devices/<mac>/hello within HELLO_INTERVAL_MS, payload is valid JSON with the right MAC
  2. Harness publishes a valid config → hello stops, telemetry starts on the assigned topic (configured && enabled gate opens)
  3. Invalid / malformed config → telemetry stays off, device keeps helloing
  4. Retained config + device reboot → config arrives immediately on subscribe (verifies subscribe-before-hello ordering for real)
  5. Config payload larger than the 1024-byte MQTT buffer → dropped, device unaffected
  6. Broker restart → device reconnects and re-subscribes, config delivery still works

Acceptance criteria

Relates to #3, #11.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions