-
Notifications
You must be signed in to change notification settings - Fork 462
pkg/daemon: add atomic files writing and remove file system abstraction #401
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
Conversation
b558b36 to
4657d41
Compare
|
I'm cool with replacing the abstraction with functions that can be mocked for testing. |
b039868 to
3eeea91
Compare
|
"fix files leak" is a bit understated of a commit message title 😉 "Remove filesystem mock, fix bugs"? dunno. Personally I am not a huge fan of the current unit testing we have...I tend to prefer "real" testing and make that as convenient as possible. When the mocking starts to get nontrivial (as is the case not only with the filesystem but also our mock kube client stuff) I think the value proposition gets a lot more uncertain. OTOH it can be easier to test error conditions via mocking. On the other other hand...a few strategic points to inject errors can go a long way. I think though I'd say we probably shouldn't do this change right now...the bug isn't worth the code churn? Let's fix the leak in the existing code and keep this around for later? |
|
Something that did change of course since the unit testing here was introduced is that we have our own |
added potential, even if, on any error, we end up leaving files around :)
I belive the abstraction introduced was because there was no e2e, not that we have it, we can indeed test it for real
I'm not sure about, this mainly adds atomic file writing to prevent files laying around, the defer file.Close() isn't really doing nothing per-se (I spotted that later, was already adding atomic file write). |
That sounds reasonable to me. |
this is indeed why I've added Closes #101 as well in the first comment |
3eeea91 to
6145839
Compare
71657cc to
1a089bf
Compare
|
/retest |
|
e2e(s) rock 🚀 |
1a089bf to
24de6b0
Compare
pkg/daemon/daemon.go
Outdated
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.
Could you explain what this is for?
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.
this is a lightweight version of the filesystem client, as in, the client existed mainly to be able to unit test the flow as we shouldn't wrap the file management API of Golang. By having a function which deals with writes only, we're able to mock it out in unit test till we have proper e2e in place for these scenarios.
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.
ah thanks! I missed the note on line 87.
1bcd584 to
177655b
Compare
|
Unit flake tracked here: #449 /retest |
177655b to
de623c6
Compare
de623c6 to
c9a32e2
Compare
c9a32e2 to
471b188
Compare
|
I'm moving this to |
|
/retest |
This patch makes sure we write files atomically so, if and only if, we'll be able to reconcile a failing machine, we don't end up having old files lying around. Last thing this patch does is getting rid of the FileSystemClient abstraction. I've replaced that with normal 1st class function assignements so we don't regress in testing. We would need to move those tests to e2e anyway. Signed-off-by: Antonio Murdaca <[email protected]>
|
Can you push the rebased commit here? |
just done |
|
/approve This LGTM. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cgwalters, runcom The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
I guess we can let this go in with #548 as that is based on this now. |
Closes #101
@cgwalters @kikisdeliveryservice @ashcrow ptal
Signed-off-by: Antonio Murdaca [email protected]