Page MenuHomePhabricator

[services] Tests - Add backup test logic
ClosedPublic

Authored by karol on Jun 13 2022, 7:08 AM.
Tags
None
Referenced Files
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
Unknown Object (File)
Sun, Nov 24, 3:39 AM
Unknown Object (File)
Sun, Nov 24, 3:39 AM
Unknown Object (File)
Sun, Nov 24, 3:38 AM
Unknown Object (File)
Sun, Nov 24, 3:38 AM
Unknown Object (File)
Sun, Nov 24, 3:38 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
Branch
@karol/services-tests-rust
Lint
No Lint Coverage
Unit
No Test Coverage

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

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

23–24

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
73–78

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

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

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

D4379

39

ok, we can do this

73–78

But why? What difference does this make?

services/commtest/tests/backup_test.rs
73–78

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

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.