Page MenuHomePhabricator

[services] Tunnelbroker - Database SessionSignatureItem tests
ClosedPublic

Authored by max on Apr 11 2022, 3:40 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Jul 5, 6:18 PM
Unknown Object (File)
Mon, Jul 1, 12:41 PM
Unknown Object (File)
Sun, Jun 30, 5:25 AM
Unknown Object (File)
Sat, Jun 29, 10:37 PM
Unknown Object (File)
Sat, Jun 29, 10:37 PM
Unknown Object (File)
Sat, Jun 29, 10:37 PM
Unknown Object (File)
Sat, Jun 29, 10:37 PM
Unknown Object (File)
Sat, Jun 29, 10:37 PM

Details

Summary

Database (DynamoDB) item tests. For the SessionSignatureItem database entity we perform:

  • Check if the table is available,
  • Create and fulfill database item entity,
  • Put into the database table,
  • Find the record using the primary key,
  • Compare record fields of created item and item from database record,
  • Remove the testing record from the database.

Related linear task: ENG-686

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

tomek requested changes to this revision.Apr 11 2022, 5:14 AM

We also need to clarify our approach to randomness in D3654

services/tunnelbroker/test/DatabaseManagerTest.cpp
39–44 ↗(On Diff #11274)

Like in D3686, let's compare strings

This revision now requires changes to proceed.Apr 11 2022, 5:14 AM

Switch from memcmp to a simple EQ.

max marked an inline comment as done.

Switching to the Plan changes until we clarify the random/non-random value for tests.

Added tests with static variables along with generated ones following D3654#102087.

Not sure if it is possible, but maybe we can reduce duplication here by creating a function that receives SessionSignItem and does the testing. Then, in these two tests we would just create the item and call that function.

This revision is now accepted and ready to land.Apr 19 2022, 2:30 AM
In D3687#104093, @palys-swm wrote:

Not sure if it is possible, but maybe we can reduce duplication here by creating a function that receives SessionSignItem and does the testing. Then, in these two tests we would just create the item and call that function.

I think it's possible, but not sure we need to spend time on this test now, as it doing its job now. But thanks for the suggestion!