Skip to content
This repository has been archived by the owner on Aug 12, 2024. It is now read-only.

use k8s cli-utils health checks for bundledeployment resources #745

Merged
merged 1 commit into from
Oct 20, 2023

Conversation

ankitathomas
Copy link
Contributor

Use the third party kstatus package from sigs.k8s.io/cli-utils for health checks for bundledeployment resources

@ankitathomas ankitathomas requested a review from a team as a code owner October 19, 2023 18:21
Comment on lines 61 to 68
isAvailable = &condition
break
}
}
if conditionExists {
continue
if isAvailable == nil {
gvkErrors = appendResourceError(gvkErrors, obj, "Available condition not found")
} else if isAvailable.Status == apiregistrationv1.ConditionFalse {
gvkErrors = appendResourceError(gvkErrors, obj, isAvailable.Message)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to avoid the lint error, you could have a boolean variable indicating whether you found the condition, basically a replacement for isAvailable, and then do the check for ConditionFalse within the loop (as in the original code)

@codecov
Copy link

codecov bot commented Oct 19, 2023

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (05f3afd) 24.67% compared to head (10a9d2b) 21.14%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #745      +/-   ##
==========================================
- Coverage   24.67%   21.14%   -3.54%     
==========================================
  Files          14       14              
  Lines        1143     1069      -74     
==========================================
- Hits          282      226      -56     
+ Misses        807      795      -12     
+ Partials       54       48       -6     
Files Coverage Δ
internal/healthchecks/builtin.go 71.42% <85.71%> (-2.89%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@tmshort tmshort left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@everettraven everettraven added this pull request to the merge queue Oct 20, 2023
@tmshort
Copy link
Contributor

tmshort commented Oct 20, 2023

CodeCov dropped... not sure we care?

@everettraven everettraven removed this pull request from the merge queue due to a manual request Oct 20, 2023
@everettraven
Copy link
Contributor

CodeCov dropped... not sure we care?

IMO not for the amount it dropped

@everettraven
Copy link
Contributor

Removed from merge queue as I saw @ankitathomas pushed just now

Copy link
Contributor

@tmshort tmshort left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
The error checking is more specific in the tests.

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Oct 20, 2023
@@ -135,7 +148,7 @@ func TestAreObjectsHealthy(t *testing.T) {
},
},
},
expectedErr: false,
expectedErr: "",
Copy link
Contributor

@everettraven everettraven Oct 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TLDR: IMO, checking error strings instead of "an error occurred" is going to result in unit tests that are way to brittle when depending on a third-party library.

While I get the desire to use a string here, I think this is going to result in much more brittle test cases. There was a thread at some point in the #olm-dev channel about this and while I don't have a dog in the fight of "we should vs we shouldn't check error strings in tests", I do think this falls into territory where just checking if an error occurred is more appropriate specifically because a part of the error message is going to be coming from a function call that we don't control (the third-party library). This means that a simple dependency bump could result in unit test failures if they change the values that are returned by result.Message which could realistically be any string.

@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Oct 20, 2023
Copy link
Contributor

@tmshort tmshort left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Oct 20, 2023
@tmshort tmshort added this pull request to the merge queue Oct 20, 2023
Merged via the queue into operator-framework:main with commit 24a4e98 Oct 20, 2023
10 of 11 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants