Repository navigation
Conversation
New now requires an annotation loading function which implements NodeAnnotationLoader. Signed-off-by: Steve Milner <[email protected]>
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ashcrow 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 |
|
/cc @sdemos |
|
@ashcrow: GitHub didn't allow me to request PR reviews from the following users: sdemos. Note that only openshift members and repo collaborators can review this PR, and authors cannot review their own PRs. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
Huh. Tests pass locally, fail in prow. Looking at this now. |
|
Ah this makes sense. Because the unittest is happening within a container and is not mounting in |
There was a problem hiding this comment.
coreclientv1 or `clientcorev1``
Signed-off-by: Steve Milner <[email protected]>
6972438 to
960cabc
Compare
Signed-off-by: Steve Milner <[email protected]>
960cabc to
85ec47b
Compare
|
/cc @sdemos |
|
I'm a little on the fence with this approach. It gets the job done, and it does nicely move side-effect-related code to particular functions that will naturally be more controlled with this model. The problem for me is that it seems unwieldy to have all of those types of functions have their own defined function prototype and be function pointer arguments into every function that needs them. I think I'm partial to moving all related types of side-effect code that needs to be mocked to various interfaces, that then can have a real client and a mock client. then we just have a different client for each different kind of part (eg what we vaguely have now, but it's not well adhered to). thoughts? |
Absolutely agree :-/
I think that's a good approach as well. The downside is that it's not just clients, but also functions that have side effects themselves. If we can broaden it to be more than just what is considered a client I think it would be doable. Or if we define client as anything interfacing with an external entity (IE: file system client, kubernetes client, login1 client, etc..). |
this is more concretely what I meant. I vaguely tried writing the original agent with this approach in mind, but didn't stick to it very well, and it's only gone further away from this approach afaict. it seems like the downside is that it would be a more significant refactor. |
|
/hold |
|
See #101 |
Looking through the MCD code I found trying to write unittests a bit harder than normal. One pattern I've seen in the past is to pass functions (or structs, etc..) that have network requests/side effects as part of the design of the system. This unbinds said side effects at the unit level and, in theory, can provide a foundation for different execution paths chosen at runtime.
Note:
Newprobably wasn't example to use to test with since it's pretty simple, but I think the idea still is shown.This is a quick example of:
NodeAnnotationLoaderloadNodeAnnotationstoLoadNodeAnnotationsLoadNodeAnnotationstoNewlogin1.ConntoNew. If passednilone will be created inside ofNew.NodeAnnotationLoaderfor unittesting