hwclt: Add cache for requests#562
Conversation
|
@pedro-avalos This is a proposal for adding the cache fields. What do you think? |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #562 +/- ##
==========================================
- Coverage 89.17% 85.68% -3.50%
==========================================
Files 29 29
Lines 1423 1781 +358
Branches 5 0 -5
==========================================
+ Hits 1269 1526 +257
- Misses 154 255 +101
*This pull request uses carry forward flags. Click here to find out more.
🚀 New features to boost your workflow:
|
pedro-avalos
left a comment
There was a problem hiding this comment.
Thank you once again for the contribution and great ideas you've brought to Hardware API. I really appreciate the thought you've put behind your spec and willingness to contribute. I've laid out some feedback to make these changes in what I think could be a more structured form.
f04963d to
e0ae82f
Compare
|
@pedro-avalos Completed a proposal for the cache. Can you check it when you have some spare time just to ensure that is what you want, please? |
This first commit adds support for caching the results.
cfd1268 to
72c8247
Compare
This PR adds a cache to preserve the latest state, and defines the cases where the cache has to be invalidated and the Certification Status must be requested again.
By default, the cache is stored at $SNAP_DATA, since the idea is to go full-snap.
Built it and tested both "as-is" and with "sudo", both without parameters and with a wrong "--server" parameter. The first one returned, as expected, an error because it can't collect the data. The second succeeds. The third fails, as expected, with an error because the server doesn't return the expected data format.
Now it always returns a JSON through STDOUT, but if there is an error, it will also return it through STDERR as before.
Checklist
Still require more unitary tests.
Additional Notes