-
Notifications
You must be signed in to change notification settings - Fork 1.8k
pkg/ansible: Adding unit tests for the ansible operator reconcile loop #711
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
pkg/ansible: Adding unit tests for the ansible operator reconcile loop #711
Conversation
939461d
to
fd29031
Compare
@mhrivnak Can you take a look at the RunResult changes I made RunResult an interface so that the fake runner could easily create a fake.RunResult. This would allow the user of the fake, to fake |
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.
The change to an interface looks good to me. I just have some small things in the review.
m := map[string]interface{}{} | ||
b, err := json.Marshal(status) | ||
if err != nil { | ||
return m |
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.
Is it ok to ignore the error here and just return an empty map?
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.
as discussed offline adding a log and mentioning that it eats the error on the doc.
@@ -332,17 +332,27 @@ func (r *runner) makeParameters(u *unstructured.Unstructured) map[string]interfa | |||
return parameters | |||
} | |||
|
|||
type RunResult interface { | |||
Stdout() (string, error) |
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.
It would be good to move the comments from runResult.events
and runResult.Stdout()
to here so they'll show up in the documentation.
* Adding fakes for runner, and runner result. * Updating status object to be ouput as a map for deep copy functions.
fd29031
to
a68727c
Compare
Description of the change:
Adding unit tests and fakes to test the reconciliation loop of the ansible operator.