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
Unknown Object (File)
Tue, Sep 24, 1:58 AM
Unknown Object (File)
Tue, Sep 10, 8:51 PM
Unknown Object (File)
Tue, Sep 10, 8:51 PM
Unknown Object (File)
Tue, Sep 10, 8:51 PM
Unknown Object (File)
Tue, Sep 10, 8:50 PM
Unknown Object (File)
Tue, Sep 10, 8:46 PM
Unknown Object (File)
Fri, Sep 6, 9:14 AM
Unknown Object (File)
Aug 22 2024, 1:05 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
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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.