-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shared state improvements #841
Shared state improvements #841
Conversation
Publishing all dbs on boot in needed to create an usable environment, the data published, for other apps that may depend on them.
More tests will come :) |
I have done a quick code review without testing, github differ doesn't help much but looks good overall |
Codecov Report
@@ Coverage Diff @@
## master #841 +/- ##
==========================================
- Coverage 72.19% 70.51% -1.69%
==========================================
Files 38 39 +1
Lines 3334 3510 +176
==========================================
+ Hits 2407 2475 +68
- Misses 927 1035 +108
Continue to review full report at Codecov.
|
I've noticed the change from procedural to OOP model, and though it might seem more organized... is that a movement that we want to do? |
Hi @nicopace, thanks for reviewing. One of the goodness of this OOP model is that it allows us to mock Do we think this is enough to adopt OOP model in this case? I think it is |
I understand your point... there should be a way of mocking the behaviour, or at least not shifting programming paradigms, as doing so I believe shouldn't be a decision made on the basis of facilitating the tests, but as an overall design decision. Will try to find alternatives, but also would love to hear how you feel about it... maybe if you agree on the previous statement, we can search together. We can do a pair programming session for this for sure. |
I understand your concern. From my understanding, the previous implementation was modeled following OOP aswell. You first had to "instantiate" SharedState, which returns you an "object" with kind-of methods that behaved differently depending on how you instantiate SharedState. I'm not against using OOP model when it fits well, even for a small part of the system, but yes, we can unify to procedural. |
As German says, the original code was OOP in a way that you can't mock the inner methods until you have the instance at hand. This makes mocking code that instance SharedState harder (the way would be to add a constructor helper method so an instance can be provided from the outside. So I think that the new version is better than the old in this regard. As you have sayd, the other option is to go to a "non OOP way" and exposing all the methods as module functions. This last option is what I have been doing mostly (but in pirania I used a metatable but for other reasons, I wanted to be able to overload the toString method). |
I want to add that I am +1 on the last patch. More tests would be needed though. |
I am ok with it if there is general agreement... mine is not a blocker then. |
Attributes defined at instance table level not metatable Attribute log default to empty function
It did need tests indeed! I found some (pretty sure all) bugs coming from the refactor. |
For me it is ok to have it refactored to OOP style +1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we tested it in a node in quintanalibre and it is working as expected, also in qemu, I think it is ready. Great work @germanferrero !
great work was yours @spiccinini |
Oh I forgot that we have to change the logging as now that the logger bug is fixed it is spaming the syslog |
Returning an int from the main script does not set the exit code.
Use environment variable DEBUG to also log debug messages.
I've test the logger behavior in a node in quintanalibre and it is not spamming the log anymore, thanks @spiccinini |
This reverts commit 5398a91.
Improvements to shared-state
Bug fixes
New unit test:
Motivation
Thanks @spiccinini :)