Repository navigation
Add unit testing for our revision controller helpers. - #1160
Conversation
|
The following is the coverage report on pkg/. Say
*TestCoverage feature is being tested, do not rely on any info here yet |
|
FYI, since #1161 means you can't see helpers.go, the coverage is 100% when measured locally. |
| return nil | ||
| } | ||
|
|
||
| func getIsServiceReady(e *corev1.Endpoints) bool { |
There was a problem hiding this comment.
I don't love this name.
There was a problem hiding this comment.
copy/paste, so punting as out-of-scope.
| if condCount == 0 { | ||
| return r.CreationTimestamp.Time | ||
| } | ||
| return r.Status.Conditions[condCount-1].LastTransitionTime.Time |
There was a problem hiding this comment.
Are we guaranteed that conditions always have LastTransitionTime?
There was a problem hiding this comment.
It is not a pointer, so this is safe.
| } | ||
|
|
||
| func getDeploymentProgressCondition(deployment *appsv1.Deployment) *appsv1.DeploymentCondition { | ||
| //as per https://kubernetes.io/docs/concepts/workloads/controllers/deployment |
There was a problem hiding this comment.
nit: add space after //
| continue | ||
| } | ||
| // with Type Progressing and Reason Timeout | ||
| // TODO (arvtiwar): hard coding "ProgressDeadlineExceeded" to avoid import kubernetes/kubernetes |
There was a problem hiding this comment.
nit: no space after TODO
| return r.Status.Conditions[condCount-1].LastTransitionTime.Time | ||
| } | ||
|
|
||
| func getDeploymentProgressCondition(deployment *appsv1.Deployment) *appsv1.DeploymentCondition { |
There was a problem hiding this comment.
This name seems more general than the implementation, which ignores anything without the reason "ProgressDeadlineExceeded".
There was a problem hiding this comment.
I share your sentiment. I'm pretty sure I had this feedback on the original PR as well, and somehow it got dropped on the floor :(
I'd rather not scope creep this PR as this is copy/paste, opened: #1168
| } | ||
|
|
||
| // TODO(mattmoor): This should be a helper on Build (upstream) | ||
| func getBuildDoneCondition(build *buildv1alpha1.Build) *buildv1alpha1.BuildCondition { |
There was a problem hiding this comment.
I don't understand why it is correct to just return the first not-Unknown condition?
There was a problem hiding this comment.
Build doesn't fully adhere to the errors.md guidelines yet, so it could fail with either BuildInvalid or BuildSucceeded. Eventually the former will become webhook validation, and the latter will be the only condition we should see.
cdc06d4 to
235a932
Compare
|
The following is the coverage report on pkg/. Say
*TestCoverage feature is being tested, do not rely on any info here yet |
This moves a bunch of small standalone helper functions into a separate file in our revision controller package and adds unit testing of each of them outside of the context of the controller itself. Progress toward: knative/serving#1150
235a932 to
9e9b8a0
Compare
|
The following is the coverage report on pkg/. Say
*TestCoverage feature is being tested, do not rely on any info here yet |
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jonjohnsonjr, mattmoor The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/test pull-knative-serving-go-coverage |
This moves a bunch of small standalone helper functions into a separate file in our revision controller package and adds unit testing of each of them outside of the context of the controller itself.
Progress toward: #1150