-
Notifications
You must be signed in to change notification settings - Fork 47
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
feat: add e2e test for ttl seconds after finished in jobset #511
feat: add e2e test for ttl seconds after finished in jobset #511
Conversation
Hi @dejanzele. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
✅ Deploy Preview for kubernetes-sigs-jobset canceled.
|
/cc @ahg-g |
/ok-to-test |
test/e2e/e2e_test.go
Outdated
|
||
// Create JobSet. | ||
ginkgo.By("creating jobset with ttl seconds after finished") | ||
js := pingTestJobSetSubdomain(ns).TTLSecondsAfterFinished(5).Obj() |
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.
Let's not have the TTL test also be doing an unrelated networking test, this can cause issues/flakiness unrelated to the TTL feature being tested here. We should isolate the feature being tested to reduce flakiness and make debugging test failures easier.
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.
To avoid flakiness, we need to create the jobset with a finalizer to ensure that the jobset doesn't get deleted before we check that it exists and is complete; and then before we do the JobSetDeleted
check, we remove the finalizer.
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.
Thanks for working on this, left one comment.
test/e2e/e2e_test.go
Outdated
gomega.Expect(k8sClient.Create(ctx, js)).Should(gomega.Succeed()) | ||
|
||
// We'll need to retry getting this newly created jobset, given that creation may not immediately happen. | ||
gomega.Eventually(k8sClient.Get(ctx, types.NamespacedName{Name: js.Name, Namespace: js.Namespace}, &jobset.JobSet{}), timeout, interval).Should(gomega.Succeed()) |
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.
if create succeeded above, we shouldn't need to use eventually here
test/e2e/e2e_test.go
Outdated
ginkgo.By("checking all jobs were created successfully") | ||
gomega.Eventually(util.NumJobs, timeout, interval).WithArguments(ctx, k8sClient, js).Should(gomega.Equal(util.NumExpectedJobs(js))) |
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.
pls remove this check, we may face a race where the jobset is completed and marked as deleted before we get here.
test/e2e/e2e_test.go
Outdated
|
||
// Create JobSet. | ||
ginkgo.By("creating jobset with ttl seconds after finished") | ||
js := pingTestJobSetSubdomain(ns).TTLSecondsAfterFinished(5).Obj() |
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.
To avoid flakiness, we need to create the jobset with a finalizer to ensure that the jobset doesn't get deleted before we check that it exists and is complete; and then before we do the JobSetDeleted
check, we remove the finalizer.
1122e1d
to
ea522c4
Compare
@danielvegamyhre @ahg-g can you take another look please? |
test/util/util.go
Outdated
ginkgo.By("removing jobset finalizers") | ||
for i, f := range js.Finalizers { | ||
if f == finalizer { | ||
js.Finalizers = append(js.Finalizers[:i], js.Finalizers[i+1:]...) | ||
} | ||
} | ||
gomega.Expect(k8sClient.Update(ctx, js)).Should(gomega.Succeed()) |
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.
wrap this in Eventually to handle potential update conflicts
test/e2e/e2e_test.go
Outdated
|
||
// Check jobset is cleaned up after ttl seconds. | ||
ginkgo.By("checking jobset is cleaned up after ttl seconds") | ||
util.JobSetDeleted(ctx, k8sClient, &fresh, timeout) |
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.
use js instead of fresh here
test/e2e/e2e_test.go
Outdated
|
||
// We get the latest version of the jobset before removing the finalizer | ||
var fresh jobset.JobSet | ||
gomega.Expect(k8sClient.Get(ctx, types.NamespacedName{Name: js.Name, Namespace: js.Namespace}, &fresh)).Should(gomega.Succeed()) |
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.
move this get to inside removeJobSetFinalizer within Eventually (see comment there)
ea522c4
to
4988703
Compare
@ahg-g thanks for the review, I have addressed your comments |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ahg-g, dejanzele 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 |
Thanks! one thing I usually do is to force a bug in the test to check if it fails, just to verify that it is working as expected. I wonder if you did that? |
@ahg-g what kind of bug? i.e. the test will fail if you don't get latest version of the jobset before updating as it will fail due to conflict, or it will fail if you delete the jobset manually in the middle of the test run, I did those two things which forced a failure |
CHANGELOG
This PR is an improvement for #279