Page MenuHomePhabricator

[services] Blob - Switch from memcmp to a simple EQ in database tests
ClosedPublic

Authored by max on Apr 11 2022, 7:16 AM.
Tags
None
Referenced Files
F3393913: D3696.diff
Sat, Nov 30, 4:25 PM
Unknown Object (File)
Mon, Nov 25, 11:46 AM
Unknown Object (File)
Fri, Nov 15, 8:16 AM
Unknown Object (File)
Sun, Nov 3, 4:58 PM
Unknown Object (File)
Sun, Nov 3, 4:58 PM
Unknown Object (File)
Sun, Nov 3, 4:58 PM
Unknown Object (File)
Sun, Nov 3, 4:58 PM
Unknown Object (File)
Sun, Nov 3, 4:49 PM

Details

Summary

@palys-swm revealed a bug related to the use of memcmp in this case:
The test would not fail if the test item is a prefix of the found from database item, because we're comparing only
item.*someItem.size() bytes. We don't need to compare the sizes, because the switch to the simple comparison of strings solves the
problem.

Related diff comment https://phabricator.ashoat.com/D3686#101268

Test Plan

Run yarn test-tunnelbroker-service all tests are run and succeed.

Diff Detail

Repository
rCOMM Comm
Branch
blob-remove-tests-memcmp
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

Thanks for fixing it!

This revision is now accepted and ready to land.Apr 12 2022, 3:12 AM
In D3696#101938, @palys-swm wrote:

Thanks for fixing it!

Thank you for revealing this bug!

This revision was landed with ongoing or failed builds.Apr 12 2022, 6:46 AM
This revision was automatically updated to reflect the committed changes.