Skip to content
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

Improve failure messages in operator-developer-e2e condition comparison #483

Closed
m1kola opened this issue Oct 24, 2023 · 2 comments
Closed
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines.

Comments

@m1kola
Copy link
Member

m1kola commented Oct 24, 2023

As shown in #481 today if there is a failure in operator-developer-e2e due to unexpected condition we get a message like this:

Status conditions for the operator plain-operator for the version 0.2.0 is not as expected:Expected status: True, but got: False

We should include condition message when failing test due to unexpected condition as it usually contains useful information.

Relevant code:

func checkConditionEquals(actualCond, expectedCond *metav1.Condition) error {
if actualCond == nil {
return fmt.Errorf("Expected condition %s to not be nil", expectedCond.Type)
}
if actualCond.Status != expectedCond.Status {
return fmt.Errorf("Expected status: %s, but got: %s", expectedCond.Status, actualCond.Status)
}
if actualCond.Reason != expectedCond.Reason {
return fmt.Errorf("Expected reason: %s but got: %s", expectedCond.Reason, actualCond.Reason)
}
if !strings.Contains(actualCond.Message, expectedCond.Message) {
return fmt.Errorf("Expected message: %s but got: %s", expectedCond.Message, actualCond.Message)
}
return nil
}

@m1kola m1kola added the good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. label Oct 24, 2023
@trgeiger
Copy link
Contributor

trgeiger commented Apr 5, 2024

Since it looks like the tests have been majorly refactored since this was written, is this issue still necessary?

@m1kola
Copy link
Member Author

m1kola commented Apr 8, 2024

Good call! I think we can close it.

@m1kola m1kola closed this as completed Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines.
Projects
None yet
Development

No branches or pull requests

2 participants