Page MenuHomePhabricator

[services] Tunnelbroker - Add test for putMessageItemsByBatch function
ClosedPublic

Authored by max on Jun 28 2022, 6:41 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Nov 2, 2:21 PM
Unknown Object (File)
Sat, Nov 2, 2:21 PM
Unknown Object (File)
Sat, Nov 2, 2:21 PM
Unknown Object (File)
Sat, Nov 2, 2:20 PM
Unknown Object (File)
Sat, Nov 2, 2:17 PM
Unknown Object (File)
Fri, Oct 18, 7:52 PM
Unknown Object (File)
Thu, Oct 10, 3:43 AM
Unknown Object (File)
Wed, Oct 9, 12:34 PM

Details

Summary

This is a test for putMessageItemsByBatch function introduced in D4378.
In this test, we are creating a messages batch of 29 items and putting them into the database by the putMessageItemsByBatch function. We are expecting the
size of the found items would be the same as an item's batch size.

Linear task: ENG-1301

Test Plan

Run yarn test-tunnelbroker-service-dev-mode

Diff Detail

Repository
rCOMM Comm
Branch
add-test-put-messages-by-batch
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

max held this revision as a draft.
tomek added inline comments.
services/tunnelbroker/test/DatabaseManagerTest.cpp
107 ↗(On Diff #13893)

It's probably not the batch size. The actual batch size is 25, isn't it?

It is simply a number of items.

111 ↗(On Diff #13893)

According to https://www.notion.so/commapp/C-coding-standards-8c9f22b4b16a41c3a868eb5f537db1de we should prefer braces initialization. Can we do this here?

137–138 ↗(On Diff #13893)

Ideally, unrelated changes should be included in a separate diff

This revision is now accepted and ready to land.Jun 29 2022, 4:46 AM
max marked 3 inline comments as done.

Rebase on the stack changes. Minor fixes by comments.

services/tunnelbroker/test/DatabaseManagerTest.cpp
107 ↗(On Diff #13893)

It's probably not the batch size. The actual batch size is 25, isn't it?

It is simply a number of items.

Changed it to an itemsSize.

111 ↗(On Diff #13893)

According to https://www.notion.so/commapp/C-coding-standards-8c9f22b4b16a41c3a868eb5f537db1de we should prefer braces initialization. Can we do this here?

Yes, Sure. Changed it.

137–138 ↗(On Diff #13893)

Ideally, unrelated changes should be included in a separate diff

Yep, or should mark it somehow (make a comment about this or etc.). Sorry for this, linter made these changes.

How were you able to test this?

yarn test-tunnelbroker-service-dev-mode

results in the following for me:

error Command "test-tunnelbroker-service-dev-mode" not found.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
In D4377#133458, @atul wrote:

How were you able to test this?

yarn test-tunnelbroker-service-dev-mode

results in the following for me:

error Command "test-tunnelbroker-service-dev-mode" not found.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Sorry, we've updated the list of commands in package.json while this diff was existing and the test plan was not updated. The updated command to run unit tests is cd /services && yarn run-unit-tests.