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

[fix] Both 'rx_bytes' and 'tx_bytes' are present #595 #603

Merged
merged 4 commits into from
Nov 7, 2024
Merged

Conversation

praptisharma28
Copy link
Member

@praptisharma28 praptisharma28 commented Jul 26, 2024

Fixes #595

Checklist

  • I have read the OpenWISP Contributing Guidelines.

  • I have manually tested the changes proposed in this pull request.

  • I have written new test cases for new code and/or updated existing tests for changes to existing code.

  • I have updated the documentation.

  • Both 'rx_bytes' and 'tx_bytes' are present in the statistics.

  • Neither of them is None, which allows for zero values (as per the comment).

Closes #595

Copy link
Member

@nemesifier nemesifier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests weren't useful, they weren't failing without the fix.

Also, I think the fix should be to make sure we write the interface stats as long as we get either rx_bytes or tx_bytes, while the patch proposed here would write only if both are present.

I pushed a real fix, please have a look, you can try running tests with:

./manage.py test openwisp_monitoring.device.tests.test_api.TestDeviceApi.test_missing_rx_bytes openwisp_monitoring.device.tests.test_api.TestDeviceApi.test_missing_tx_bytes

If you change the code in openwisp_monitoring/device/writer.py to reset it to the previous state, you should see both tests failing. That's how we do it.

@nemesifier nemesifier merged commit f289eee into master Nov 7, 2024
24 checks passed
@nemesifier nemesifier deleted the rxtx branch November 7, 2024 13:54
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.

[bug] Code issue when writing traffic rx/tx
2 participants