-
Notifications
You must be signed in to change notification settings - Fork 38.7k
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
Write replaceCoreV1NamespacedPodTemplate test - +1 endpoint coverage #108286
Conversation
/triage accepted |
/test pull-kubernetes-unit
|
/test pull-kubernetes-node-e2e-containerd
|
/test pull-kubernetes-e2e-kind-ipv6
|
/priority backlog |
/cc @endocrimes |
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.
Took a quick first pass - Seems like an ok happy-path test, we might want to add a failure case test too? (that some field cannot be updated for example)
test/e2e/common/node/podtemplates.go
Outdated
}) | ||
|
||
ginkgo.It("should replace a pod template", func() { | ||
|
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.
nit: rm extra line here
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.
Fixed
test/e2e/common/node/podtemplates.go
Outdated
|
||
err = retry.RetryOnConflict(retry.DefaultRetry, func() error { | ||
ptResource, err = ptClient.Get(context.TODO(), ptName, metav1.GetOptions{}) | ||
framework.ExpectNoError(err, "Unable to pod template %s", ptName) |
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.
framework.ExpectNoError(err, "Unable to pod template %s", ptName) | |
framework.ExpectNoError(err, "Unable to get pod template %s", ptName) |
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.
Fixed
test/e2e/common/node/podtemplates.go
Outdated
ptResource, err := ptClient.Create(context.TODO(), &v1.PodTemplate{ | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Name: ptName, | ||
Labels: map[string]string{"podtemplate-set": "true"}, |
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.
Copy/paste from the previous test? - should probably be removed here because we don't use it in the test.
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.
Fixed. Removed Line 176 reference for Labels
test/e2e/common/node/podtemplates.go
Outdated
ptResource.Annotations = map[string]string{ | ||
"updated": "true", | ||
} | ||
updatedPT, err := ptClient.Update(context.TODO(), ptResource, metav1.UpdateOptions{}) | ||
|
||
err = retry.RetryOnConflict(retry.DefaultRetry, func() error { | ||
ptResource, err = ptClient.Get(context.TODO(), ptName, metav1.GetOptions{}) | ||
framework.ExpectNoError(err, "Unable to get pod template %s", ptName) | ||
|
||
updatedPT, err = ptClient.Update(context.TODO(), ptResource, metav1.UpdateOptions{}) | ||
return err | ||
}) |
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.
ptResource.Annotations = map[string]string{ | |
"updated": "true", | |
} | |
updatedPT, err := ptClient.Update(context.TODO(), ptResource, metav1.UpdateOptions{}) | |
err = retry.RetryOnConflict(retry.DefaultRetry, func() error { | |
ptResource, err = ptClient.Get(context.TODO(), ptName, metav1.GetOptions{}) | |
framework.ExpectNoError(err, "Unable to get pod template %s", ptName) | |
updatedPT, err = ptClient.Update(context.TODO(), ptResource, metav1.UpdateOptions{}) | |
return err | |
}) | |
var updatedPT *v1.PodTemplate | |
err = retry.RetryOnConflict(retry.DefaultRetry, func() error { | |
ptResource, err = ptClient.Get(context.TODO(), ptName, metav1.GetOptions{}) | |
framework.ExpectNoError(err, "Unable to get pod template %s", ptName) | |
ptResource.Annotations = map[string]string{ | |
"updated": "true", | |
} | |
updatedPT, err = ptClient.Update(context.TODO(), ptResource, metav1.UpdateOptions{}) | |
return err | |
}) |
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.
Fixed
|
||
err = retry.RetryOnConflict(retry.DefaultRetry, func() error { | ||
ptResource, err = ptClient.Get(context.TODO(), ptName, metav1.GetOptions{}) | ||
framework.ExpectNoError(err, "Unable to get pod template %s", ptName) |
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.
ptResource.Annotations will not contain updated=true
annotation after the Get
.
The test validates the following endpoint - replaceCoreV1NamespacedPodTemplate
2576286
to
522b9b3
Compare
/test pull-kubernetes-unit
|
/test pull-kubernetes-conformance-kind-ipv6-parallel
|
/lgtm |
/test pull-kubernetes-conformance-kind-ipv6-parallel
|
/test pull-kubernetes-integration
Checking the end of
|
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
/approve |
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.
/unhold
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dims, endocrimes, Riaankl, SergeyKanzhelev The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
This PR adds a test to test the following untested endpoint:
Which issue(s) this PR fixes:
Fixes #108285
Testgrid Link:
Testgid
Special notes for your reviewer:
Adds +1 endpoint test coverage (good for conformance)
Does this PR introduce a user-facing change?:
Release note:
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:
/sig testing
/sig architecture
/area conformance