Add validation to SED type commodities#347
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #347 +/- ##
==========================================
+ Coverage 96.03% 96.11% +0.08%
==========================================
Files 27 27
Lines 3279 3400 +121
Branches 3279 3400 +121
==========================================
+ Hits 3149 3268 +119
Misses 60 60
- Partials 70 72 +2 ☔ View full report in Codecov by Sentry. |
alexdewar
left a comment
There was a problem hiding this comment.
Looks good! I've made some minor suggestions.
I would split the actual check into its own separate function to make things a bit more modular and so that you can return early once you've found a producer and consumer.
|
Thanks @alexdewar. I've pulled out the checks specific to SED commodities into their own function and implemented your other suggestions. |
alexdewar
left a comment
There was a problem hiding this comment.
Hey,
Sorry I forgot to re-review this! Looks good. I've made one small suggestion (you can return early from validate_sed_commodity), but other than that, I think we're good to merge.
|
Cool. I would have needed to wrap the return Err(anyhow!(
"Commodity {} of 'SED' type must have both producer and consumer processes",
commodity_id
));But it looks like |
Description
This pull request focuses on validation of commodities. The most important change includes the implementation of a commodity validation function, and the creation of a corresponding test.
Fixes #167
Type of change
Key checklist
$ cargo test$ cargo docFurther checks