hivemq / mqtt-cli

MQTT CLI is a useful command line interface for connecting various MQTT clients supporting MQTT 5.0 and 3.1.1
https://hivemq.github.io/mqtt-cli/
Apache License 2.0
310 stars 47 forks source link

Test Command: username/password from config.properties ignored #315

Closed strowi closed 1 year ago

strowi commented 2 years ago

Expected behavior

mqtt test should succeed.

Actual behavior

mqtt test fails with login error.

To Reproduce

Steps

create $HOME/.mqtt-cli/config.properties:

mqtt.host=xyz
mqtt.port=8883
mqtt.version=5
auth.username=emqx123
auth.password=password

And run:

~> mqtt test
MQTT 3: NOT_AUTHORIZED
MQTT 5: NOT_AUTHORIZED

while the following works:

~> mqtt test -u emqx123 -pw password
MQTT 3: OK
    - Maximum topic length: 4096 bytes
    - QoS 0: Received 10/10 publishes in 27,38ms
....

Reproducer code

Details

ghost commented 1 year ago

Hi @strowi, thank you for opening this issue. I had a look and could reproduce the problem. We forgot to set the default values for the authentication inside the test command. I will created a pull request with the code change and will add some system tests to verify the solution.