Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unit tests for MQTT #5724

Merged
merged 2 commits into from
Jan 7, 2025
Merged

Add unit tests for MQTT #5724

merged 2 commits into from
Jan 7, 2025

Conversation

esev
Copy link
Contributor

@esev esev commented Jan 2, 2025

Contributing unit tests for MQTT.

Unfortunately the PubSubClient does not have virtual methods, and can't be mocked directly. Instead I've created a mock WiFiClient that behaves as a small MQTT server to test the uplink portions of the code.

@thebentern
Copy link
Contributor

Unfortunately the PubSubClient does not have virtual methods, and can't be mocked directly

Incidentally, that original library is abandoned and I had taken a cursory swing at switching to a more maintained fork. It did not work out of the box for me, but I was unable to devote much attention to it at the time.
#5204

@esev
Copy link
Contributor Author

esev commented Jan 2, 2025

I can give that library a try with these tests tonight and see what shakes out.

@thebentern
Copy link
Contributor

I can give that library a try with these tests tonight and see what shakes out.

Us forking the... more maintained fork is also an option here 😅

@thebentern thebentern merged commit 27fbfd0 into meshtastic:master Jan 7, 2025
52 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants