-
Notifications
You must be signed in to change notification settings - Fork 523
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
refactor: use java streams api to get rid of nested if statements in KubernetesClientUtil #3072
Conversation
Eclipse JKube CI ReportStarted new GH workflow run for #3072 (2024-07-17T18:38:04Z) ⚙️ JKube E2E Tests (9979460408)
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3072 +/- ##
=============================================
+ Coverage 59.36% 71.02% +11.66%
- Complexity 4586 5070 +484
=============================================
Files 500 488 -12
Lines 21211 19428 -1783
Branches 2830 2496 -334
=============================================
+ Hits 12591 13798 +1207
+ Misses 7370 4417 -2953
+ Partials 1250 1213 -37 ☔ View full report in Codecov by Sentry. |
Is there unit tests that ensure that there is no regression? if not plz add unit tests |
@rohit-satya : Could you please add unit tests for this change? |
@rohanKanojia Will do |
@rohit-satya : polite ping, are you still working on this? Shall I try to add the unit tests so that we can proceed forward with this? |
@rohanKanojia I have added the UT's, please lmk if any changes are required. thank you for your patience |
Quality Gate passedIssues Measures |
import io.fabric8.kubernetes.api.model.GenericKubernetesResourceBuilder; | ||
import io.fabric8.kubernetes.api.model.Pod; | ||
import io.fabric8.kubernetes.api.model.PodBuilder; | ||
import io.fabric8.kubernetes.api.model.*; |
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.
Could you please revert this import change? We don't use wildcard imports
Pod pod = new Pod(); | ||
PodStatus podStatus = new PodStatus(); | ||
PodCondition podCondition = new PodCondition(); | ||
podCondition.setType("notready"); |
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.
Could you please use a PodCondition from known values? I think possible values are listed here
https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-conditions
@Test | ||
void getPodCondition_whenPodConditionIsReadyAndTrue_shouldReturnReady() { | ||
// Given | ||
Pod pod = new Pod(); |
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.
Could you please check if you can simplify this by using new PodBuilder().withNewStatus()... .build()
Hi @rohit-satya, are you still working on this? |
…KubernetesClientUtil Signed-off-by: Rohit Satya <[email protected]>
Signed-off-by: Rohit Satya <[email protected]>
…ubernetesClientUtilTest Signed-off-by: Rohan Kumar <[email protected]>
b3b3e11
to
624e820
Compare
Quality Gate passedIssues Measures |
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, thx!
Description
Use java streams api to get rid of nested if statements in KubernetesClientUtil
Fixes #3030
Type of change
test, version modification, documentation, etc.)
Checklist