-
Notifications
You must be signed in to change notification settings - Fork 34
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
cgu: add wait for condition and unit tests #474
Conversation
92063c4
to
6941aa3
Compare
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.
Looks good. Only one question to clarify
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.
Please fix few comments
pkg/cgu/cgu.go
Outdated
} | ||
|
||
builder.Definition = builder.Object | ||
|
||
for _, condition := range builder.Object.Status.Conditions { | ||
if condition.Status == isTrue && condition.Type == isComplete { | ||
return true, nil | ||
if (expected.Type != "" && condition.Type != expected.Type) || |
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.
Do we have any particular reason to implement such complicated if condition? Why do we need to change it ?
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.
@kononovn The diff is a bit weird here. I'm adding a new more general method WaitForCondition
and then reimplementing the WaitUntilComplete
function using WaitForCondition
so the if statement handles more now. I'll use WaitForCondition
directly in eco-gotests as well.
I've updated the PR to split the if statement into separate ones for clarity though.
In TALM and ZTP test cases there are many scenarios where we are waiting for a CGU to be in some condition. WaitForCondition generalizes these cases (and the existing WaitUntilComplete) into a single function. Unit tests have been added for WaitForCondition as well as the existing WaitUntilComplete.
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.
/lgtm
In TALM and ZTP test cases there are many scenarios where we are waiting for a CGU to be in some condition. WaitForCondition generalizes these cases (and the existing WaitUntilComplete) into a single function. Unit tests have been added for WaitForCondition as well as the existing WaitUntilComplete.