magistrala icon indicating copy to clipboard operation
magistrala copied to clipboard

MF-1197 - MQTT tests

Open zzokki81 opened this issue 3 years ago • 1 comments

What does this do?

Added MQTT unit tests

Which issue(s) does this PR fix/relate to?

Resolves #1197

List any changes that modify/break current functionality

Have you included tests for your changes?

MQTT unit tests

Did you document any new/modified functionality?

No

Notes

zzokki81 avatar Jun 24 '22 13:06 zzokki81

Codecov Report

Merging #1622 (4c510b5) into master (78b025c) will increase coverage by 0.10%. The diff coverage is 85.18%.

@@            Coverage Diff             @@
##           master    #1622      +/-   ##
==========================================
+ Coverage   68.91%   69.01%   +0.10%     
==========================================
  Files         143      145       +2     
  Lines       11544    11671     +127     
==========================================
+ Hits         7955     8055     +100     
- Misses       2888     2911      +23     
- Partials      701      705       +4     
Impacted Files Coverage Δ
mqtt/handler.go 92.45% <85.18%> (ø)
mqtt/forwarder.go 0.00% <0.00%> (ø)
things/service.go 66.07% <0.00%> (+0.71%) :arrow_up:

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

codecov-commenter avatar Jun 27 '22 14:06 codecov-commenter

Merged! Thanks @zzokki81. This was a nice solution with log analysis, but we should improve in the future by adding return values to the handlers.

drasko avatar Nov 21 '22 13:11 drasko

The main improvement would be adding return errors where it's missing, and using pubsub mocks to check if pubsub methods are called for successful flow (rather than checking for info logs). Also, moving the logger from the handler implementation to the logging wrapper/middleware is a good idea.

dborovcanin avatar Nov 21 '22 13:11 dborovcanin

Issue to track: https://github.com/mainflux/mproxy/issues/31

drasko avatar Nov 21 '22 13:11 drasko