Page MenuHomePhabricator

[services] Tests - Add backup test logic
ClosedPublic

Authored by karol on Jun 13 2022, 7:08 AM.
Tags
None
Referenced Files
F3492311: D4252.id13480.diff
Wed, Dec 18, 11:02 PM
F3492297: D4252.id14031.diff
Wed, Dec 18, 10:59 PM
F3492244: D4252.id14019.diff
Wed, Dec 18, 10:45 PM
F3492233: D4252.id14309.diff
Wed, Dec 18, 10:41 PM
F3491759: D4252.diff
Wed, Dec 18, 8:17 PM
Unknown Object (File)
Fri, Dec 6, 10:35 AM
Unknown Object (File)
Sun, Nov 24, 3:39 AM
Unknown Object (File)
Sun, Nov 24, 3:39 AM

Details

Summary

Depends on D4251

Adding code for the backup test itself.

It does the following things:

  • define starting data
  • create a new backup and add attachments to it based on the starting data
  • send logs and add attachments to them based on the starting data
  • perform "pull backup" and save the results
  • compare the obtained data with the starting data
Test Plan
cd services
yarn run-integration-tests backup

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

karol edited the test plan for this revision. (Show Details)
karol added reviewers: tomek, varun.
karol added inline comments.
services/commtest/tests/backup_test.rs
23 ↗(On Diff #13474)

I think we should use http://localhost:50052

karol edited the summary of this revision. (Show Details)

use localhost

tomek requested changes to this revision.Jun 20 2022, 4:42 AM
tomek added inline comments.
services/commtest/tests/backup_test.rs
1–12 ↗(On Diff #13480)

Why do we need to specify the paths? Can't we place the code in place where rust expects it?

23–24 ↗(On Diff #13480)

Shouldn't we take this value from somewhere (env, config file)? It's not really maintainable when you need to search the codebase in order to modify the port.

39 ↗(On Diff #13480)
73–78 ↗(On Diff #13480)

Use assert_eq in all the assertions

This revision now requires changes to proceed.Jun 20 2022, 4:42 AM
services/commtest/tests/backup_test.rs
1–12 ↗(On Diff #13480)

This discussion is already up in D4228, let's follow up there.

EDIT: I created a task for this: https://linear.app/comm/issue/ENG-1300/[rust]-get-rid-of-import-paths-in-tests

23–24 ↗(On Diff #13480)

Yes, definitely. That goes to the blob test as well.

D4379

39 ↗(On Diff #13480)

ok, we can do this

73–78 ↗(On Diff #13480)

But why? What difference does this make?

services/commtest/tests/backup_test.rs
73–78 ↗(On Diff #13480)

assert_eq has a much more insightful panic message than assert when testing for equality

https://stackoverflow.com/questions/43767552/why-do-assert-eq-and-assert-ne-exist-when-a-simple-assert-will-suffice

services/commtest/tests/backup_test.rs
73–78 ↗(On Diff #13480)

I see

tomek added inline comments.
services/commtest/tests/backup_test.rs
83–88 ↗(On Diff #13931)

Do we need to specify the variables again? I guess that assert_eq's message will contain the values.

This revision is now accepted and ready to land.Jun 29 2022, 3:32 PM
services/commtest/tests/backup_test.rs
83–88 ↗(On Diff #13931)

I've been using this pattern all around. For me, it's easier to deduce what exactly went wrong (expected vs got sounds better than left vs right). I also do not think this is harmful whatsoever.

If you still feel like this isn't good, feel free to create a task for this. I can change it but testing is way simpler for me when I see such a message.

services/commtest/tests/backup_test.rs
83–88 ↗(On Diff #13931)

Fair enough, let's keep it.

This revision was landed with ongoing or failed builds.Jul 8 2022, 2:30 AM
This revision was automatically updated to reflect the committed changes.