Crate mqttest

Source
Expand description

Using mqttest as a crate to unittest your client :

  • Start the tokio runtime (and optionally a logger).
  • Create a Conf struct with the desired behavior for your test.
  • Get an Mqttest struct by start()ing it.
  • Connect your client to the server port.
  • Wait for your client(s) and/or the server to stop.
  • Assert the Vec<ConnInfo> results.

You can find practical examples in the test.rs file.

Structs§

Conf
Specify server behavior.
ConnInfo
Statistics and packet dumps collected about one connection
DumpConnack
Parsed MQTT connack packet.
DumpMeta
DumpPayload
DumpPublish
Parsed MQTT publish packet.
DumpSuback
Parsed MQTT suback packet.
DumpSubscribe
Parsed MQTT subscribe packet.
DumpSubscribeTopic
DumpUnsubscribe
Parsed MQTT unsubscribe packet.
Mqttest
Handle to a running server.
OptMsDuration
Convenience type to save on typing an Option<Duration>.

Enums§

DumpMqtt
Parsed MQTT packet.
DumpQos
Parsed QoS.
DumpQosId
Parsed QoS+PacketIdentifier.
DumpSubackcode

Type Aliases§

DumpPid