Link Search Menu Expand Document Edit GitHub

Broker Test


Runs tests against the specified broker to find out its features and limitations.

mqtt test

By default, the test command will use MQTT 3 clients to test the broker first and will afterward check the connect restrictions returned by a connect of a MQTT 5 client. You can alter this behavior by specifying different options when using the command.

Example

$ mqtt test -h broker.hivemq.com
MQTT 3: OK
    - Maximum topic length: 65535 bytes
    - QoS 0: Received 10/10 publishes in 47,59ms
    - QoS 1: Received 10/10 publishes in 68,87ms
    - QoS 2: Received 10/10 publishes in 43,18ms
    - Retain: OK
    - Wildcard subscriptions: OK
    - Shared subscriptions: OK
    - Payload size: >= 100000 bytes
    - Maximum client id length: 65535 bytes
    - Unsupported Ascii Chars: ALL SUPPORTED
MQTT 5: OK
    - Connect restrictions: 
        > Retain: OK
        > Wildcard subscriptions: OK
        > Shared subscriptions: OK
        > Subscription identifiers: OK
        > Maximum QoS: 2
        > Receive maximum: 10
        > Maximum packet size: 268435460 bytes
        > Topic alias maximum: 5
        > Session expiry interval: Client-based
        > Server keep alive: Client-based

Options

OptionLong VersionExplanationDefault
-V--mqttVersionThe MQTT version to test the broker on.Both versions will be tested
-a--allPerform all tests for all MQTT versions.false (Only test MQTT 3)
-t--timeOutThe time to wait for the broker to respond (in seconds).10
-q--qosTriesThe amount of messages to send and receive from the broker for each QoS level.10

Connect Options

OptionLong VersionExplanationDefault
-h--hostThe MQTT host.localhost
-p--portThe MQTT port.1883

Security Options

Credentials Authentication

OptionLong VersionExplanationDefault
-u--userDefine the username for authentication. 
-pw--passwordDefine the password for authentication directly.
If left blank the user will be prompted for the password in the console.
 
-pw:env Define that the password for authentication is read in from an environment variable.MQTT_CLI_PW if the option is specified without a value
-pw:file Define the path to a file from which the password is read from. 

TLS Authentication

OptionLong VersionExplanationDefault
-s--secureWhether a default (properties file) TLS configuration is used.false
 --cafile, --ca-cert, --server-certThe path to the file containing a trusted CA certificate, to enable encrypted certificate based communication. 
 --capath, --ca-cert-dir, --server-cert-dirThe path to the directory containing trusted CA certificates, to enable encrypted certificate based communication. 
 --cert, --client-certThe path to the client certificate to use for client-side authentication. 
 --key, --client-private-keyThe path to the corresponding private key for the given client certificate. 
 --keypw, --client-private-key-passwordThe password for the client private key. 
 --ks, --keystoreThe path to the client keystore for client side authentication. 
 --kspw, --keystore-passwordThe password for the keystore. 
 --kspkpw, --keystore-private-key-passwordThe password for the private key inside the keystore. 
 --ts, --truststoreThe path to the client truststore, to enable encrypted certificate based communication. 
 --tspw, --truststore-passwordThe password for the truststore. 
 --ciphersThe supported cipher suites in IANA string format concatenated by the ‘:’ character, if more than one cipher should be supported.
e.g TLS_CIPHER_1:TLS_CIPHER_2
See IANA Format for supported cipher suite strings.
 
 --tls-versionThe TLS version to use - TLSv1.1 TLSv1.2 TLSv1.3.TLSv1.2

Logging Options

OptionLong VersionExplanationDefault
-l Log to ~./mqtt-cli/logs (Configurable through ~/.mqtt-cli/config.properties).false

Help Options

OptionLong VersionExplanation
 --helpDisplay help message for command.
 --versionDisplay version information of the cli.

Further Examples

Perform tests for MQTT 5 only

$ mqtt test -h broker.hivemq.com -a -V 5
MQTT 5: OK
    - Connect restrictions: 
        > Retain: OK
        > Wildcard subscriptions: OK
        > Shared subscriptions: OK
        > Subscription identifiers: OK
        > Maximum QoS: 2
        > Receive maximum: 10
        > Maximum packet size: 268435460 bytes
        > Topic alias maximum: 5
        > Session expiry interval: Client-based
        > Server keep alive: Client-based
    - Maximum topic length: 65535 bytes
    - QoS 0: Received 10/10 publishes in 52,70ms
    - QoS 1: Received 10/10 publishes in 79,95ms
    - QoS 2: Received 10/10 publishes in 125,65ms
    - Retain: OK
    - Wildcard subscriptions: OK
    - Shared subscriptions: OK
    - Payload size: >= 100000 bytes
    - Maximum client id length: 65535 bytes
    - Unsupported Ascii Chars: ALL SUPPORTED

Test receiving of 100 publishes in 10s (for each qos level)

$ mqtt test -h broker.hivemq.com -q 100 
...
    - QoS 0: Received 100/100 publishes in 123,44ms
    - QoS 1: Received 100/100 publishes in 223,78ms
    - QoS 2: Received 100/100 publishes in 340,81ms
...

Table of contents