p2panda / aquadoggo

Node for the p2panda network handling validation, storage, aggregation and replication
GNU Affero General Public License v3.0
70 stars 5 forks source link

Optimize test data generation methods #572

Closed sandreae closed 1 year ago

sandreae commented 1 year ago

The methods for generation test data which were imported from p2panda_rs used methods from the api module to publish data to a test node. These methods include validation and retrieving next args (both bring extra db queries) which aren't required when generating test data. This PR refactors the test methods populate_node and populate_and_materialize to generate test data in a more performant manner.

I took the opportunity to make one more change to the test generation api which is that a vec of key pairs is passed in manually to be used for generating the test data. Previously these were generated internally.

📋 Checklist

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 96.00% and no project coverage change.

Comparison is base (27c5069) 92.40% compared to head (7fee3dd) 92.41%. Report is 1 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #572 +/- ## ======================================== Coverage 92.40% 92.41% ======================================== Files 106 106 Lines 18062 18164 +102 ======================================== + Hits 16691 16787 +96 - Misses 1371 1377 +6 ``` | [Files Changed](https://app.codecov.io/gh/p2panda/aquadoggo/pull/572?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=p2panda) | Coverage Δ | | |---|---|---| | [aquadoggo/src/test\_utils/node.rs](https://app.codecov.io/gh/p2panda/aquadoggo/pull/572?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=p2panda#diff-YXF1YWRvZ2dvL3NyYy90ZXN0X3V0aWxzL25vZGUucnM=) | `94.64% <91.03%> (-0.61%)` | :arrow_down: | | [aquadoggo/src/db/stores/blob.rs](https://app.codecov.io/gh/p2panda/aquadoggo/pull/572?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=p2panda#diff-YXF1YWRvZ2dvL3NyYy9kYi9zdG9yZXMvYmxvYi5ycw==) | `98.18% <100.00%> (ø)` | | | [aquadoggo/src/db/stores/document.rs](https://app.codecov.io/gh/p2panda/aquadoggo/pull/572?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=p2panda#diff-YXF1YWRvZ2dvL3NyYy9kYi9zdG9yZXMvZG9jdW1lbnQucnM=) | `98.73% <100.00%> (+0.19%)` | :arrow_up: | | [aquadoggo/src/db/stores/entry.rs](https://app.codecov.io/gh/p2panda/aquadoggo/pull/572?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=p2panda#diff-YXF1YWRvZ2dvL3NyYy9kYi9zdG9yZXMvZW50cnkucnM=) | `99.13% <100.00%> (+0.01%)` | :arrow_up: | | [aquadoggo/src/db/stores/operation.rs](https://app.codecov.io/gh/p2panda/aquadoggo/pull/572?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=p2panda#diff-YXF1YWRvZ2dvL3NyYy9kYi9zdG9yZXMvb3BlcmF0aW9uLnJz) | `89.63% <100.00%> (ø)` | | | [aquadoggo/src/db/stores/query.rs](https://app.codecov.io/gh/p2panda/aquadoggo/pull/572?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=p2panda#diff-YXF1YWRvZ2dvL3NyYy9kYi9zdG9yZXMvcXVlcnkucnM=) | `96.13% <100.00%> (ø)` | | | [aquadoggo/src/db/stores/schema.rs](https://app.codecov.io/gh/p2panda/aquadoggo/pull/572?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=p2panda#diff-YXF1YWRvZ2dvL3NyYy9kYi9zdG9yZXMvc2NoZW1hLnJz) | `98.37% <100.00%> (ø)` | | | [aquadoggo/src/graphql/mutations/publish.rs](https://app.codecov.io/gh/p2panda/aquadoggo/pull/572?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=p2panda#diff-YXF1YWRvZ2dvL3NyYy9ncmFwaHFsL211dGF0aW9ucy9wdWJsaXNoLnJz) | `98.71% <100.00%> (+<0.01%)` | :arrow_up: | | [aquadoggo/src/graphql/queries/next\_args.rs](https://app.codecov.io/gh/p2panda/aquadoggo/pull/572?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=p2panda#diff-YXF1YWRvZ2dvL3NyYy9ncmFwaHFsL3F1ZXJpZXMvbmV4dF9hcmdzLnJz) | `96.95% <100.00%> (-0.06%)` | :arrow_down: | | [aquadoggo/src/materializer/service.rs](https://app.codecov.io/gh/p2panda/aquadoggo/pull/572?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=p2panda#diff-YXF1YWRvZ2dvL3NyYy9tYXRlcmlhbGl6ZXIvc2VydmljZS5ycw==) | `94.78% <100.00%> (ø)` | | | ... and [6 more](https://app.codecov.io/gh/p2panda/aquadoggo/pull/572?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=p2panda) | |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.